Grounded-Segment-Anything环境安装踩坑记录

创建conda 环境

需求: python>=3.8, as well as pytorch>=1.7 and torchvision>=0.8
安装完后,按照官网Grounded-Segment-Anything说明安装相应的包 .

依次安装
Install Segment Anything:

python -m pip install -e segment_anything

Install Grounding DINO:

python -m pip install -e GroundingDINO

Install diffusers:

pip install --upgrade diffusers[torch]

Install osx:

git submodule update --init --recursive
cd grounded-sam-osx && bash install.sh

Install osx:

git submodule update --init --recursive
cd Tag2Text && pip install -r requirements.txt

然后安装

pip install opencv-python pycocotools matplotlib onnxruntime onnx ipykernel

开始出现transformers库的问题

通过conda命令解决了问题:

conda install -c huggingface transformers

出现不能联网下载huggingface文件的错误

(MaxRetryError("HTTPSConnectionPool(host=‘huggingface.co’, port=443): Max retries exceeded with url: /bert-base-uncased/resolve/main/tokenizer_config.json

解决办法:

  • 给出了不用连接 huggingface,下载到本地库的方法:
  1. : 在huggingface bert-base-uncased库上下载包括 config.json, flax_model.msgpack, pytorch_model.bin, tf_model.h5, tokenizer.json, tokenizer_config.json, vocab.txt
  2. : 把1中下载的文件放到项目文件夹中, 比如Grounded-Segment-Anything/huggingface/bert-base-uncased
  3. : 修改 text_encoder_type in get_tokenlizer.py#L17
    和 get_tokenlizer.py#L23 为我们本地的路径
  4. : 运行代码grounding_dino_demo.py通过

请添加图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值