Groundeddino连接问题

最近用了Grounded-Segment-Anything来做text prompt的语义分割。按照官方教程安装好后,运行 grounding_dino demo:

python grounding_dino_demo.py

报错如下:

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'.

参考Grounded-Segment-Anything/issues/75的comment:

Here is my workaround to run the model without connecting to huggingface:

Step 1: download necessary files listed in huggingface-bert-base-uncased, including config.json, flax_model.msgpack, pytorch_model.bin, tf_model.h5, tokenizer.json, tokenizer_config.json, vocab.txt
Step 2: put downloaded files (Step 1) into your local folder. For example, the local folder could be Grounded-Segment-Anything/huggingface/bert-base-uncased
Step 3: modify text_encoder_type in get_tokenlizer.py#L17
and get_tokenlizer.py#L23 to your local folder (defined in Step 2)
Step 4: run the model and enjoy it

至于step3参考Grounded-Segment-Anything/issues/346,修改如下:

    # tokenizer = AutoTokenizer.from_pretrained(text_encoder_type)
    tokenizer = AutoTokenizer.from_pretrained('YOUR PATH/bert-base-uncased', cache_dir='bert-base-uncased')
    # return BertModel.from_pretrained(text_encoder_type)
    return BertModel.from_pretrained('YOUR PATH/bert-base-uncased', local_files_only=True) 

修改后就可以了,如果还是不能解决建议参考GroundingDINO官方repo的issue。

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值