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,下载到本地库的方法:
- : 在huggingface bert-base-uncased库上下载包括 config.json, flax_model.msgpack, pytorch_model.bin, tf_model.h5, tokenizer.json, tokenizer_config.json, vocab.txt
- : 把1中下载的文件放到项目文件夹中, 比如Grounded-Segment-Anything/huggingface/bert-base-uncased
- : 修改 text_encoder_type in get_tokenlizer.py#L17
和 get_tokenlizer.py#L23 为我们本地的路径 - : 运行代码grounding_dino_demo.py通过