Automatic Speech Recognition
Transformers
Safetensors
phi4mm
text-generation
nlp
code
audio
speech-summarization
speech-translation
visual-question-answering
phi-4-multimodal
phi
phi-4-mini
custom_code
Eval Results
Instructions to use microsoft/Phi-4-multimodal-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Phi-4-multimodal-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="microsoft/Phi-4-multimodal-instruct", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-multimodal-instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Fix bug with safe suffix removal (#34)
Browse files- Safe suffix removal (507cf490804a20826b1defcf7f4dbf9af57a0f78)
Co-authored-by: Junkun Chen <shtpgshus@users.noreply.huggingface.co>
sample_finetune_speech.py
CHANGED
|
@@ -284,7 +284,7 @@ def evaluate(
|
|
| 284 |
for _pred_ids, _stop_tokens_idx in zip(generated_ids, stop_tokens_idx)
|
| 285 |
]
|
| 286 |
all_generated_texts.extend(generated_text)
|
| 287 |
-
labels = [processor.decode(_label_ids[_label_ids != 0]).
|
| 288 |
all_labels.extend(labels)
|
| 289 |
|
| 290 |
all_generated_texts = gather_object(all_generated_texts)
|
|
|
|
| 284 |
for _pred_ids, _stop_tokens_idx in zip(generated_ids, stop_tokens_idx)
|
| 285 |
]
|
| 286 |
all_generated_texts.extend(generated_text)
|
| 287 |
+
labels = [processor.decode(_label_ids[_label_ids != 0]).removesuffix(ANSWER_SUFFIX) for _label_ids in inputs["labels"]]
|
| 288 |
all_labels.extend(labels)
|
| 289 |
|
| 290 |
all_generated_texts = gather_object(all_generated_texts)
|