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
Add placeholder for the `prepare_inputs_for_generation` method for compatibility with transformers>=4.50
Browse files- modeling_phi4mm.py +9 -0
modeling_phi4mm.py
CHANGED
|
@@ -1932,6 +1932,15 @@ class Phi4MMModel(Phi4MMPreTrainedModel):
|
|
| 1932 |
)
|
| 1933 |
return causal_mask
|
| 1934 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1935 |
|
| 1936 |
class Phi4MMForCausalLM(Phi4MMPreTrainedModel, GenerationMixin):
|
| 1937 |
_tied_weights_keys = ["lm_head.weight"]
|
|
|
|
| 1932 |
)
|
| 1933 |
return causal_mask
|
| 1934 |
|
| 1935 |
+
def prepare_inputs_for_generation():
|
| 1936 |
+
"""
|
| 1937 |
+
Placeholder for the `prepare_inputs_for_generation` method.
|
| 1938 |
+
|
| 1939 |
+
This function is part of the `GenerationMixin` and is added to the `Phi4MMModel`
|
| 1940 |
+
class to prevent the model from breaking due to the AttributeError.
|
| 1941 |
+
"""
|
| 1942 |
+
pass
|
| 1943 |
+
|
| 1944 |
|
| 1945 |
class Phi4MMForCausalLM(Phi4MMPreTrainedModel, GenerationMixin):
|
| 1946 |
_tied_weights_keys = ["lm_head.weight"]
|