Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -130,9 +130,8 @@ with torch.no_grad():
|
|
| 130 |
probs = torch.softmax(logits, dim=-1)[0]
|
| 131 |
pred_id = torch.argmax(probs).item()
|
| 132 |
|
| 133 |
-
# Get accent
|
| 134 |
-
|
| 135 |
-
predicted_accent = accents[pred_id]
|
| 136 |
confidence = probs[pred_id].item()
|
| 137 |
|
| 138 |
print(f"Predicted Accent: {predicted_accent}")
|
|
@@ -167,9 +166,14 @@ for segment in segments:
|
|
| 167 |
|
| 168 |
predictions.append(probs)
|
| 169 |
|
| 170 |
-
# Aggregate predictions
|
| 171 |
avg_probs = torch.stack(predictions).mean(dim=0)
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
```
|
| 174 |
|
| 175 |
## Performance
|
|
|
|
| 130 |
probs = torch.softmax(logits, dim=-1)[0]
|
| 131 |
pred_id = torch.argmax(probs).item()
|
| 132 |
|
| 133 |
+
# Get accent and confidence from model config
|
| 134 |
+
predicted_accent = model.config.id2label[pred_id]
|
|
|
|
| 135 |
confidence = probs[pred_id].item()
|
| 136 |
|
| 137 |
print(f"Predicted Accent: {predicted_accent}")
|
|
|
|
| 166 |
|
| 167 |
predictions.append(probs)
|
| 168 |
|
| 169 |
+
# Aggregate predictions across segments
|
| 170 |
avg_probs = torch.stack(predictions).mean(dim=0)
|
| 171 |
+
final_pred_id = torch.argmax(avg_probs).item()
|
| 172 |
+
final_accent = model.config.id2label[final_pred_id]
|
| 173 |
+
final_confidence = avg_probs[final_pred_id].item()
|
| 174 |
+
|
| 175 |
+
print(f"Final Predicted Accent: {final_accent}")
|
| 176 |
+
print(f"Confidence: {final_confidence:.1%}")
|
| 177 |
```
|
| 178 |
|
| 179 |
## Performance
|