Changesets · Branches · Tags · Compare
| Changeset | dca02c491d0b2332f152dd953751fe42808f6c8473efbf4311312ebe16381ae4 |
|---|---|
| Author | Prince Canuma <prince.gdt@gmail.com> · 2024-05-05 00:26 +02:00 |
| Committer | GitHub <noreply@github.com> · 2024-05-05 00:26 +02:00 |
| Parents | b2ffb51dff21, 18a97ae8d33d |
1 file changed
modified mlx_vlm/utils.py +19 −1
| @@ -120,7 +120,25 @@ | ||
| 120 | 120 | weight_files = glob.glob(str(model_path / "*.safetensors")) |
| 121 | 121 | if not weight_files: |
| 122 | 122 | logging.error(f"No safetensors found in {model_path}") |
| 123 | - raise FileNotFoundError(f"No safetensors found in {model_path}") | |
| 123 | + message = f""" | |
| 124 | +No safetensors found in {model_path} | |
| 125 | +Create safetensors using the following code: | |
| 126 | +``` | |
| 127 | +from transformers import AutoModelForCausalLM, AutoProcessor | |
| 128 | + | |
| 129 | +model_id= "<huggingface_model_id>" | |
| 130 | +model = AutoModelForCausalLM.from_pretrained(model_id) | |
| 131 | +processor = AutoProcessor.from_pretrained(model_id) | |
| 132 | + | |
| 133 | +model.save_pretrained("<local_dir>") | |
| 134 | +processor.save_pretrained("<local_dir>") | |
| 135 | +``` | |
| 136 | +Then use the <local_dir> as the --hf-path in the convert script. | |
| 137 | +``` | |
| 138 | +python -m mlx_vlm.convert --hf-path <local_dir> --mlx-path <mlx_dir> | |
| 139 | +``` | |
| 140 | + """ | |
| 141 | + raise FileNotFoundError(message) | |
| 124 | 142 | |
| 125 | 143 | weights = {} |
| 126 | 144 | for wf in weight_files: |