Closed IamShubhamGupto closed 4 months ago
Thanks for sharing!
This is happening because vila doesn't have any safetensors in the repo.
Here is what you can do:
Load the using transformers and torch, the save it:
# Load model directly
from transformers import AutoModelForCausalLM, AutoProcessor
model_id= "Efficient-Large-Model/VILA-7b"
model = AutoModelForCausalLM.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)
model.save_pretrained("vila-7b")
processor.save_pretrained("vila-7b")
The use the convert script and point the --hf-path to the saved folder
@Blaizzy thanks for the guide! I will try it out.
This seems like an automation we can add within mlx-vlm
. Does it make sense for the library to do this by itself if a user provides a repo without safetensors?
Most welcome!
Hard to say, because I don't want to add heavy dependencies (torch or TF) just to automate a rare use case.
I think for now, we can add this snippet in the error message.
Do you mind making a PR with this improved error message?
Thanks for sharing!
This is happening because vila doesn't have any safetensors in the repo.
Here is what you can do:
Load the using transformers and torch, the save it:
# Load model directly from transformers import AutoModelForCausalLM, AutoProcessor model_id= "Efficient-Large-Model/VILA-7b" model = AutoModelForCausalLM.from_pretrained(model_id) processor = AutoProcessor.from_pretrained(model_id) model.save_pretrained("vila-7b") processor.save_pretrained("vila-7b")
im guessing this is a model specific error, another one might have worked
/Users/shubham/anaconda3/envs/mlx/lib/python3.12/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
warnings.warn(
Traceback (most recent call last):
File "/Users/shubham/anaconda3/envs/mlx/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py", line 945, in from_pretrained
config_class = CONFIG_MAPPING[config_dict["model_type"]]
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/shubham/anaconda3/envs/mlx/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py", line 647, in __getitem__
raise KeyError(key)
KeyError: 'llava_llama'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/shubham/Documents/workspace/forks/mlx-vlm/mlx_vlm/dummy.py", line 5, in <module>
model = AutoModelForCausalLM.from_pretrained(model_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/shubham/anaconda3/envs/mlx/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 523, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/shubham/anaconda3/envs/mlx/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py", line 947, in from_pretrained
raise ValueError(
ValueError: The checkpoint you are trying to load has model type `llava_llama` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.
Hello
I was trying out the
mlx-vlm
package and was able to run the default example hereHowever, replacing the model card with Efficient-Large-Model/VILA-13b-4bit-awq, it fails. heres the stack trace:
I am using a m1 MacBook Pro. Im new to
mlx-vlm
but im happy to work on this to add support.