waveydaveygravy
commited on
Commit
•
a3f557d
1
Parent(s):
d0b32f3
Upload moore_animate.ipynb
Browse files- moore_animate.ipynb +119 -0
moore_animate.ipynb
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"source": [
|
22 |
+
"!rm -rf /content/sample_data\n",
|
23 |
+
"!wget https://huggingface.co/waveydaveygravy/Moore-AnimateAnyone/resolve/main/Moore-AnimateAnyone.zip\n",
|
24 |
+
"!unzip Moore-AnimateAnyone.zip\n",
|
25 |
+
"%cd /content/Moore-AnimateAnyone\n",
|
26 |
+
"!pip install -r requirements.txt\n",
|
27 |
+
"\n",
|
28 |
+
"\n"
|
29 |
+
],
|
30 |
+
"metadata": {
|
31 |
+
"id": "SGWqEghrOl9j"
|
32 |
+
},
|
33 |
+
"execution_count": null,
|
34 |
+
"outputs": []
|
35 |
+
},
|
36 |
+
{
|
37 |
+
"cell_type": "code",
|
38 |
+
"source": [
|
39 |
+
"!apt -y install -qq aria2\n",
|
40 |
+
"\n",
|
41 |
+
"BaseModelUrl = \"https://huggingface.co/runwayml/stable-diffusion-v1-5\"\n",
|
42 |
+
"BaseModelDir = \"/content/Moore-AnimateAnyone/pretrainedweights/stable-diffusion-v1-5\"\n",
|
43 |
+
"\n",
|
44 |
+
"# Create the target directory and necessary subdirectories\n",
|
45 |
+
"!mkdir -p {BaseModelDir} {BaseModelDir}/vae {BaseModelDir}/unet {BaseModelDir}/tokenizer {BaseModelDir}/text_encoder {BaseModelDir}/scheduler {BaseModelDir}/safety_checker {BaseModelDir}/feature_extractor\n",
|
46 |
+
"\n",
|
47 |
+
"# Clone all model components using aria2c, specifying the correct output directories\n",
|
48 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl} -d {BaseModelDir}\n",
|
49 |
+
"!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",
|
50 |
+
"!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",
|
51 |
+
"!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",
|
52 |
+
"!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",
|
53 |
+
"!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",
|
54 |
+
"!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",
|
55 |
+
"!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",
|
56 |
+
"!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",
|
57 |
+
"!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",
|
58 |
+
"!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",
|
59 |
+
"!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",
|
60 |
+
"!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",
|
61 |
+
"!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {BaseModelUrl}/resolve/main/safety_checker/pytorch_model.bin -d {BaseModelDir}/safety\n"
|
62 |
+
],
|
63 |
+
"metadata": {
|
64 |
+
"id": "f86SbtfCUgF3"
|
65 |
+
},
|
66 |
+
"execution_count": null,
|
67 |
+
"outputs": []
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"cell_type": "code",
|
71 |
+
"source": [
|
72 |
+
"%cd /content/Moore-AnimateAnyone/pretrainedweights\n",
|
73 |
+
"!wget https://huggingface.co/patrolli/AnimateAnyone/resolve/main/denoising_unet.pth\n",
|
74 |
+
"!wget https://huggingface.co/patrolli/AnimateAnyone/resolve/main/motion_module.pth\n",
|
75 |
+
"!wget https://huggingface.co/patrolli/AnimateAnyone/resolve/main/pose_guider.pth\n",
|
76 |
+
"!wget https://huggingface.co/patrolli/AnimateAnyone/resolve/main/reference_unet.pth\n",
|
77 |
+
"\n",
|
78 |
+
"%cd /content/Moore-AnimateAnyone/pretrainedweights/image_encoder\n",
|
79 |
+
"!wget https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/pytorch_model.bin\n",
|
80 |
+
"!wget https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/config.json\n",
|
81 |
+
"\n",
|
82 |
+
"%cd /content/Moore-AnimateAnyone/pretrainedweights/DWpose\n",
|
83 |
+
"!wget https://huggingface.co/yzd-v/DWPose/resolve/main/yolox_l.onnx #yolox\n",
|
84 |
+
"!wget https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.onnx #dwpose"
|
85 |
+
],
|
86 |
+
"metadata": {
|
87 |
+
"id": "-ESNzmpIWHyf"
|
88 |
+
},
|
89 |
+
"execution_count": null,
|
90 |
+
"outputs": []
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"cell_type": "code",
|
94 |
+
"source": [
|
95 |
+
"#@title to extract pose (not tested)\n",
|
96 |
+
"#%cd /content/Moore-AnimateAnyone\n",
|
97 |
+
"#!python /content/Moore-AnimateAnyone/vid2pose.py --video_path /content/Moore-AnimateAnyone/animation4.mp4"
|
98 |
+
],
|
99 |
+
"metadata": {
|
100 |
+
"id": "BobRXjG7tG4b"
|
101 |
+
},
|
102 |
+
"execution_count": null,
|
103 |
+
"outputs": []
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"cell_type": "code",
|
107 |
+
"source": [
|
108 |
+
"#@title YOU NEED TO HAVE A POSE VIDEO FIRST, CAN USE THE EXAMPLES. GRADIO WILL CRASH DURING GENERATION BUT SAVE TO OUTPUTS--\n",
|
109 |
+
"%cd /content/Moore-AnimateAnyone\n",
|
110 |
+
"!python /content/Moore-AnimateAnyone/app.py"
|
111 |
+
],
|
112 |
+
"metadata": {
|
113 |
+
"id": "DJxzTyuKbIX1"
|
114 |
+
},
|
115 |
+
"execution_count": null,
|
116 |
+
"outputs": []
|
117 |
+
}
|
118 |
+
]
|
119 |
+
}
|