MotionBooth环境装配问题小结

目录

python和torch版本匹配

torch安装

diffusers安装

xformers安装

版本对应

源码安装(Install from source)

其他环境的安装(requirements.txt)

权重下载

1、用sudo指令安装git-lfs

2、运行git lfs install

3、运行git clone

4、ImportError: attempted relative import with no known parent package

原repo中的错误


python和torch版本匹配

原repo中python为3.11,由于电脑当时支持的CUDA是11.4,所以torch装的版本是1.12.1+cu113,忽略了torch1.12只能适配3.10以下的python,改为3.10后即可。

torch安装

Previous PyTorch Versions | PyTorch

验证torch和CUDA是否正常安装

import torch
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA version: {torch.version.cuda}")
print(f"Is CUDA available: {torch.cuda.is_available()}")

diffusers安装

直接用原repo中给的指令无法安装,去huggingface官网找到下面这个就安装成功了

https://huggingface.co/docs/diffusers/installation

pip install transformers
pip install accelerate
conda install -c conda-forge diffusers

xformers安装

版本对应

如果直接安装xformers,会把原来版本的torch卸载掉装成与最新的xformers对应的版本。那么要找到对应torch版本的xformers,可以查看不同版本分支下的requirements.txt文件,一般会有对torch版本的要求

https://github.com/facebookresearch/xformers/tree/v0.0.16

源码安装(Install from source)

cd ..
git clone --branch v0.0.16 https://github.com/facebookresearch/xformers.git
cd xformers
git submodule update --init --recursive
pip install -r requirements.txt
pip install -e .
cd MotionBooth

参考:【文生图系列】 Stable Diffusion v2复现教程-CSDN博客

其他环境的安装(requirements.txt)

直接输入下面这个命令会把原本的torch卸载安装最新版本

pip install -r requirements.txt

需要在requirements.txt中加入几行限制

torch==1.12.1+cu113
torchvision==0.13.1+cu113
torchaudio==0.12.1+cu113

权重下载

采用克隆的方式从huggingface上下载

1、用sudo指令安装git-lfs

sudo apt update
sudo apt install git-lfs

2、运行git lfs install

出现问题:

Error: Failed to call git rev-parse --git-dir: exit status 128 
Git LFS initialized.

解决方法:初始化git仓库(图片内容来源参考博文)

3、运行git clone

运行完之后文件夹和小文件均可克隆,但是大文件会不成功,需要下载到本地然后再上传到服务器,大文件损坏就可能出现下面这个error。

_pickle.UnpicklingError: invalid load key, 'v'.

 参考:git lfs install遇到的问题_git: 'lfs' is not a git command. see 'git --help'.-CSDN博客

4、ImportError: attempted relative import with no known parent package

方法一:直接按照参考中的加入__init__.py文件,可以为空。

方法二:不直接运行脚本,而是用(原repo中的做法)

python -m scripts.inference

参考:Python项目文件引用问题:ImportError: attempted relative import with no known parent package-CSDN博客

原repo中的错误

运行相机控制的时候报错,需要修改的内容如下:

Inference code · Issue #2 · jianzongwu/MotionBooth · GitHub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值