marcosremar commited on
Commit ·
7391cea
1
Parent(s): d669352
Fix emotion2vec: use correct PT-BR model
Browse files- Changed to alefiury/wav2vec2-xls-r-300m-pt-br-spontaneous-speech-emotion-recognition
- Winner of SE&R 2022 Workshop for Portuguese speech
- Trained on CORAA SER v1.0 + multilingual datasets (EMOVO, RAVDESS, BAVED)
- 3 classes: neutral, non_neutral_female, non_neutral_male
- Model exists and is compatible with transformers
Previous attempt used non-existent model name.
ensemble_tts/models/emotion.py
CHANGED
|
@@ -43,14 +43,14 @@ class Emotion2VecModel(BaseModel):
|
|
| 43 |
self.model = Wav2Vec2ForSequenceClassification.from_pretrained(str(finetuned_path))
|
| 44 |
logger.info("✅ Using FINE-TUNED model (trained on VERBO/emoUERJ)")
|
| 45 |
else:
|
| 46 |
-
# Use
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
)
|
| 52 |
if self.use_finetuned:
|
| 53 |
-
logger.warning("⚠️ Fine-tuned model not found, using
|
| 54 |
logger.info("To fine-tune: python scripts/training/finetune_emotion2vec.py")
|
| 55 |
|
| 56 |
self.model.to(self.device)
|
|
|
|
| 43 |
self.model = Wav2Vec2ForSequenceClassification.from_pretrained(str(finetuned_path))
|
| 44 |
logger.info("✅ Using FINE-TUNED model (trained on VERBO/emoUERJ)")
|
| 45 |
else:
|
| 46 |
+
# Use PT-BR emotion recognition model as compatible alternative
|
| 47 |
+
# Winner of SE&R 2022 Workshop for Portuguese speech
|
| 48 |
+
pt_br_model = "alefiury/wav2vec2-xls-r-300m-pt-br-spontaneous-speech-emotion-recognition"
|
| 49 |
+
logger.info(f"Loading {pt_br_model}...")
|
| 50 |
+
self.processor = Wav2Vec2Processor.from_pretrained(pt_br_model)
|
| 51 |
+
self.model = Wav2Vec2ForSequenceClassification.from_pretrained(pt_br_model)
|
| 52 |
if self.use_finetuned:
|
| 53 |
+
logger.warning("⚠️ Fine-tuned model not found, using pre-trained PT-BR model")
|
| 54 |
logger.info("To fine-tune: python scripts/training/finetune_emotion2vec.py")
|
| 55 |
|
| 56 |
self.model.to(self.device)
|