Closed gaoyuanzizizi closed 3 days ago
使用FLMRModelForRetrieval加载也是一样的错误,我这边确认完整且正确的从huggingface上下载了LinWeizheDragon / PreFLMR_ViT-B 中的所有文件 model = FLMRModelForRetrieval.from_pretrained( checkpoint_path, query_tokenizer=query_tokenizer, context_tokenizer=context_tokenizer, )
Hi, this is because the transformer package failed to connect to Huggingface from within China to download bert-base-uncased, which serves the base text encoder of PreFLMR. You can do so by getting a proxy for HF, and rerun the code.
export HF_ENDPOINT=https://hf-mirror.com
多谢多谢
参照示例代码: import torch import pandas as pd from transformers import AutoImageProcessor, AutoModel
from flmr import index_custom_collection from flmr import FLMRQueryEncoderTokenizer, FLMRContextEncoderTokenizer, FLMRModelForRetrieval
checkpoint_path = "/mnt/lustre/gaoyuan/models/LinWeizheDragon/PreFLMR_ViT-B" image_processor_name = "/mnt/lustre/gaoyuan/models/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k"
query_tokenizer = FLMRQueryEncoderTokenizer.from_pretrained(checkpoint_path, subfolder="query_tokenizer") context_tokenizer = FLMRContextEncoderTokenizer.from_pretrained( checkpoint_path, subfolder="context_tokenizer" )
model = AutoModel.from_pretrained( checkpoint_path, query_tokenizer=query_tokenizer, context_tokenizer=context_tokenizer, trust_remote_code=True )
报错如下: 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 bert-base-uncased is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.