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
Error: AttributeError: 'str' object has no attribute 'append'
#5
by shujatoor - opened
I am getting this
Traceback (most recent call last):
File "/home/shujatoor/finetune_phi4/test.py", line 3, in <module>
model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-multimodal-instruct", trust_remote_code=True)
File "/home/shujatoor/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 559, in from_pretrained
return model_class.from_pretrained(
File "/home/shujatoor/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 262, in _wrapper
return func(*args, **kwargs)
File "/home/shujatoor/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4185, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
File "/home/shujatoor/.cache/huggingface/modules/transformers_modules/microsoft/Phi-4-multimodal-instruct/4f70fd2c046b2bd6555abe9db54c16f9fdbe6d1d/modeling_phi4mm.py", line 1973, in __init__
peft_model.base_model.active_adapter.append("speech")
AttributeError: 'str' object has no attribute 'append'
while running the simple code:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-multimodal-instruct", trust_remote_code=True)
Maybe you can check the packages dependencies.
For example, this setting works
flash_attn==2.7.4.post1
torch==2.6.0
transformers==4.48.2
accelerate==1.3.0
soundfile==0.13.1
pillow==11.1.0
scipy==1.15.2
torchvision==0.21.0
backoff==2.2.1
peft==0.13.2
Thanks it worked
nguyenbh changed discussion status to closed