FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

can't load reranker-v2-minicpm-layerwise model

Open AlexYoung757 opened this issue 1 year ago • 7 comments

when uses code like this:

from FlagEmbedding import LayerWiseFlagLLMReranker

reranker = LayerWiseFlagLLMReranker('/path/bge-reranker-v2-minicpm-layerwise', use_fp16=True) 

score = reranker.compute_score(['query', 'passage'], cutoff_layers=[28]) # Adjusting 'cutoff_layers' to pick which layers are used for computing the score.
print(score)

environment

transformer==4.38.2 FlagEmbedding==1.2.9 sentence-transformers==2.6.1

so, the error as follow: Could not locate the configuration_minicpm_reranker.py inside BAAI/bge-reranker-v2-minicpm-layerwise.

OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like BAAI/bge-reranker-v2-minicpm-layerwise is not the path to a directory containing a file named configuration_minicpm_reranker.py. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

But i have download the minicpm-layerwise model, and set the path. anyone have same question?

AlexYoung757 avatar Apr 24 '24 08:04 AlexYoung757

I had the same problem

ChengRuiLiang avatar Apr 26 '24 02:04 ChengRuiLiang

If you download reranker-v2-minicpm-layerwise, you can load it with the following method:

  1. make sure configuration_minicpm_reranker.py and modeling_minicpm_reranker.py in /path/bge-reranker-v2-minicpm-layerwise.
  2. modify the following part of config.json:
"auto_map": {
    "AutoConfig": "configuration_minicpm_reranker.LayerWiseMiniCPMConfig",
    "AutoModel": "modeling_minicpm_reranker.LayerWiseMiniCPMModel",
    "AutoModelForCausalLM": "modeling_minicpm_reranker.LayerWiseMiniCPMForCausalLM"
  },

545999961 avatar Apr 26 '24 07:04 545999961

@545999961 Why are we turning off direct download from Huggingface in Commit https://github.com/FlagOpen/FlagEmbedding/commit/65cd70d73fc26dedbba5ceb1423b983cb7ee1c52? If we remove local_files_only=True then it works and having local file only seems quite inconvenient.

akkikiki avatar May 05 '24 04:05 akkikiki

@545999961 Why are we turning off direct download from Huggingface in Commit 65cd70d? If we remove local_files_only=True then it works and having local file only seems quite inconvenient.

I'm sorry that my negligence caused this problem, this part has been modified now, thank you for the reminder。

545999961 avatar May 05 '24 09:05 545999961

@545999961 Thanks a lot for the fix!

akkikiki avatar May 07 '24 18:05 akkikiki

我现在还是会遇到这个问题,由于网络证书的原因我无法从huggingface上下载,所以我把他下载到了本地,但是报错信息显示他还是从huggingface下载上的,这怎么解决?

@545999961 Why are we turning off direct download from Huggingface in Commit 65cd70d? If we remove local_files_only=True then it works and having local file only seems quite inconvenient.

I'm sorry that my negligence caused this problem, this part has been modified now, thank you for the reminder。

我现在还是会遇到这个问题,由于网络证书的原因我无法从huggingface上下载,所以我把他下载到了本地,但是报错信息显示他还是从huggingface下载上的,这怎么解决?

Zhouziyi828 avatar Jun 27 '24 09:06 Zhouziyi828