Closed sobek1886 closed 2 months ago
can you try to download the model first and then infer?
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')
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]}")
When trying to run the prediction using the fine-tuned models through model scope
I run into this error