Yuliang-Liu / Monkey

【CVPR 2024 Highlight】Monkey (LMM): Image Resolution and Text Label Are Important Things for Large Multi-modal Models
MIT License
1.82k stars 128 forks source link

Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory #134

Closed autogyro closed 1 month ago

autogyro commented 2 months ago

I download the pre trained check point by the following codes:

from transformers import AutoModelForCausalLM, AutoTokenizer checkpoint = "echo840/Monkey" model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map='cuda', trust_remote_code=True).eval() tokenizer = AutoTokenizer.from_pretrained(checkpoint, trust_remote_code=True)

Before that I installed requirment.txt file. while I run demo.py, got those:

File "E:\Monkey\demo.py", line 285, in main model, tokenizer = _load_model_tokenizer(args) File "E:\Monkey\demo.py", line 75, in _load_model_tokenizer model = MonkeyLMHeadModel.from_pretrained( File "E:\anaconda3\envs\minimonkey\lib\site-packages\transformers\modeling_utils.py", line 2650, in from_pretrained raise EnvironmentError( OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory E:/Monkey/monkey_model.

echo840 commented 2 months ago

Hello. Can you check if the files were fully downloaded?

autogyro commented 2 months ago

I downloaded 18G with 84 files from HF, and save it by default folder: 'C:\Users\simon\.cache\huggingface\...' How to write the DEFAULT_CKPT_PATH ?
DEFAULT_CKPT_PATH = 'C:\Users\simon\.cache\huggingface\modules\transformers_modules\echo840'? or ? THX

echo840 commented 2 months ago

For example, you should find a path in this form: '{your dirpath}/.cache/huggingface/hub/models--echo840--Monkey/snapshots/6487a8909269713393337a2d743b95a25a3a611b' or directly set the path to 'echo840/Monkey'. image

autogyro commented 2 months ago

thanks. I renamed this folder as your said. after I run the demo.py , I got new error message as the following: File "E:\Monkey\monkey_model\tokenization_qwen.py", line 218, in _add_tokens if surface_form not in SPECIAL_TOKENS + self.IMAGE_ST: AttributeError: 'QWenTokenizer' object has no attribute 'IMAGE_ST' THX

autogyro commented 2 months ago

got answer from https://github.com/Yuliang-Liu/Monkey/issues/69 How to downlaod the check points you pretrained for mini monkey ?

echo840 commented 1 month ago

image Hello, you can refer to Minimonkey's readme.