Coder Social home page Coder Social logo

MaxRetryError about emotion2vec HOT 3 CLOSED

sobek1886 avatar sobek1886 commented on September 1, 2024
MaxRetryError

from emotion2vec.

Comments (3)

ddlBoJack avatar ddlBoJack commented on September 1, 2024

can you try to download the model first and then infer?

from emotion2vec.

sobek1886 avatar sobek1886 commented on September 1, 2024

Can I do that using the modelscope inference pipeline?

This did not work for me

inference_pipeline = pipeline(
    task=Tasks.emotion_recognition,
    model= '/Users/piotr/Projects/speech-emotion-recognition/emotion2vec_plus_large/model.pt')

from emotion2vec.

Charles-yueyue831 avatar Charles-yueyue831 commented on September 1, 2024

I have resolved this problem by downloading the emotion2vec model to local. Here's my code.

import os
import numpy as np

from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

mapper = ["angry", "disgust", "fear", "happy", "neutral", "other", "sad", "surprised", "unknown"]

current_directory = os.getcwd()
emotion2vec_path = rf"{current_directory}\emotion2vec"

audio_name = "yuexin"
audio_path = rf"{current_directory}\audio\{audio_name}.wav"

model_path="iic/emotion2vec_base_finetuned"
inference_pipeline = pipeline(
    task=Tasks.emotion_recognition,
    model=emotion2vec_path
)

rec_result = inference_pipeline(audio_path, granularity="utterance", extract_embedding=False)

max_emotion_score = np.argmax(rec_result[0]["scores"])
print(f"emotion: {mapper[max_emotion_score]}\tconfidence: {rec_result[0]['scores'][max_emotion_score]}")

from emotion2vec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.