recognize-anything icon indicating copy to clipboard operation
recognize-anything copied to clipboard

Can't load tokenizer for 'bert-base-uncased'

Open Fangfajun opened this issue 1 year ago • 3 comments

python inference_ram_plus_openset.py --image images/openset_example.jpg \

--pretrained pretrained/ram_plus_swin_large_14m.pth
--llm_tag_des datasets/openimages_rare_200/openimages_rare_200_llm_tag_descriptions.json Traceback (most recent call last): File "inference_ram_plus_openset.py", line 49, in model = ram_plus(pretrained=args.pretrained, File "/home1/wangpq/RAM/subfolder/ram/models/ram_plus.py", line 403, in ram_plus model = RAM_plus(**kwargs) File "/home1/wangpq/RAM/subfolder/ram/models/ram_plus.py", line 137, in init self.tokenizer = init_tokenizer(text_encoder_type) File "/home1/wangpq/RAM/subfolder/ram/models/utils.py", line 131, in init_tokenizer tokenizer = BertTokenizer.from_pretrained(text_encoder_type) File "/home1/anaconda3/envs/RAM/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1785, in from_pretrained raise EnvironmentError( OSError: Can't load tokenizer for 'bert-base-uncased'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-base-uncased' is the correct path to a directory containing all relevant files for a BertTokenizer tokenizer.

Fangfajun avatar Jun 23 '24 08:06 Fangfajun

Have you solved it?

Akl-free avatar Apr 08 '25 15:04 Akl-free

https://github.com/xinyu1205/recognize-anything/issues/73

自己下载一下模型到本地,然后在参数路径改为模型的本地路径,比如 model = ram_plus(pretrained=pretrained, image_size=img_size, vit='swin_l', text_encoder_type='/home/xxxxx/.cache/models/google-bert/bert-base-uncased')

luffy0115 avatar Apr 11 '25 07:04 luffy0115

Image,transformers==4.25.1,torch= 1.13.1+cu117,我已经把权重下载到本地了,会报这个错。请问是什么原因呢

misfp avatar Apr 16 '25 03:04 misfp