Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: does not appear to have a file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt or flax_model.msgpack. #1521

Open
hessaAlawwad opened this issue Jan 8, 2025 · 4 comments

Comments

@hessaAlawwad
Copy link

hessaAlawwad commented Jan 8, 2025

Hello, I m following the code in "Llama 3.2 Vision Finetuning Unsloth - Radiography.ipynb" for finetuning on my dataset.
but after pushing the merged model to hugging face I got the error when trying to load it:

/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py:3491: FutureWarning: The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.
  warnings.warn(
Unused kwargs: ['quant_method']. These kwargs are not used in <class 'transformers.utils.quantization_config.BitsAndBytesConfig'>.
`low_cpu_mem_usage` was None, now default to True since model is quantized.
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
[<ipython-input-2-01d76ccf350d>](https://localhost:8080/#) in <cell line: 4>()
      2 from transformers import MllamaForConditionalGeneration
      3 
----> 4 model, tokenizer = MllamaForConditionalGeneration.from_pretrained("Hessa/llama3.2_10k", use_auth_token="hf_***", torch_dtype=torch.float16) #torch_dtype=torch.bfloat16

[/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, weights_only, *model_args, **kwargs)
   3927                                 )
   3928                             else:
-> 3929                                 raise EnvironmentError(
   3930                                     f"{pretrained_model_name_or_path} does not appear to have a file named"
   3931                                     f" {_add_variant(WEIGHTS_NAME, variant)}, {_add_variant(SAFE_WEIGHTS_NAME, variant)},"

OSError: Hessa/llama3.2_10k does not appear to have a file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt or flax_model.msgpack.
@garg-aayush
Copy link

I also face the same issue when I try to load the merged model from huggingface. @hessaAlawwad, any luck resolving this issue?

@danielhanchen
Copy link
Contributor

I'm working on a fix - I'll try adding it in the next few days - apologies on the delay!

@mosama1994
Copy link
Contributor

mosama1994 commented Jan 10, 2025

Yeah that is because the merged model in missing this file: model.safetensors.index.json. That is what i saw when i compared the saved model with the original models that are already out there. You can load from LoRA adapter and merge and try that will work. The last code solution I provided in this issue: #1492 (comment). Try that.

@danielhanchen
Copy link
Contributor

@garg-aayush @mosama1994 @hessaAlawwad Much apologies on the delay - I'm currently working on refactoring code to make Unsloth more resilient on saving vision models to 16bit - I'm currently tracking the issue here: #1559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants