---
title: YD_EMOE2
canonical_url: "https://www.modelscope.cn/models/AlbertTuring/YD_EMOE2"
md_url: "https://www.modelscope.cn/models/AlbertTuring/YD_EMOE2.md"
repository: AlbertTuring/YD_EMOE2
chinese_name: YD_EMOE2
last_updated: 2026-01-13
pipeline_tag: multi-modal-embedding
tasks:
  - multi-modal-embedding
library_name:
  - pytorch
frameworks:
  - Pytorch
downloads: 1
stars: 0
---

# YD_EMOE2

> YD_EMOE2 - AlbertTuring 在 ModelScope 开源的模型。对文本和音频模型进行双模态的情感分析

- **Repository**: AlbertTuring/YD_EMOE2
- **Tasks**: multi-modal-embedding
- **Downloads**: 1
- **Stars**: 0
- **Last updated**: 2026-01-13

Source: https://www.modelscope.cn/models/AlbertTuring/YD_EMOE2

---

```python
# 在get_emotion函数中传入文本以及音频的路径即可实现情感分析
# 由于extract_audio_features函数一次仅能提取一个音频的特征，因此get_emotion函数一次仅能分析一个样本的情感
def get_emotion(sentence, audio_path):
    text_feature = extract_text_features(sentence, text_model)
    audio_feature = extract_audio_features(audio_path, audio_model)
    output = emoe_model(text=text_feature, audio=audio_feature)
    logits_c = output['logits_c']
    emotion = torch.argmax(logits_c, dim=1).item()
    emotion_dict = {0: '愤怒', 1: '厌恶', 2: '中性'}  # (angry=0, disgusted=1, neutral=2)
    print(f"预测的情感类别: {emotion_dict[emotion]}")
    return emotion

# 调用示例如下
if __name__ == '__main__':
    sentence = '喂，好是的，嗯，现在是可以通过了吗？然后可以，嗯，目前没有了，我等会儿下载吧。'
    audio_path = 'data/3315758594578346_20240701093706_right_1.wav'
    emotion = get_emotion(sentence, audio_path)  
    print(emotion)
```
