腾讯游戏开源的AniPortrait!快来尝试一把

383 阅读1分钟

项目地址github.com/Zejun-Yang/…

话不多说,先来安装一下基础环境,体验整个流程。

Conda环境

conda create -n aniportrait python=3.10 -y
pip3 install -r requirements.txt
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia
pip3 install chardet

下载各种模型

cd pretrained_model
hdf.sh runwayml/stable-diffusion-v1-5 --tool aria2c -x 10
hdf.sh stabilityai/sd-vae-ft-mse -tool aria2c -x 10
hdf.sh facebook/wav2vec2-base-960h -tool aria2c -x 10
hdf.sh lambdalabs/sd-image-variations-diffusers -tool aria2c -x 10
hdf.sh ZJYang/AniPortrait -tool aria2c -x 10

关于hdf.sh的使用,可以参考这篇文章,链接

调整模型文件位置

./pretrained_weights/
|-- image_encoder
|   |-- config.json
|   `-- pytorch_model.bin
|-- sd-vae-ft-mse
|   |-- config.json
|   |-- diffusion_pytorch_model.bin
|   `-- diffusion_pytorch_model.safetensors
|-- stable-diffusion-v1-5
|   |-- feature_extractor
|   |   `-- preprocessor_config.json
|   |-- model_index.json
|   |-- unet
|   |   |-- config.json
|   |   `-- diffusion_pytorch_model.bin
|   `-- v1-inference.yaml
|-- wav2vec2-base-960h
|   |-- config.json
|   |-- feature_extractor_config.json
|   |-- preprocessor_config.json
|   |-- pytorch_model.bin
|   |-- README.md
|   |-- special_tokens_map.json
|   |-- tokenizer_config.json
|   `-- vocab.json
|-- audio2mesh.pt
|-- denoising_unet.pth
|-- motion_module.pth
|-- pose_guider.pth
`-- reference_unet.pth

最终的pretrained_model文件夹应该是这个样子。

运行一些demo

CUDA_VISIBLE_DEVICES=1,2,3,5 python3 -m scripts.pose2vid --config ./configs/prompts/animation.yaml -W 512 -H 512

当你的显卡比较多,0号显卡显存不足的时候,可以使用环境变量CUDA_VISIBLE_DEVICES来指定要使用的显卡。