FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

bge-small-zh加载错误

Open sevenandseven opened this issue 1 year ago • 1 comments

Hello, I downloaded the weights from the Hugging Face mirror, but when loading the model using FlagModel or SentenceTransformer methods, the following issues occur. How can I solve this.

Traceback (most recent call last): File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/transformers/modeling_utils.py", line 519, in load_state_dict return torch.load(checkpoint_file, map_location=map_location) File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/media/ai/HDD/Teamwork/FlagEmbedding-master/test/test_bge_small.py", line 32, in model = FlagModel('/media/ai/HDD/Teamwork/LLM_Embedding_model/Embedding/bge-small-zh', query_instruction_for_retrieval="", ) File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/FlagEmbedding/flag_models.py", line 20, in init self.model = AutoModel.from_pretrained(model_name_or_path) File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 566, in from_pretrained return model_class.from_pretrained( File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3393, in from_pretrained state_dict = load_state_dict(resolved_archive_file) File "/home/ai/anaconda3/envs/langchain_chatchat/lib/python3.10/site-packages/transformers/modeling_utils.py", line 524, in load_state_dict raise OSError( OSError: You seem to have cloned a repository without having git-lfs installed. Please install git-lfs and run git lfs install followed by git lfs pull in the folder you cloned.

sevenandseven avatar May 09 '24 08:05 sevenandseven

Hi, @sevenandseven , It looks like you haven't downloaded the model files correctly(OSError: You seem to have cloned a repository without having git-lfs installed. Please install git-lfs and run git lfs install followed by git lfs pull in the folder you cloned.). You can refer to this link: https://hf-mirror.com/ to learn how to download the model from hf mirror.

staoxiao avatar May 09 '24 14:05 staoxiao