waveydaveygravy
commited on
Commit
•
b5a2343
1
Parent(s):
9db7357
Upload Moore_animate_anyone.ipynb
Browse files- Moore_animate_anyone.ipynb +161 -0
Moore_animate_anyone.ipynb
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": [],
|
7 |
+
"gpuType": "T4"
|
8 |
+
},
|
9 |
+
"kernelspec": {
|
10 |
+
"name": "python3",
|
11 |
+
"display_name": "Python 3"
|
12 |
+
},
|
13 |
+
"language_info": {
|
14 |
+
"name": "python"
|
15 |
+
},
|
16 |
+
"accelerator": "GPU"
|
17 |
+
},
|
18 |
+
"cells": [
|
19 |
+
{
|
20 |
+
"cell_type": "code",
|
21 |
+
"execution_count": null,
|
22 |
+
"metadata": {
|
23 |
+
"id": "RXcT0H3RYk9j"
|
24 |
+
},
|
25 |
+
"outputs": [],
|
26 |
+
"source": [
|
27 |
+
"!git clone https://github.com/MooreThreads/Moore-AnimateAnyone.git"
|
28 |
+
]
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"cell_type": "code",
|
32 |
+
"source": [
|
33 |
+
"%cd /content/Moore-AnimateAnyone\n",
|
34 |
+
"!pip install -r requirements.txt\n",
|
35 |
+
"!pip install https://github.com/karaokenerds/python-audio-separator/releases/download/v0.12.1/onnxruntime_gpu-1.17.0-cp310-cp310-linux_x86_64.whl"
|
36 |
+
],
|
37 |
+
"metadata": {
|
38 |
+
"id": "Yi_MgKanYq--"
|
39 |
+
},
|
40 |
+
"execution_count": null,
|
41 |
+
"outputs": []
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"cell_type": "code",
|
45 |
+
"source": [
|
46 |
+
"#!mkdir /content/Moore-AnimateAnyone/pretrainedweights\n",
|
47 |
+
"!mkdir /content/Moore-AnimateAnyone/pretrainedweights/DWpose\n",
|
48 |
+
"!mkdir /content/Moore-AnimateAnyone/pretrainedweights/image_encoder\n",
|
49 |
+
"\n",
|
50 |
+
"print(\"done\")"
|
51 |
+
],
|
52 |
+
"metadata": {
|
53 |
+
"id": "KQkefoBbbZ0f"
|
54 |
+
},
|
55 |
+
"execution_count": null,
|
56 |
+
"outputs": []
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"cell_type": "code",
|
60 |
+
"source": [
|
61 |
+
"!git lfs install\n",
|
62 |
+
"!git clone https://huggingface.co/patrolli/AnimateAnyone"
|
63 |
+
],
|
64 |
+
"metadata": {
|
65 |
+
"id": "KF4KUup3aXNG"
|
66 |
+
},
|
67 |
+
"execution_count": null,
|
68 |
+
"outputs": []
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"cell_type": "code",
|
72 |
+
"source": [
|
73 |
+
"!apt -y install -qq aria2\n",
|
74 |
+
"BaseModelUrl = \"https://huggingface.co/runwayml/stable-diffusion-v1-5\"\n",
|
75 |
+
"BaseModelDir = \"/content/Moore-AnimateAnyone/pretrainedweights/stable-diffusion-v1-5\"\n",
|
76 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/model_index.json -d {BaseModelDir} -o model_index.json\n",
|
77 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/resolve/main/vae/diffusion_pytorch_model.bin -d {BaseModelDir}/vae -o diffusion_pytorch_model.bin\n",
|
78 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/vae/config.json -d {BaseModelDir}/vae -o config.json\n",
|
79 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/resolve/main/unet/diffusion_pytorch_model.bin -d {BaseModelDir}/unet -o diffusion_pytorch_model.bin\n",
|
80 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/unet/config.json -d {BaseModelDir}/unet -o config.json\n",
|
81 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/tokenizer/vocab.json -d {BaseModelDir}/tokenizer -o vocab.json\n",
|
82 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/tokenizer/tokenizer_config.json -d {BaseModelDir}/tokenizer -o tokenizer_config.json\n",
|
83 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/tokenizer/special_tokens_map.json -d {BaseModelDir}/tokenizer -o special_tokens_map.json\n",
|
84 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/tokenizer/merges.txt -d {BaseModelDir}/tokenizer -o merges.txt\n",
|
85 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/resolve/main/text_encoder/pytorch_model.bin -d {BaseModelDir}/text_encoder -o pytorch_model.bin\n",
|
86 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/text_encoder/config.json -d {BaseModelDir}/text_encoder -o config.json\n",
|
87 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/scheduler/scheduler_config.json -d {BaseModelDir}/scheduler -o scheduler_config.json\n",
|
88 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/resolve/main/safety_checker/pytorch_model.bin -d {BaseModelDir}/safety_checker -o pytorch_model.bin\n",
|
89 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/safety_checker/config.json -d {BaseModelDir}/safety_checker -o config.json\n",
|
90 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/raw/main/feature_extractor/preprocessor_config.json -d {BaseModelDir}/feature_extractor -o preprocessor_config.json"
|
91 |
+
],
|
92 |
+
"metadata": {
|
93 |
+
"id": "JAnAFo-GaKvH"
|
94 |
+
},
|
95 |
+
"execution_count": null,
|
96 |
+
"outputs": []
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"cell_type": "code",
|
100 |
+
"source": [
|
101 |
+
"%cd /content/Moore-AnimateAnyone/pretrainedweights/DWpose\n",
|
102 |
+
"!wget https://huggingface.co/yzd-v/DWPose/resolve/main/yolox_l.onnx #yolox\n",
|
103 |
+
"!wget https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.onnx #dwpose"
|
104 |
+
],
|
105 |
+
"metadata": {
|
106 |
+
"id": "y4KuiWsvc5NF"
|
107 |
+
},
|
108 |
+
"execution_count": null,
|
109 |
+
"outputs": []
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"cell_type": "code",
|
113 |
+
"source": [
|
114 |
+
"#@title Yaml file - alter model paths to suit here then copy and paste into the original yaml file or simply alter the original file\n",
|
115 |
+
"\n",
|
116 |
+
"pretrained_base_model_path: \"./pretrained_weights/stable-diffusion-v1-5/\"\n",
|
117 |
+
"pretrained_vae_path: \"./pretrained_weights/sd-vae-ft-mse\"\n",
|
118 |
+
"image_encoder_path: \"./pretrained_weights/image_encoder\"\n",
|
119 |
+
"denoising_unet_path: \"./pretrained_weights/denoising_unet.pth\"\n",
|
120 |
+
"reference_unet_path: \"./pretrained_weights/reference_unet.pth\"\n",
|
121 |
+
"pose_guider_path: \"./pretrained_weights/pose_guider.pth\"\n",
|
122 |
+
"motion_module_path: \"./pretrained_weights/motion_module.pth\"\n",
|
123 |
+
"\n",
|
124 |
+
"inference_config: \"./configs/inference/inference_v2.yaml\"\n",
|
125 |
+
"weight_dtype: 'fp16'\n",
|
126 |
+
"\n",
|
127 |
+
"test_cases:\n",
|
128 |
+
" \"./configs/inference/ref_images/anyone-2.png\":\n",
|
129 |
+
" - \"./configs/inference/pose_videos/anyone-video-2_kps.mp4\"\n",
|
130 |
+
" - \"./configs/inference/pose_videos/anyone-video-5_kps.mp4\"\n",
|
131 |
+
" \"./configs/inference/ref_images/anyone-10.png\":\n",
|
132 |
+
" - \"./configs/inference/pose_videos/anyone-video-1_kps.mp4\"\n",
|
133 |
+
" - \"./configs/inference/pose_videos/anyone-video-2_kps.mp4\"\n",
|
134 |
+
" \"./configs/inference/ref_images/anyone-11.png\":\n",
|
135 |
+
" - \"./configs/inference/pose_videos/anyone-video-1_kps.mp4\"\n",
|
136 |
+
" - \"./configs/inference/pose_videos/anyone-video-2_kps.mp4\"\n",
|
137 |
+
" \"./configs/inference/ref_images/anyone-3.png\":\n",
|
138 |
+
" - \"./configs/inference/pose_videos/anyone-video-2_kps.mp4\"\n",
|
139 |
+
" - \"./configs/inference/pose_videos/anyone-video-5_kps.mp4\"\n",
|
140 |
+
" \"./configs/inference/ref_images/anyone-5.png\":\n",
|
141 |
+
" - \"./configs/inference/pose_videos/anyone-video-2_kps.mp4\"\n"
|
142 |
+
],
|
143 |
+
"metadata": {
|
144 |
+
"id": "EZZvbXF3ewhF"
|
145 |
+
},
|
146 |
+
"execution_count": null,
|
147 |
+
"outputs": []
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"cell_type": "code",
|
151 |
+
"source": [
|
152 |
+
"!python /content/Moore-AnimateAnyone/app.py"
|
153 |
+
],
|
154 |
+
"metadata": {
|
155 |
+
"id": "z_qg7x4yZ_CN"
|
156 |
+
},
|
157 |
+
"execution_count": null,
|
158 |
+
"outputs": []
|
159 |
+
}
|
160 |
+
]
|
161 |
+
}
|