Safetensors
qwen2_vl
vidore
reranker

Model loading issues

#1
by MaxJeblick - opened

Thanks for providing the model!
Since today, I get the following error message, using transformers==4.46.2 and the following code:

import torch
from PIL import Image
from transformers import AutoProcessor, Qwen2VLForConditionalGeneration

# Load processor and model
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")
model = Qwen2VLForConditionalGeneration.from_pretrained(
    "lightonai/MonoQwen2-VL-v0.1",
    device_map="auto",
    # attn_implementation="flash_attention_2",
    # torch_dtype=torch.bfloat16,
)
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[9], line 7
      5 # Load processor and model
      6 processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")
----> 7 model = Qwen2VLForConditionalGeneration.from_pretrained(
      8     "lightonai/MonoQwen2-VL-v0.1",
      9     # device_map="auto",
     10     # attn_implementation="flash_attention_2",
     11     # torch_dtype=torch.bfloat16,
     12 )

File /mount/data/PycharmProjects/nemo-retriever-evaluation/venv/lib/python3.10/site-packages/transformers/modeling_utils.py:3913, in PreTrainedModel.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)
   3907                 raise EnvironmentError(
   3908                     f"{pretrained_model_name_or_path} does not appear to have a file named"
   3909                     f" {_add_variant(WEIGHTS_NAME, variant)} but there is a file without the variant"
   3910                     f" {variant}. Use `variant=None` to load this model from those weights."
   3911                 )
   3912             else:
-> 3913                 raise EnvironmentError(
   3914                     f"{pretrained_model_name_or_path} does not appear to have a file named"
   3915                     f" {_add_variant(WEIGHTS_NAME, variant)}, {_add_variant(SAFE_WEIGHTS_NAME, variant)},"
   3916                     f" {TF2_WEIGHTS_NAME}, {TF_WEIGHTS_NAME} or {FLAX_WEIGHTS_NAME}."
   3917                 )
   3919 except EnvironmentError:
   3920     # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted
   3921     # to the original exception.
   3922     raise

OSError: lightonai/MonoQwen2-VL-v0.1 does not appear to have a file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt or flax_model.msgpack.

Ok found the issue, I hadn't peft installed in my new env.
Could you mention in the README that peft is required when loading the model?

I also raised an issue in transformers to have a better message: https://github.com/huggingface/transformers/issues/34733

LightOn AI org

Thank you for pointing this out! We just updated the README.

NohTow changed discussion status to closed

Sign up or log in to comment