bluestarburst commited on
Commit
9d978ef
1 Parent(s): b9e2fa0

Upload folder using huggingface_hub

Browse files
Files changed (33) hide show
  1. AnimatedDiff_Colab.ipynb +826 -0
  2. animatediff/data/__pycache__/dataset.cpython-310.pyc +0 -0
  3. animatediff/models/__pycache__/attention.cpython-310.pyc +0 -0
  4. animatediff/models/__pycache__/attention.cpython-311.pyc +0 -0
  5. animatediff/models/__pycache__/motion_module.cpython-310.pyc +0 -0
  6. animatediff/models/__pycache__/motion_module.cpython-311.pyc +0 -0
  7. animatediff/models/__pycache__/resnet.cpython-310.pyc +0 -0
  8. animatediff/models/__pycache__/resnet.cpython-311.pyc +0 -0
  9. animatediff/models/__pycache__/unet.cpython-310.pyc +0 -0
  10. animatediff/models/__pycache__/unet.cpython-311.pyc +0 -0
  11. animatediff/models/__pycache__/unet_blocks.cpython-311.pyc +0 -0
  12. animatediff/models/attention.py +3 -2
  13. animatediff/models/motion_module.py +1 -1
  14. animatediff/pipelines/__pycache__/pipeline_animation.cpython-310.pyc +0 -0
  15. animatediff/pipelines/__pycache__/pipeline_animation.cpython-311.pyc +0 -0
  16. animatediff/pipelines/pipeline_animation.py +1 -1
  17. configs/test.yaml +3 -3
  18. handler.py +0 -12
  19. models/Motion_Module/test/config.yaml +3 -3
  20. models/StableDiffusion/.gitattributes +0 -1
  21. models/StableDiffusion/README.md +15 -19
  22. models/StableDiffusion/model_index.json +1 -1
  23. models/StableDiffusion/safety_checker/config.json +3 -3
  24. models/StableDiffusion/scheduler/scheduler_config.json +1 -1
  25. models/StableDiffusion/text_encoder/config.json +2 -2
  26. models/StableDiffusion/tokenizer/tokenizer_config.json +1 -1
  27. models/StableDiffusion/unet/config.json +1 -0
  28. models/StableDiffusion/vae/config.json +2 -1
  29. requirements.txt +0 -0
  30. tuneavideo/__pycache__/util.cpython-310.pyc +0 -0
  31. tuneavideo/data/__pycache__/frames_dataset.cpython-310.pyc +0 -0
  32. tuneavideo/data/__pycache__/multi_dataset.cpython-310.pyc +0 -0
  33. tuneavideo/models/attention.py +3 -2
AnimatedDiff_Colab.ipynb ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "colab": {
8
+ "base_uri": "https://localhost:8080/"
9
+ },
10
+ "id": "t0gCc4zNO0-J",
11
+ "outputId": "cb8cfaad-d4f1-4c26-92a6-644eb1bc9039"
12
+ },
13
+ "outputs": [
14
+ {
15
+ "name": "stdout",
16
+ "output_type": "stream",
17
+ "text": [
18
+ "Requirement already satisfied: wandb in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.16.0)\n",
19
+ "Requirement already satisfied: Click!=8.0.0,>=7.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (8.1.7)\n",
20
+ "Requirement already satisfied: GitPython!=3.1.29,>=1.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (3.1.40)\n",
21
+ "Requirement already satisfied: requests<3,>=2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (2.31.0)\n",
22
+ "Requirement already satisfied: psutil>=5.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (5.9.5)\n",
23
+ "Requirement already satisfied: sentry-sdk>=1.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.35.0)\n",
24
+ "Requirement already satisfied: docker-pycreds>=0.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (0.4.0)\n",
25
+ "Requirement already satisfied: PyYAML in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (6.0.1)\n",
26
+ "Requirement already satisfied: setproctitle in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.3.3)\n",
27
+ "Requirement already satisfied: setuptools in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (68.2.2)\n",
28
+ "Requirement already satisfied: appdirs>=1.4.3 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.4.4)\n",
29
+ "Requirement already satisfied: protobuf!=4.21.0,<5,>=3.19.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (4.25.0)\n",
30
+ "Requirement already satisfied: colorama in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from Click!=8.0.0,>=7.1->wandb) (0.4.6)\n",
31
+ "Requirement already satisfied: six>=1.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from docker-pycreds>=0.4.0->wandb) (1.16.0)\n",
32
+ "Requirement already satisfied: gitdb<5,>=4.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from GitPython!=3.1.29,>=1.0.0->wandb) (4.0.11)\n",
33
+ "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (3.3.2)\n",
34
+ "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (3.4)\n",
35
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (2.1.0)\n",
36
+ "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests<3,>=2.0.0->wandb) (2023.7.22)\n",
37
+ "Requirement already satisfied: smmap<6,>=3.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from gitdb<5,>=4.0.1->GitPython!=3.1.29,>=1.0.0->wandb) (5.0.1)\n"
38
+ ]
39
+ },
40
+ {
41
+ "name": "stderr",
42
+ "output_type": "stream",
43
+ "text": [
44
+ "wandb: ERROR Find detailed error logs at: C:\\Users\\texas\\AppData\\Local\\Temp\\debug-cli.texas.log\n",
45
+ "Error: api_key not configured (no-tty). call wandb login [your_api_key]\n"
46
+ ]
47
+ }
48
+ ],
49
+ "source": [
50
+ "!pip install wandb\n",
51
+ "!wandb login"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": 3,
57
+ "metadata": {
58
+ "colab": {
59
+ "base_uri": "https://localhost:8080/"
60
+ },
61
+ "id": "UGH2QZ4tDlzw",
62
+ "outputId": "0e2339d0-78b3-4a23-eddf-589c805adcc8"
63
+ },
64
+ "outputs": [
65
+ {
66
+ "name": "stdout",
67
+ "output_type": "stream",
68
+ "text": [
69
+ "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.10/dist-packages (0.19.4)\n",
70
+ "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (3.13.1)\n",
71
+ "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2023.6.0)\n",
72
+ "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2.31.0)\n",
73
+ "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.66.1)\n",
74
+ "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (6.0.1)\n",
75
+ "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.5.0)\n",
76
+ "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (23.2)\n",
77
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.3.2)\n",
78
+ "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.4)\n",
79
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2.0.7)\n",
80
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2023.7.22)\n",
81
+ "\n",
82
+ " _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|\n",
83
+ " _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n",
84
+ " _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|\n",
85
+ " _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n",
86
+ " _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|\n",
87
+ "\n",
88
+ " To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .\n",
89
+ "Token: \n",
90
+ "Add token as git credential? (Y/n) Y\n",
91
+ "Token is valid (permission: write).\n",
92
+ "\u001b[1m\u001b[31mCannot authenticate through git-credential as no helper is defined on your machine.\n",
93
+ "You might have to re-authenticate when pushing to the Hugging Face Hub.\n",
94
+ "Run the following command in your terminal in case you want to set the 'store' credential helper as default.\n",
95
+ "\n",
96
+ "git config --global credential.helper store\n",
97
+ "\n",
98
+ "Read https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more details.\u001b[0m\n",
99
+ "Token has not been saved to git credential helper.\n",
100
+ "Your token has been saved to /root/.cache/huggingface/token\n",
101
+ "Login successful\n"
102
+ ]
103
+ }
104
+ ],
105
+ "source": [
106
+ "!pip install huggingface_hub\n",
107
+ "# You already have it if you installed transformers or datasets\n",
108
+ "\n",
109
+ "!huggingface-cli login"
110
+ ]
111
+ },
112
+ {
113
+ "cell_type": "code",
114
+ "execution_count": 10,
115
+ "metadata": {
116
+ "colab": {
117
+ "base_uri": "https://localhost:8080/",
118
+ "height": 1000
119
+ },
120
+ "id": "iPDlxLC9PFzV",
121
+ "outputId": "076dead2-d2da-42bf-a867-1a0d59e0b3c2"
122
+ },
123
+ "outputs": [
124
+ {
125
+ "name": "stdout",
126
+ "output_type": "stream",
127
+ "text": [
128
+ "Requirement already satisfied: einops in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.7.0)\n",
129
+ "Requirement already satisfied: omegaconf in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.3.0)\n",
130
+ "Requirement already satisfied: decord in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.6.0)\n",
131
+ "Requirement already satisfied: safetensors in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.4.0)\n",
132
+ "Requirement already satisfied: diffusers==0.11.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers[torch]==0.11.1) (0.11.1)\n",
133
+ "Requirement already satisfied: transformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (4.25.1)\n",
134
+ "Requirement already satisfied: xformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.0.16)\n",
135
+ "Requirement already satisfied: triton==2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.0.0)\n",
136
+ "Collecting mediapy\n",
137
+ " Downloading mediapy-1.1.9-py3-none-any.whl.metadata (4.8 kB)\n",
138
+ "Requirement already satisfied: imageio[pyav] in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.27.0)\n",
139
+ "Requirement already satisfied: importlib-metadata in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (6.8.0)\n",
140
+ "Requirement already satisfied: filelock in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (3.13.1)\n",
141
+ "Requirement already satisfied: huggingface-hub>=0.10.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (0.19.4)\n",
142
+ "Requirement already satisfied: numpy in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (1.26.0)\n",
143
+ "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.10.3)\n",
144
+ "Requirement already satisfied: requests in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (2.31.0)\n",
145
+ "Requirement already satisfied: Pillow in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from diffusers==0.11.1->diffusers[torch]==0.11.1) (10.1.0)\n",
146
+ "Requirement already satisfied: cmake in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (3.27.7)\n",
147
+ "Requirement already satisfied: torch in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (1.13.1)\n",
148
+ "Collecting accelerate>=0.11.0 (from diffusers[torch]==0.11.1)\n",
149
+ " Downloading accelerate-0.24.1-py3-none-any.whl.metadata (18 kB)\n",
150
+ "Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (4.9.3)\n",
151
+ "Requirement already satisfied: PyYAML>=5.1.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (6.0.1)\n",
152
+ "Requirement already satisfied: packaging>=20.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (23.2)\n",
153
+ "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (0.13.3)\n",
154
+ "Requirement already satisfied: tqdm>=4.27 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (4.66.1)\n",
155
+ "Requirement already satisfied: pyre-extensions==0.0.23 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from xformers) (0.0.23)\n",
156
+ "Requirement already satisfied: typing-inspect in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from pyre-extensions==0.0.23->xformers) (0.9.0)\n",
157
+ "Requirement already satisfied: typing-extensions in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from pyre-extensions==0.0.23->xformers) (4.8.0)\n",
158
+ "Collecting av (from imageio[pyav])\n",
159
+ " Downloading av-11.0.0-cp310-cp310-win_amd64.whl.metadata (4.7 kB)\n",
160
+ "Requirement already satisfied: ipython in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (8.17.2)\n",
161
+ "Requirement already satisfied: matplotlib in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (3.8.1)\n",
162
+ "Requirement already satisfied: psutil in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from accelerate>=0.11.0->diffusers[torch]==0.11.1) (5.9.5)\n",
163
+ "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from huggingface-hub>=0.10.0->diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.10.0)\n",
164
+ "Requirement already satisfied: colorama in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from tqdm>=4.27->transformers) (0.4.6)\n",
165
+ "Requirement already satisfied: zipp>=0.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from importlib-metadata->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.17.0)\n",
166
+ "Requirement already satisfied: decorator in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.1.1)\n",
167
+ "Requirement already satisfied: jedi>=0.16 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.19.1)\n",
168
+ "Requirement already satisfied: matplotlib-inline in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.1.6)\n",
169
+ "Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (3.0.41)\n",
170
+ "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (2.16.1)\n",
171
+ "Requirement already satisfied: stack-data in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.6.2)\n",
172
+ "Requirement already satisfied: traitlets>=5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.13.0)\n",
173
+ "Requirement already satisfied: exceptiongroup in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (1.1.3)\n",
174
+ "Requirement already satisfied: contourpy>=1.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.2.0)\n",
175
+ "Requirement already satisfied: cycler>=0.10 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (0.12.1)\n",
176
+ "Requirement already satisfied: fonttools>=4.22.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (4.44.3)\n",
177
+ "Requirement already satisfied: kiwisolver>=1.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.4.5)\n",
178
+ "Requirement already satisfied: pyparsing>=2.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (3.1.1)\n",
179
+ "Requirement already satisfied: python-dateutil>=2.7 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (2.8.2)\n",
180
+ "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.3.2)\n",
181
+ "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (3.4)\n",
182
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (2.1.0)\n",
183
+ "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from requests->diffusers==0.11.1->diffusers[torch]==0.11.1) (2023.7.22)\n",
184
+ "Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from jedi>=0.16->ipython->mediapy) (0.8.3)\n",
185
+ "Requirement already satisfied: wcwidth in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython->mediapy) (0.2.10)\n",
186
+ "Requirement already satisfied: six>=1.5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from python-dateutil>=2.7->matplotlib->mediapy) (1.16.0)\n",
187
+ "Requirement already satisfied: executing>=1.2.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (2.0.1)\n",
188
+ "Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (2.4.1)\n",
189
+ "Requirement already satisfied: pure-eval in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (0.2.2)\n",
190
+ "Requirement already satisfied: mypy-extensions>=0.3.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from typing-inspect->pyre-extensions==0.0.23->xformers) (1.0.0)\n",
191
+ "Downloading mediapy-1.1.9-py3-none-any.whl (25 kB)\n",
192
+ "Downloading accelerate-0.24.1-py3-none-any.whl (261 kB)\n",
193
+ " ---------------------------------------- 0.0/261.4 kB ? eta -:--:--\n",
194
+ " -------------- ------------------------- 92.2/261.4 kB 2.6 MB/s eta 0:00:01\n",
195
+ " --------------------------------------- 256.0/261.4 kB 4.0 MB/s eta 0:00:01\n",
196
+ " ---------------------------------------- 261.4/261.4 kB 2.7 MB/s eta 0:00:00\n",
197
+ "Downloading av-11.0.0-cp310-cp310-win_amd64.whl (25.9 MB)\n",
198
+ " ---------------------------------------- 0.0/25.9 MB ? eta -:--:--\n",
199
+ " --------------------------------------- 0.6/25.9 MB 12.0 MB/s eta 0:00:03\n",
200
+ " -- ------------------------------------- 1.5/25.9 MB 11.9 MB/s eta 0:00:03\n",
201
+ " --- ------------------------------------ 2.0/25.9 MB 11.7 MB/s eta 0:00:03\n",
202
+ " --- ------------------------------------ 2.2/25.9 MB 9.5 MB/s eta 0:00:03\n",
203
+ " ---- ----------------------------------- 3.0/25.9 MB 10.8 MB/s eta 0:00:03\n",
204
+ " ----- ---------------------------------- 3.5/25.9 MB 11.1 MB/s eta 0:00:03\n",
205
+ " ------ --------------------------------- 4.2/25.9 MB 11.2 MB/s eta 0:00:02\n",
206
+ " ------ --------------------------------- 4.3/25.9 MB 11.4 MB/s eta 0:00:02\n",
207
+ " -------- ------------------------------- 5.4/25.9 MB 11.4 MB/s eta 0:00:02\n",
208
+ " --------- ------------------------------ 5.9/25.9 MB 11.5 MB/s eta 0:00:02\n",
209
+ " ---------- ----------------------------- 6.6/25.9 MB 11.6 MB/s eta 0:00:02\n",
210
+ " ---------- ----------------------------- 7.1/25.9 MB 11.7 MB/s eta 0:00:02\n",
211
+ " ----------- ---------------------------- 7.7/25.9 MB 11.7 MB/s eta 0:00:02\n",
212
+ " ------------ --------------------------- 8.3/25.9 MB 11.8 MB/s eta 0:00:02\n",
213
+ " ------------- -------------------------- 8.8/25.9 MB 11.8 MB/s eta 0:00:02\n",
214
+ " -------------- ------------------------- 9.5/25.9 MB 11.9 MB/s eta 0:00:02\n",
215
+ " --------------- ------------------------ 10.3/25.9 MB 11.9 MB/s eta 0:00:02\n",
216
+ " ---------------- ----------------------- 10.9/25.9 MB 12.4 MB/s eta 0:00:02\n",
217
+ " ----------------- ---------------------- 11.5/25.9 MB 12.1 MB/s eta 0:00:02\n",
218
+ " ------------------ --------------------- 12.1/25.9 MB 12.1 MB/s eta 0:00:02\n",
219
+ " ------------------- -------------------- 12.5/25.9 MB 12.8 MB/s eta 0:00:02\n",
220
+ " ------------------- -------------------- 12.9/25.9 MB 12.1 MB/s eta 0:00:02\n",
221
+ " ------------------- -------------------- 12.9/25.9 MB 11.5 MB/s eta 0:00:02\n",
222
+ " --------------------- ------------------ 13.7/25.9 MB 11.3 MB/s eta 0:00:02\n",
223
+ " --------------------- ------------------ 14.1/25.9 MB 11.1 MB/s eta 0:00:02\n",
224
+ " ---------------------- ----------------- 14.5/25.9 MB 11.9 MB/s eta 0:00:01\n",
225
+ " ----------------------- ---------------- 15.0/25.9 MB 11.3 MB/s eta 0:00:01\n",
226
+ " ----------------------- ---------------- 15.3/25.9 MB 10.9 MB/s eta 0:00:01\n",
227
+ " ------------------------ --------------- 15.8/25.9 MB 10.7 MB/s eta 0:00:01\n",
228
+ " ------------------------ --------------- 16.1/25.9 MB 10.6 MB/s eta 0:00:01\n",
229
+ " ------------------------- -------------- 16.6/25.9 MB 10.4 MB/s eta 0:00:01\n",
230
+ " -------------------------- ------------- 17.0/25.9 MB 10.2 MB/s eta 0:00:01\n",
231
+ " -------------------------- ------------- 17.4/25.9 MB 10.1 MB/s eta 0:00:01\n",
232
+ " --------------------------- ------------ 18.0/25.9 MB 9.9 MB/s eta 0:00:01\n",
233
+ " ---------------------------- ----------- 18.6/25.9 MB 9.9 MB/s eta 0:00:01\n",
234
+ " ----------------------------- ---------- 19.1/25.9 MB 9.9 MB/s eta 0:00:01\n",
235
+ " ------------------------------ --------- 19.7/25.9 MB 9.9 MB/s eta 0:00:01\n",
236
+ " ------------------------------- -------- 20.3/25.9 MB 9.9 MB/s eta 0:00:01\n",
237
+ " -------------------------------- ------- 20.9/25.9 MB 9.9 MB/s eta 0:00:01\n",
238
+ " --------------------------------- ------ 21.4/25.9 MB 9.9 MB/s eta 0:00:01\n",
239
+ " ---------------------------------- ----- 22.0/25.9 MB 9.8 MB/s eta 0:00:01\n",
240
+ " ---------------------------------- ----- 22.5/25.9 MB 9.8 MB/s eta 0:00:01\n",
241
+ " ----------------------------------- ---- 23.1/25.9 MB 10.9 MB/s eta 0:00:01\n",
242
+ " ------------------------------------ --- 23.8/25.9 MB 10.7 MB/s eta 0:00:01\n",
243
+ " ------------------------------------- -- 24.3/25.9 MB 10.7 MB/s eta 0:00:01\n",
244
+ " -------------------------------------- - 24.9/25.9 MB 11.1 MB/s eta 0:00:01\n",
245
+ " --------------------------------------- 25.3/25.9 MB 10.9 MB/s eta 0:00:01\n",
246
+ " --------------------------------------- 25.9/25.9 MB 11.1 MB/s eta 0:00:01\n",
247
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
248
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
249
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
250
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
251
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
252
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
253
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
254
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
255
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
256
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
257
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
258
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
259
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
260
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
261
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
262
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
263
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
264
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
265
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
266
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
267
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
268
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
269
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
270
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
271
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
272
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
273
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
274
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
275
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
276
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
277
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
278
+ " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n",
279
+ " ---------------------------------------- 25.9/25.9 MB 3.9 MB/s eta 0:00:00\n",
280
+ "Installing collected packages: av, accelerate, mediapy\n",
281
+ "Successfully installed accelerate-0.24.1 av-11.0.0 mediapy-1.1.9\n"
282
+ ]
283
+ }
284
+ ],
285
+ "source": [
286
+ "!pip install einops omegaconf decord safetensors diffusers[torch]==0.11.1 transformers xformers triton==2.0.0 imageio[pyav] mediapy"
287
+ ]
288
+ },
289
+ {
290
+ "cell_type": "code",
291
+ "execution_count": 6,
292
+ "metadata": {
293
+ "id": "0jsTnJgXVjC6"
294
+ },
295
+ "outputs": [],
296
+ "source": [
297
+ "# !pip install -U \"jax[cuda12_pip]\" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html"
298
+ ]
299
+ },
300
+ {
301
+ "cell_type": "code",
302
+ "execution_count": 7,
303
+ "metadata": {
304
+ "colab": {
305
+ "base_uri": "https://localhost:8080/"
306
+ },
307
+ "id": "ePPaNOhFZFgH",
308
+ "outputId": "e116c509-8495-4c8b-edda-a47d8754c462"
309
+ },
310
+ "outputs": [
311
+ {
312
+ "name": "stdout",
313
+ "output_type": "stream",
314
+ "text": [
315
+ "The following additional packages will be installed:\n",
316
+ " libaria2-0 libc-ares2\n",
317
+ "The following NEW packages will be installed:\n",
318
+ " aria2 libaria2-0 libc-ares2\n",
319
+ "0 upgraded, 3 newly installed, 0 to remove and 10 not upgraded.\n",
320
+ "Need to get 1,513 kB of archives.\n",
321
+ "After this operation, 5,441 kB of additional disk space will be used.\n",
322
+ "Selecting previously unselected package libc-ares2:amd64.\n",
323
+ "(Reading database ... 120880 files and directories currently installed.)\n",
324
+ "Preparing to unpack .../libc-ares2_1.18.1-1ubuntu0.22.04.2_amd64.deb ...\n",
325
+ "Unpacking libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n",
326
+ "Selecting previously unselected package libaria2-0:amd64.\n",
327
+ "Preparing to unpack .../libaria2-0_1.36.0-1_amd64.deb ...\n",
328
+ "Unpacking libaria2-0:amd64 (1.36.0-1) ...\n",
329
+ "Selecting previously unselected package aria2.\n",
330
+ "Preparing to unpack .../aria2_1.36.0-1_amd64.deb ...\n",
331
+ "Unpacking aria2 (1.36.0-1) ...\n",
332
+ "Setting up libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n",
333
+ "Setting up libaria2-0:amd64 (1.36.0-1) ...\n",
334
+ "Setting up aria2 (1.36.0-1) ...\n",
335
+ "Processing triggers for man-db (2.10.2-1) ...\n",
336
+ "Processing triggers for libc-bin (2.35-0ubuntu3.4) ...\n",
337
+ "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_0.so.3 is not a symbolic link\n",
338
+ "\n",
339
+ "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc.so.2 is not a symbolic link\n",
340
+ "\n",
341
+ "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_5.so.3 is not a symbolic link\n",
342
+ "\n",
343
+ "/sbin/ldconfig.real: /usr/local/lib/libtbb.so.12 is not a symbolic link\n",
344
+ "\n",
345
+ "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc_proxy.so.2 is not a symbolic link\n",
346
+ "\n",
347
+ "/sbin/ldconfig.real: /usr/local/lib/libtbbbind.so.3 is not a symbolic link\n",
348
+ "\n",
349
+ "\u001b[0m\n",
350
+ "Download Results:\n",
351
+ "gid |stat|avg speed |path/URI\n",
352
+ "======+====+===========+=======================================================\n",
353
+ "401ea6|\u001b[1;32mOK\u001b[0m | 168MiB/s|/content/AnimateDiff-SceneFusion/models/DreamBooth_LoRA/toonyou_beta3.safetensors\n",
354
+ "\n",
355
+ "Status Legend:\n",
356
+ "(OK):download completed.\n"
357
+ ]
358
+ }
359
+ ],
360
+ "source": [
361
+ "!apt -y install -qq aria2\n",
362
+ "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/AnimateDiff/resolve/main/toonyou_beta3.safetensors -d /content/AnimateDiff-SceneFusion/models/DreamBooth_LoRA -o toonyou_beta3.safetensors"
363
+ ]
364
+ },
365
+ {
366
+ "cell_type": "code",
367
+ "execution_count": 8,
368
+ "metadata": {
369
+ "colab": {
370
+ "base_uri": "https://localhost:8080/"
371
+ },
372
+ "id": "jXBHQRi1LKnb",
373
+ "outputId": "10219ae9-e50d-4a31-fa6f-37f8cccc1fb3"
374
+ },
375
+ "outputs": [
376
+ {
377
+ "name": "stdout",
378
+ "output_type": "stream",
379
+ "text": [
380
+ "Collecting ffmpeg\n",
381
+ " Downloading ffmpeg-1.4.tar.gz (5.1 kB)\n",
382
+ " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
383
+ "Building wheels for collected packages: ffmpeg\n",
384
+ " Building wheel for ffmpeg (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
385
+ " Created wheel for ffmpeg: filename=ffmpeg-1.4-py3-none-any.whl size=6082 sha256=289c2192632ef676cb1b88a59f16c39dd96bd8cf3a7c2cf8f661d5b4d0481c1d\n",
386
+ " Stored in directory: /root/.cache/pip/wheels/8e/7a/69/cd6aeb83b126a7f04cbe7c9d929028dc52a6e7d525ff56003a\n",
387
+ "Successfully built ffmpeg\n",
388
+ "Installing collected packages: ffmpeg\n",
389
+ "Successfully installed ffmpeg-1.4\n"
390
+ ]
391
+ }
392
+ ],
393
+ "source": [
394
+ "!pip install ffmpeg"
395
+ ]
396
+ },
397
+ {
398
+ "cell_type": "code",
399
+ "execution_count": 9,
400
+ "metadata": {
401
+ "colab": {
402
+ "base_uri": "https://localhost:8080/"
403
+ },
404
+ "id": "Hdx9PUJXG-d_",
405
+ "outputId": "c102aafb-7572-447c-bf13-84709c21c65d"
406
+ },
407
+ "outputs": [
408
+ {
409
+ "name": "stdout",
410
+ "output_type": "stream",
411
+ "text": [
412
+ "/content/AnimateDiff-SceneFusion\n"
413
+ ]
414
+ }
415
+ ],
416
+ "source": [
417
+ "%cd AnimateDiff-SceneFusion\n",
418
+ "# !pip install -r requirements.txt"
419
+ ]
420
+ },
421
+ {
422
+ "cell_type": "code",
423
+ "execution_count": 8,
424
+ "metadata": {
425
+ "colab": {
426
+ "base_uri": "https://localhost:8080/"
427
+ },
428
+ "id": "n581MT-dIxAh",
429
+ "outputId": "5bf3af95-bec0-4888-b983-aebb2d7efd32"
430
+ },
431
+ "outputs": [
432
+ {
433
+ "name": "stderr",
434
+ "output_type": "stream",
435
+ "text": [
436
+ "Cloning into 'models/StableDiffusion'...\n",
437
+ "Updating files: 47% (8/17)\n",
438
+ "Updating files: 52% (9/17)\n",
439
+ "Updating files: 58% (10/17)\n",
440
+ "Updating files: 64% (11/17)\n",
441
+ "Updating files: 70% (12/17)\n",
442
+ "Updating files: 76% (13/17)\n",
443
+ "Updating files: 82% (14/17)\n",
444
+ "Updating files: 88% (15/17)\n",
445
+ "Updating files: 94% (16/17)\n",
446
+ "Updating files: 100% (17/17)\n",
447
+ "Updating files: 100% (17/17), done.\n",
448
+ "Filtering content: 50% (2/4), 394.42 MiB | 17.74 MiB/s\n",
449
+ "Filtering content: 50% (2/4), 974.35 MiB | 10.32 MiB/s\n",
450
+ "Filtering content: 75% (3/4), 974.35 MiB | 10.32 MiB/s\n",
451
+ "Filtering content: 75% (3/4), 2.55 GiB | 6.73 MiB/s \n",
452
+ "Filtering content: 100% (4/4), 2.55 GiB | 6.73 MiB/s\n",
453
+ "Filtering content: 100% (4/4), 2.55 GiB | 5.89 MiB/s, done.\n"
454
+ ]
455
+ }
456
+ ],
457
+ "source": [
458
+ "# %cd /content/AnimateDiff-SceneFusion\n",
459
+ "\n",
460
+ "# import huggingface_hub\n",
461
+ "\n",
462
+ "# files = [\"config.json\", \"diffusion_pytorch_model.bin\", \"diffusion_pytorch_model.fp16.bin\", \"diffusion_pytorch_model.fp16.safetensors\", \"diffusion_pytorch_model.non_ema.bin\", \"diffusion_pytorch_model.non_ema.safetensors\", \"diffusion_pytorch_model.safetensors\"]\n",
463
+ "\n",
464
+ "# for file in files:\n",
465
+ "# huggingface_hub.hf_hub_download(\"runwayml/stable-diffusion-v1-5\", file, subfolder=\"unet\", local_dir=\"unet\")\n",
466
+ "\n",
467
+ "\n",
468
+ "!git clone -b fp16 https://huggingface.co/runwayml/stable-diffusion-v1-5 models/StableDiffusion/"
469
+ ]
470
+ },
471
+ {
472
+ "cell_type": "code",
473
+ "execution_count": 3,
474
+ "metadata": {
475
+ "colab": {
476
+ "base_uri": "https://localhost:8080/"
477
+ },
478
+ "id": "RLuAKqD3I2pv",
479
+ "outputId": "37bccf0c-bb76-4d0e-e668-f91254d4f3a3"
480
+ },
481
+ "outputs": [
482
+ {
483
+ "name": "stdout",
484
+ "output_type": "stream",
485
+ "text": [
486
+ "Access denied with the following error:\n",
487
+ "Access denied with the following error:\n"
488
+ ]
489
+ },
490
+ {
491
+ "name": "stderr",
492
+ "output_type": "stream",
493
+ "text": [
494
+ "\n",
495
+ " \tToo many users have viewed or downloaded this file recently. Please\n",
496
+ "\ttry accessing the file again later. If the file you are trying to\n",
497
+ "\taccess is particularly large or is shared with many people, it may\n",
498
+ "\ttake up to 24 hours to be able to view or download the file. If you\n",
499
+ "\tstill can't access a file after 24 hours, contact your domain\n",
500
+ "\tadministrator. \n",
501
+ "\n",
502
+ "You may still be able to access the file from the browser:\n",
503
+ "\n",
504
+ "\t https://drive.google.com/uc?id=1RqkQuGPaCO5sGZ6V6KZ-jUWmsRu48Kdq \n",
505
+ "\n",
506
+ "\n",
507
+ " \tToo many users have viewed or downloaded this file recently. Please\n",
508
+ "\ttry accessing the file again later. If the file you are trying to\n",
509
+ "\taccess is particularly large or is shared with many people, it may\n",
510
+ "\ttake up to 24 hours to be able to view or download the file. If you\n",
511
+ "\tstill can't access a file after 24 hours, contact your domain\n",
512
+ "\tadministrator. \n",
513
+ "\n",
514
+ "You may still be able to access the file from the browser:\n",
515
+ "\n",
516
+ "\t https://drive.google.com/uc?id=1ql0g_Ys4UCz2RnokYlBjyOYPbttbIpbu \n",
517
+ "\n"
518
+ ]
519
+ }
520
+ ],
521
+ "source": [
522
+ "# %cd AnimateDiff-SceneFusion\n",
523
+ "!bash download_bashscripts/0-MotionModule.sh"
524
+ ]
525
+ },
526
+ {
527
+ "cell_type": "code",
528
+ "execution_count": 12,
529
+ "metadata": {
530
+ "id": "1VUbuB4M2UhZ"
531
+ },
532
+ "outputs": [],
533
+ "source": [
534
+ "%load_ext autoreload\n",
535
+ "%autoreload 2"
536
+ ]
537
+ },
538
+ {
539
+ "cell_type": "code",
540
+ "execution_count": 9,
541
+ "metadata": {
542
+ "cellView": "form",
543
+ "colab": {
544
+ "base_uri": "https://localhost:8080/"
545
+ },
546
+ "id": "VZ-CXYNhKXuy",
547
+ "outputId": "88d9be57-67dc-4c4b-a6cc-b39623118d2a"
548
+ },
549
+ "outputs": [
550
+ {
551
+ "name": "stdout",
552
+ "output_type": "stream",
553
+ "text": [
554
+ "[*] Weights will be saved at models/Motion_Module/test\n"
555
+ ]
556
+ },
557
+ {
558
+ "name": "stderr",
559
+ "output_type": "stream",
560
+ "text": [
561
+ "The syntax of the command is incorrect.\n"
562
+ ]
563
+ }
564
+ ],
565
+ "source": [
566
+ "# @title TRAINING CONFIG\n",
567
+ "# %cd /content/AnimateDiff-SceneFusion\n",
568
+ "\n",
569
+ "# @markdown ## Config\n",
570
+ "\n",
571
+ "PROJECT = \"test\" # @param{\"type\":\"string\"}\n",
572
+ "\n",
573
+ "OUTPUT_DIR = \"models/Motion_Module/%s\" % PROJECT\n",
574
+ "\n",
575
+ "print(f\"[*] Weights will be saved at {OUTPUT_DIR}\")\n",
576
+ "\n",
577
+ "!mkdir -p $OUTPUT_DIR\n",
578
+ "\n",
579
+ "# @markdown ## Model\n",
580
+ "\n",
581
+ "MODEL_NAME = \"models/StableDiffusion/\" # @param{\"type\":\"string\"}\n",
582
+ "\n",
583
+ "# @markdown ## Train\n",
584
+ "\n",
585
+ "CONFIG_NAME = f\"configs/{PROJECT}.yaml\" #@param {type:\"string\"}\n",
586
+ "MOTION_MODULE_NAME=\"models/Motion_Module/mm_sd_v15.ckpt\" #@param{\"type\":\"string\"}\n",
587
+ "\n",
588
+ "train_video_folder = f\"data/output\" #@param {type:\"string\"}\n",
589
+ "train_csv_path = f\"data/output.csv\" #@param {type:\"string\"}\n",
590
+ "train_prompt = \"camera panning right to left, a bird's eye view of a row of buildings in a city with trees in the foreground, masterpiece, best quality\" #@param {type:\"string\"}\n",
591
+ "video_length = 5 #@param {type:\"number\"}\n",
592
+ "sample_size = 256 #@param {type:\"number\"}\n",
593
+ "learning_rate = 3e-4 #@param {type:\"number\"}\n",
594
+ "train_steps = 1 #@param {type:\"number\"}\n",
595
+ "validation_steps = 1 #@param {type:\"number\"}\n",
596
+ "\n",
597
+ "\n",
598
+ "# @markdown ## Infer\n",
599
+ "LORA_DREAMBOOTH_PATH=\"models/DreamBooth_LoRA/toonyou_beta3.safetensors\" #@param{\"type\":\"string\"}\n",
600
+ "\n",
601
+ "\n",
602
+ "from omegaconf import OmegaConf\n",
603
+ "\n",
604
+ "\n",
605
+ "config = {\n",
606
+ " \"pretrained_model_path\": \"models/StableDiffusion/\",\n",
607
+ " \"motion_module\": MOTION_MODULE_NAME,\n",
608
+ " \"output_dir\": OUTPUT_DIR,\n",
609
+ " \"train_data\": {\n",
610
+ " \"video_folder\": train_video_folder,\n",
611
+ " \"csv_path\": train_csv_path,\n",
612
+ " \"sample_n_frames\": video_length,\n",
613
+ " \"sample_stride\": 100,\n",
614
+ " \"sample_size\": sample_size\n",
615
+ " },\n",
616
+ " \"validation_data\": {\n",
617
+ " \"prompts\": [\n",
618
+ " f\"{train_prompt}\",\n",
619
+ " ],\n",
620
+ " \"video_length\": video_length,\n",
621
+ " \"width\": sample_size,\n",
622
+ " \"height\": sample_size,\n",
623
+ " \"num_inference_steps\": 20,\n",
624
+ " \"guidance_scale\": 12.5,\n",
625
+ " \"temporal_context\": 24,\n",
626
+ " \"use_inv_latent\": True,\n",
627
+ " \"num_inv_steps\": 50,\n",
628
+ " },\n",
629
+ " \"learning_rate\": learning_rate,\n",
630
+ " \"train_batch_size\": 1,\n",
631
+ " \"max_train_steps\": train_steps,\n",
632
+ " \"checkpointing_steps\": 100,\n",
633
+ " \"validation_steps\": validation_steps,\n",
634
+ " \"trainable_modules\": [\n",
635
+ " \"to_q\",\n",
636
+ " ],\n",
637
+ " \"seed\": 33,\n",
638
+ " \"mixed_precision\": \"fp16\",\n",
639
+ " \"use_8bit_adam\": False,\n",
640
+ " \"gradient_checkpointing\": True,\n",
641
+ " \"enable_xformers_memory_efficient_attention\": True,\n",
642
+ "}\n",
643
+ "\n",
644
+ "OmegaConf.save(config, CONFIG_NAME)"
645
+ ]
646
+ },
647
+ {
648
+ "cell_type": "code",
649
+ "execution_count": 12,
650
+ "metadata": {
651
+ "colab": {
652
+ "base_uri": "https://localhost:8080/"
653
+ },
654
+ "id": "kpUetphRI9D3",
655
+ "outputId": "d0bba9b2-b93c-476a-9909-94e9f7d5239b"
656
+ },
657
+ "outputs": [],
658
+ "source": [
659
+ "# %cd /content/AnimateDiff-SceneFusion\n",
660
+ "# !python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 train.py --config configs/training/training.yaml\n",
661
+ "\n",
662
+ "# !accelerate launch train.py --config=configs/training/training.yaml\n",
663
+ "!accelerate launch train.py --config=configs/{PROJECT}.yaml --python={3.10}"
664
+ ]
665
+ },
666
+ {
667
+ "cell_type": "code",
668
+ "execution_count": 6,
669
+ "metadata": {
670
+ "colab": {
671
+ "base_uri": "https://localhost:8080/",
672
+ "height": 365
673
+ },
674
+ "id": "IZ2U776S06Gn",
675
+ "outputId": "bae1ea5f-55e6-4a20-8b53-7c641b4ebba5"
676
+ },
677
+ "outputs": [
678
+ {
679
+ "name": "stderr",
680
+ "output_type": "stream",
681
+ "text": [
682
+ "c:\\Users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
683
+ " from .autonotebook import tqdm as notebook_tqdm\n"
684
+ ]
685
+ },
686
+ {
687
+ "ename": "OSError",
688
+ "evalue": "Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory models/StableDiffusion/.",
689
+ "output_type": "error",
690
+ "traceback": [
691
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
692
+ "\u001b[1;31mOSError\u001b[0m Traceback (most recent call last)",
693
+ "\u001b[1;32mc:\\Users\\texas\\Desktop\\School\\SceneFusion\\AnimateDiff-SceneFusion\\AnimatedDiff_Colab.ipynb Cell 13\u001b[0m line \u001b[0;36m2\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=24'>25</a>\u001b[0m \u001b[39m### >>> create validation pipeline >>> ###\u001b[39;00m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=25'>26</a>\u001b[0m tokenizer \u001b[39m=\u001b[39m CLIPTokenizer\u001b[39m.\u001b[39mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mtokenizer\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m---> <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=26'>27</a>\u001b[0m text_encoder \u001b[39m=\u001b[39m CLIPTextModel\u001b[39m.\u001b[39;49mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39;49m\u001b[39m\"\u001b[39;49m\u001b[39mtext_encoder\u001b[39;49m\u001b[39m\"\u001b[39;49m)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=27'>28</a>\u001b[0m vae \u001b[39m=\u001b[39m AutoencoderKL\u001b[39m.\u001b[39mfrom_pretrained(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mvae\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/texas/Desktop/School/SceneFusion/AnimateDiff-SceneFusion/AnimatedDiff_Colab.ipynb#X20sZmlsZQ%3D%3D?line=28'>29</a>\u001b[0m unet \u001b[39m=\u001b[39m UNet3DConditionModel\u001b[39m.\u001b[39mfrom_pretrained_2d(model_path, subfolder\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39munet\u001b[39m\u001b[39m\"\u001b[39m, unet_additional_kwargs\u001b[39m=\u001b[39mOmegaConf\u001b[39m.\u001b[39mto_container(inference_config\u001b[39m.\u001b[39munet_additional_kwargs))\n",
694
+ "File \u001b[1;32mc:\\Users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages\\transformers\\modeling_utils.py:2093\u001b[0m, in \u001b[0;36mPreTrainedModel.from_pretrained\u001b[1;34m(cls, pretrained_model_name_or_path, *model_args, **kwargs)\u001b[0m\n\u001b[0;32m 2087\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mEnvironmentError\u001b[39;00m(\n\u001b[0;32m 2088\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mError no file named \u001b[39m\u001b[39m{\u001b[39;00mWEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m found in directory \u001b[39m\u001b[39m{\u001b[39;00mpretrained_model_name_or_path\u001b[39m}\u001b[39;00m\u001b[39m but \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 2089\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mthere is a file for Flax weights. Use `from_flax=True` to load this model from those \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 2090\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mweights.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 2091\u001b[0m )\n\u001b[0;32m 2092\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m-> 2093\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mEnvironmentError\u001b[39;00m(\n\u001b[0;32m 2094\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mError no file named \u001b[39m\u001b[39m{\u001b[39;00mWEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mTF2_WEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mTF_WEIGHTS_NAME\u001b[39m \u001b[39m\u001b[39m+\u001b[39m\u001b[39m \u001b[39m\u001b[39m'\u001b[39m\u001b[39m.index\u001b[39m\u001b[39m'\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m or \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 2095\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mFLAX_WEIGHTS_NAME\u001b[39m}\u001b[39;00m\u001b[39m found in directory \u001b[39m\u001b[39m{\u001b[39;00mpretrained_model_name_or_path\u001b[39m}\u001b[39;00m\u001b[39m.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 2096\u001b[0m )\n\u001b[0;32m 2097\u001b[0m \u001b[39melif\u001b[39;00m os\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39misfile(os\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39mjoin(subfolder, pretrained_model_name_or_path)):\n\u001b[0;32m 2098\u001b[0m archive_file \u001b[39m=\u001b[39m pretrained_model_name_or_path\n",
695
+ "\u001b[1;31mOSError\u001b[0m: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory models/StableDiffusion/."
696
+ ]
697
+ }
698
+ ],
699
+ "source": [
700
+ "# %cd /content/AnimateDiff-SceneFusion\n",
701
+ "\n",
702
+ "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n",
703
+ "from diffusers import AutoencoderKL, DDPMScheduler, DDIMScheduler\n",
704
+ "from transformers import CLIPTextModel, CLIPTokenizer\n",
705
+ "from omegaconf import OmegaConf\n",
706
+ "from animatediff.models.unet import UNet3DConditionModel\n",
707
+ "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n",
708
+ "from animatediff.utils.util import save_videos_grid\n",
709
+ "from animatediff.utils.util import load_weights\n",
710
+ "from diffusers.utils.import_utils import is_xformers_available\n",
711
+ "from typing import Any\n",
712
+ "import torch\n",
713
+ "from einops import rearrange\n",
714
+ "import torchvision\n",
715
+ "\n",
716
+ "import numpy as np\n",
717
+ "\n",
718
+ "\n",
719
+ "model_path = \"models/StableDiffusion/\"\n",
720
+ "inference_config_path = \"configs/inference/inference-v3.yaml\"\n",
721
+ "motion_module = \"models/Motion_Module/mm_sd_v15.ckpt\"\n",
722
+ "\n",
723
+ "inference_config = OmegaConf.load(inference_config_path)\n",
724
+ "### >>> create validation pipeline >>> ###\n",
725
+ "tokenizer = CLIPTokenizer.from_pretrained(model_path, subfolder=\"tokenizer\")\n",
726
+ "text_encoder = CLIPTextModel.from_pretrained(model_path, subfolder=\"text_encoder\")\n",
727
+ "vae = AutoencoderKL.from_pretrained(model_path, subfolder=\"vae\")\n",
728
+ "unet = UNet3DConditionModel.from_pretrained_2d(model_path, subfolder=\"unet\", unet_additional_kwargs=OmegaConf.to_container(inference_config.unet_additional_kwargs))\n",
729
+ "\n",
730
+ "if is_xformers_available(): unet.enable_xformers_memory_efficient_attention()\n",
731
+ "else: assert False\n",
732
+ "\n",
733
+ "pipeline = AnimationPipeline(\n",
734
+ " vae=vae, text_encoder=text_encoder, tokenizer=tokenizer, unet=unet,\n",
735
+ " scheduler=DDIMScheduler(**OmegaConf.to_container(inference_config.noise_scheduler_kwargs.DDIMScheduler)),\n",
736
+ ").to(\"cuda\")\n",
737
+ "\n",
738
+ "pipeline = load_weights(\n",
739
+ " pipeline,\n",
740
+ " # motion module\n",
741
+ " motion_module_path = motion_module,\n",
742
+ " motion_module_lora_configs = [],\n",
743
+ " # image layers\n",
744
+ " dreambooth_model_path = \"\",\n",
745
+ " lora_model_path = \"\",\n",
746
+ " lora_alpha = 0.8,\n",
747
+ ").to(\"cuda\")\n",
748
+ "\n"
749
+ ]
750
+ },
751
+ {
752
+ "cell_type": "code",
753
+ "execution_count": 5,
754
+ "metadata": {
755
+ "id": "VnDjPeeq1Sdx"
756
+ },
757
+ "outputs": [],
758
+ "source": [
759
+ "pipeline.save_config(\"./\")"
760
+ ]
761
+ },
762
+ {
763
+ "cell_type": "code",
764
+ "execution_count": null,
765
+ "metadata": {
766
+ "id": "nzn0gZA8F4Pk"
767
+ },
768
+ "outputs": [],
769
+ "source": [
770
+ "# prompt: save model to huggingface repo\n",
771
+ "\n",
772
+ "!git lfs install\n",
773
+ "# !git clone https://huggingface.co/bluestarburst/AnimateDiff-SceneFusion /content/huggingface\n"
774
+ ]
775
+ },
776
+ {
777
+ "cell_type": "code",
778
+ "execution_count": null,
779
+ "metadata": {
780
+ "id": "H_OhGJrCPjYb"
781
+ },
782
+ "outputs": [],
783
+ "source": [
784
+ "!cp /content/AnimateDiff-SceneFusion/animatediff/pipelines/pipeline_animation.py /content/AnimateDiff-SceneFusion/pipeline.py"
785
+ ]
786
+ },
787
+ {
788
+ "cell_type": "code",
789
+ "execution_count": null,
790
+ "metadata": {
791
+ "id": "qvK9PwJlSUCg"
792
+ },
793
+ "outputs": [],
794
+ "source": [
795
+ "%cd /content/\n",
796
+ "!huggingface-cli upload AnimateDiff-SceneFusion"
797
+ ]
798
+ }
799
+ ],
800
+ "metadata": {
801
+ "accelerator": "GPU",
802
+ "colab": {
803
+ "gpuType": "T4",
804
+ "machine_shape": "hm",
805
+ "provenance": []
806
+ },
807
+ "kernelspec": {
808
+ "display_name": "Python 3",
809
+ "name": "python3"
810
+ },
811
+ "language_info": {
812
+ "codemirror_mode": {
813
+ "name": "ipython",
814
+ "version": 3
815
+ },
816
+ "file_extension": ".py",
817
+ "mimetype": "text/x-python",
818
+ "name": "python",
819
+ "nbconvert_exporter": "python",
820
+ "pygments_lexer": "ipython3",
821
+ "version": "3.10.13"
822
+ }
823
+ },
824
+ "nbformat": 4,
825
+ "nbformat_minor": 0
826
+ }
animatediff/data/__pycache__/dataset.cpython-310.pyc CHANGED
Binary files a/animatediff/data/__pycache__/dataset.cpython-310.pyc and b/animatediff/data/__pycache__/dataset.cpython-310.pyc differ
 
animatediff/models/__pycache__/attention.cpython-310.pyc CHANGED
Binary files a/animatediff/models/__pycache__/attention.cpython-310.pyc and b/animatediff/models/__pycache__/attention.cpython-310.pyc differ
 
animatediff/models/__pycache__/attention.cpython-311.pyc ADDED
Binary file (12.5 kB). View file
 
animatediff/models/__pycache__/motion_module.cpython-310.pyc CHANGED
Binary files a/animatediff/models/__pycache__/motion_module.cpython-310.pyc and b/animatediff/models/__pycache__/motion_module.cpython-310.pyc differ
 
animatediff/models/__pycache__/motion_module.cpython-311.pyc ADDED
Binary file (15.3 kB). View file
 
animatediff/models/__pycache__/resnet.cpython-310.pyc CHANGED
Binary files a/animatediff/models/__pycache__/resnet.cpython-310.pyc and b/animatediff/models/__pycache__/resnet.cpython-310.pyc differ
 
animatediff/models/__pycache__/resnet.cpython-311.pyc ADDED
Binary file (9.99 kB). View file
 
animatediff/models/__pycache__/unet.cpython-310.pyc CHANGED
Binary files a/animatediff/models/__pycache__/unet.cpython-310.pyc and b/animatediff/models/__pycache__/unet.cpython-310.pyc differ
 
animatediff/models/__pycache__/unet.cpython-311.pyc ADDED
Binary file (21.7 kB). View file
 
animatediff/models/__pycache__/unet_blocks.cpython-311.pyc ADDED
Binary file (22.6 kB). View file
 
animatediff/models/attention.py CHANGED
@@ -11,7 +11,8 @@ from diffusers.configuration_utils import ConfigMixin, register_to_config
11
  from diffusers import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
- from diffusers.models.attention import CrossAttention, FeedForward, AdaLayerNorm
 
15
 
16
  from einops import rearrange, repeat
17
  import pdb
@@ -225,7 +226,7 @@ class BasicTransformerBlock(nn.Module):
225
  nn.init.zeros_(self.attn_temp.to_out[0].weight.data)
226
  self.norm_temp = AdaLayerNorm(dim, num_embeds_ada_norm) if self.use_ada_layer_norm else nn.LayerNorm(dim)
227
 
228
- def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_attention_xformers: bool):
229
  if not is_xformers_available():
230
  print("Here is how to install it")
231
  raise ModuleNotFoundError(
 
11
  from diffusers import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
+ from diffusers.models.attention import Attention as CrossAttention, FeedForward, AdaLayerNorm
15
+ from typing import Any, Callable, Dict, List, Optional, Union
16
 
17
  from einops import rearrange, repeat
18
  import pdb
 
226
  nn.init.zeros_(self.attn_temp.to_out[0].weight.data)
227
  self.norm_temp = AdaLayerNorm(dim, num_embeds_ada_norm) if self.use_ada_layer_norm else nn.LayerNorm(dim)
228
 
229
+ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_attention_xformers: bool, attention_op: Optional[Callable] = None):
230
  if not is_xformers_available():
231
  print("Here is how to install it")
232
  raise ModuleNotFoundError(
animatediff/models/motion_module.py CHANGED
@@ -11,7 +11,7 @@ from diffusers.configuration_utils import ConfigMixin, register_to_config
11
  from diffusers import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
- from diffusers.models.attention import CrossAttention, FeedForward
15
 
16
  from einops import rearrange, repeat
17
  import math
 
11
  from diffusers import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
+ from diffusers.models.attention import Attention as CrossAttention, FeedForward
15
 
16
  from einops import rearrange, repeat
17
  import math
animatediff/pipelines/__pycache__/pipeline_animation.cpython-310.pyc CHANGED
Binary files a/animatediff/pipelines/__pycache__/pipeline_animation.cpython-310.pyc and b/animatediff/pipelines/__pycache__/pipeline_animation.cpython-310.pyc differ
 
animatediff/pipelines/__pycache__/pipeline_animation.cpython-311.pyc ADDED
Binary file (21.6 kB). View file
 
animatediff/pipelines/pipeline_animation.py CHANGED
@@ -425,4 +425,4 @@ class AnimationPipeline(DiffusionPipeline):
425
  if not return_dict:
426
  return video
427
 
428
- return AnimationPipelineOutput(videos=video)
 
425
  if not return_dict:
426
  return video
427
 
428
+ return AnimationPipelineOutput(videos=video)
configs/test.yaml CHANGED
@@ -1,6 +1,6 @@
1
- pretrained_model_path: /content/AnimateDiff-SceneFusion/models/StableDiffusion/
2
- motion_module: /content/AnimateDiff-SceneFusion/models/Motion_Module/mm_sd_v15.ckpt
3
- output_dir: /content/AnimateDiff-SceneFusion/models/Motion_Module/test
4
  train_data:
5
  video_folder: data/output
6
  csv_path: data/output.csv
 
1
+ pretrained_model_path: models/StableDiffusion/
2
+ motion_module: models/Motion_Module/mm_sd_v15.ckpt
3
+ output_dir: models/Motion_Module/test
4
  train_data:
5
  video_folder: data/output
6
  csv_path: data/output.csv
handler.py CHANGED
@@ -48,18 +48,6 @@ class EndpointHandler():
48
  lora_model_path = "",
49
  lora_alpha = 0.8,
50
  ).to("cuda")
51
-
52
- def initialize(self, context):
53
- """
54
- Initialize model. This will be called during model loading time
55
- """
56
-
57
-
58
-
59
- def preprocess(self, data):
60
- """
61
- preprocess will be called once for each request.
62
- """
63
 
64
  def __call__(self, prompt, negative_prompt, steps, guidance_scale):
65
  """
 
48
  lora_model_path = "",
49
  lora_alpha = 0.8,
50
  ).to("cuda")
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  def __call__(self, prompt, negative_prompt, steps, guidance_scale):
53
  """
models/Motion_Module/test/config.yaml CHANGED
@@ -1,5 +1,5 @@
1
- pretrained_model_path: /content/AnimateDiff-SceneFusion/models/StableDiffusion/
2
- output_dir: /content/AnimateDiff-SceneFusion/models/Motion_Module/test
3
  train_data:
4
  video_folder: data/output
5
  csv_path: data/output.csv
@@ -42,7 +42,7 @@ mixed_precision: fp16
42
  use_8bit_adam: false
43
  enable_xformers_memory_efficient_attention: true
44
  seed: 33
45
- motion_module: /content/AnimateDiff-SceneFusion/models/Motion_Module/mm_sd_v15.ckpt
46
  inference_config_path: configs/inference/inference-v3.yaml
47
  motion_module_pe_multiplier: 1
48
  dataset_class: MultiTuneAVideoDataset
 
1
+ pretrained_model_path: models/StableDiffusion/
2
+ output_dir: models/Motion_Module/test
3
  train_data:
4
  video_folder: data/output
5
  csv_path: data/output.csv
 
42
  use_8bit_adam: false
43
  enable_xformers_memory_efficient_attention: true
44
  seed: 33
45
+ motion_module: models/Motion_Module/mm_sd_v15.ckpt
46
  inference_config_path: configs/inference/inference-v3.yaml
47
  motion_module_pe_multiplier: 1
48
  dataset_class: MultiTuneAVideoDataset
models/StableDiffusion/.gitattributes CHANGED
@@ -32,4 +32,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zst filter=lfs diff=lfs merge=lfs -text
33
  *tfevents* filter=lfs diff=lfs merge=lfs -text
34
  v1-5-pruned-emaonly.ckpt filter=lfs diff=lfs merge=lfs -text
35
- v1-5-pruned.ckpt filter=lfs diff=lfs merge=lfs -text
 
32
  *.zst filter=lfs diff=lfs merge=lfs -text
33
  *tfevents* filter=lfs diff=lfs merge=lfs -text
34
  v1-5-pruned-emaonly.ckpt filter=lfs diff=lfs merge=lfs -text
 
models/StableDiffusion/README.md CHANGED
@@ -4,17 +4,18 @@ tags:
4
  - stable-diffusion
5
  - stable-diffusion-diffusers
6
  - text-to-image
7
- inference: true
8
  extra_gated_prompt: |-
9
  This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
10
- The CreativeML OpenRAIL License specifies:
11
-
12
  1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
13
  2. CompVis claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
14
  3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
15
- Please read the full license carefully here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
16
-
17
- extra_gated_heading: Please read the LICENSE to access this model
 
 
 
18
  ---
19
 
20
  # Stable Diffusion v1-5 Model Card
@@ -30,11 +31,10 @@ You can use this both with the [🧨Diffusers library](https://github.com/huggin
30
  ### Diffusers
31
  ```py
32
  from diffusers import StableDiffusionPipeline
33
- import torch
34
 
35
  model_id = "runwayml/stable-diffusion-v1-5"
36
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
37
- pipe = pipe.to("cuda")
38
 
39
  prompt = "a photo of an astronaut riding a horse on mars"
40
  image = pipe(prompt).images[0]
@@ -45,10 +45,7 @@ For more detailed instructions, use-cases and examples in JAX follow the instruc
45
 
46
  ### Original GitHub Repository
47
 
48
- 1. Download the weights
49
- - [v1-5-pruned-emaonly.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt) - 4.27GB, ema-only weight. uses less VRAM - suitable for inference
50
- - [v1-5-pruned.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.ckpt) - 7.7GB, ema+non-ema weights. uses more VRAM - suitable for fine-tuning
51
-
52
  2. Follow instructions [here](https://github.com/runwayml/stable-diffusion).
53
 
54
  ## Model Details
@@ -147,23 +144,22 @@ The model developers used the following dataset for training the model:
147
  - LAION-2B (en) and subsets thereof (see next section)
148
 
149
  **Training Procedure**
150
- Stable Diffusion v1-5 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,
151
 
152
  - Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4
153
  - Text prompts are encoded through a ViT-L/14 text-encoder.
154
  - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
155
  - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
156
 
157
- Currently six Stable Diffusion checkpoints are provided, which were trained as follows.
158
  - [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1): 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
159
  194,000 steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
160
  - [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2): Resumed from `stable-diffusion-v1-1`.
161
  515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
162
  filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
163
- - [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3): Resumed from `stable-diffusion-v1-2` - 195,000 steps at resolution `512x512` on "laion-improved-aesthetics" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
164
- - [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4) Resumed from `stable-diffusion-v1-2` - 225,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
165
- - [`stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5) Resumed from `stable-diffusion-v1-2` - 595,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
166
- - [`stable-diffusion-inpainting`](https://huggingface.co/runwayml/stable-diffusion-inpainting) Resumed from `stable-diffusion-v1-5` - then 440,000 steps of inpainting training at resolution 512x512 on “laion-aesthetics v2 5+” and 10% dropping of the text-conditioning. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask itself) whose weights were zero-initialized after restoring the non-inpainting checkpoint. During training, we generate synthetic masks and in 25% mask everything.
167
 
168
  - **Hardware:** 32 x 8 x A100 GPUs
169
  - **Optimizer:** AdamW
 
4
  - stable-diffusion
5
  - stable-diffusion-diffusers
6
  - text-to-image
7
+ inference: false
8
  extra_gated_prompt: |-
9
  This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
 
 
10
  1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
11
  2. CompVis claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
12
  3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
13
+ Please read the full license here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
14
+
15
+ By clicking on "Access repository" below, you accept that your *contact information* (email address and username) can be shared with the model authors as well.
16
+
17
+ extra_gated_fields:
18
+ I have read the License and agree with its terms: checkbox
19
  ---
20
 
21
  # Stable Diffusion v1-5 Model Card
 
31
  ### Diffusers
32
  ```py
33
  from diffusers import StableDiffusionPipeline
 
34
 
35
  model_id = "runwayml/stable-diffusion-v1-5"
36
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")
37
+ pipe = pipe.to(device)
38
 
39
  prompt = "a photo of an astronaut riding a horse on mars"
40
  image = pipe(prompt).images[0]
 
45
 
46
  ### Original GitHub Repository
47
 
48
+ 1. Download the weights [v1-5-pruned-emaonly.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt)
 
 
 
49
  2. Follow instructions [here](https://github.com/runwayml/stable-diffusion).
50
 
51
  ## Model Details
 
144
  - LAION-2B (en) and subsets thereof (see next section)
145
 
146
  **Training Procedure**
147
+ Stable Diffusion v1-4 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,
148
 
149
  - Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4
150
  - Text prompts are encoded through a ViT-L/14 text-encoder.
151
  - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
152
  - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
153
 
154
+ We currently provide four checkpoints, which were trained as follows.
155
  - [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1): 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
156
  194,000 steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
157
  - [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2): Resumed from `stable-diffusion-v1-1`.
158
  515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
159
  filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
160
+ - [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3): Resumed from `stable-diffusion-v1-2`. 195,000 steps at resolution `512x512` on "laion-improved-aesthetics" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
161
+ - [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4) Resumed from `stable-diffusion-v1-2`.225,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
162
+ - [`stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5) Resumed from `stable-diffusion-v1-2` 595,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
 
163
 
164
  - **Hardware:** 32 x 8 x A100 GPUs
165
  - **Optimizer:** AdamW
models/StableDiffusion/model_index.json CHANGED
@@ -3,7 +3,7 @@
3
  "_diffusers_version": "0.6.0",
4
  "feature_extractor": [
5
  "transformers",
6
- "CLIPImageProcessor"
7
  ],
8
  "safety_checker": [
9
  "stable_diffusion",
 
3
  "_diffusers_version": "0.6.0",
4
  "feature_extractor": [
5
  "transformers",
6
+ "CLIPFeatureExtractor"
7
  ],
8
  "safety_checker": [
9
  "stable_diffusion",
models/StableDiffusion/safety_checker/config.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "_commit_hash": "4bb648a606ef040e7685bde262611766a5fdd67b",
3
- "_name_or_path": "CompVis/stable-diffusion-safety-checker",
4
  "architectures": [
5
  "StableDiffusionSafetyChecker"
6
  ],
@@ -88,7 +88,7 @@
88
  "num_attention_heads": 12,
89
  "num_hidden_layers": 12
90
  },
91
- "torch_dtype": "float32",
92
  "transformers_version": null,
93
  "vision_config": {
94
  "_name_or_path": "",
 
1
  {
2
+ "_commit_hash": null,
3
+ "_name_or_path": "/home/patrick/stable-diffusion-v1-5/safety_checker",
4
  "architectures": [
5
  "StableDiffusionSafetyChecker"
6
  ],
 
88
  "num_attention_heads": 12,
89
  "num_hidden_layers": 12
90
  },
91
+ "torch_dtype": "float16",
92
  "transformers_version": null,
93
  "vision_config": {
94
  "_name_or_path": "",
models/StableDiffusion/scheduler/scheduler_config.json CHANGED
@@ -10,4 +10,4 @@
10
  "steps_offset": 1,
11
  "trained_betas": null,
12
  "clip_sample": false
13
- }
 
10
  "steps_offset": 1,
11
  "trained_betas": null,
12
  "clip_sample": false
13
+ }
models/StableDiffusion/text_encoder/config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "_name_or_path": "openai/clip-vit-large-patch14",
3
  "architectures": [
4
  "CLIPTextModel"
5
  ],
@@ -19,7 +19,7 @@
19
  "num_hidden_layers": 12,
20
  "pad_token_id": 1,
21
  "projection_dim": 768,
22
- "torch_dtype": "float32",
23
  "transformers_version": "4.22.0.dev0",
24
  "vocab_size": 49408
25
  }
 
1
  {
2
+ "_name_or_path": "/home/patrick/stable-diffusion-v1-5/text_encoder",
3
  "architectures": [
4
  "CLIPTextModel"
5
  ],
 
19
  "num_hidden_layers": 12,
20
  "pad_token_id": 1,
21
  "projection_dim": 768,
22
+ "torch_dtype": "float16",
23
  "transformers_version": "4.22.0.dev0",
24
  "vocab_size": 49408
25
  }
models/StableDiffusion/tokenizer/tokenizer_config.json CHANGED
@@ -19,7 +19,7 @@
19
  },
20
  "errors": "replace",
21
  "model_max_length": 77,
22
- "name_or_path": "openai/clip-vit-large-patch14",
23
  "pad_token": "<|endoftext|>",
24
  "special_tokens_map_file": "./special_tokens_map.json",
25
  "tokenizer_class": "CLIPTokenizer",
 
19
  },
20
  "errors": "replace",
21
  "model_max_length": 77,
22
+ "name_or_path": "/home/patrick/stable-diffusion-v1-5/tokenizer",
23
  "pad_token": "<|endoftext|>",
24
  "special_tokens_map_file": "./special_tokens_map.json",
25
  "tokenizer_class": "CLIPTokenizer",
models/StableDiffusion/unet/config.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "_class_name": "UNet2DConditionModel",
3
  "_diffusers_version": "0.6.0",
 
4
  "act_fn": "silu",
5
  "attention_head_dim": 8,
6
  "block_out_channels": [
 
1
  {
2
  "_class_name": "UNet2DConditionModel",
3
  "_diffusers_version": "0.6.0",
4
+ "_name_or_path": "/home/patrick/stable-diffusion-v1-5/unet",
5
  "act_fn": "silu",
6
  "attention_head_dim": 8,
7
  "block_out_channels": [
models/StableDiffusion/vae/config.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "_class_name": "AutoencoderKL",
3
  "_diffusers_version": "0.6.0",
 
4
  "act_fn": "silu",
5
  "block_out_channels": [
6
  128,
@@ -19,7 +20,7 @@
19
  "layers_per_block": 2,
20
  "norm_num_groups": 32,
21
  "out_channels": 3,
22
- "sample_size": 512,
23
  "up_block_types": [
24
  "UpDecoderBlock2D",
25
  "UpDecoderBlock2D",
 
1
  {
2
  "_class_name": "AutoencoderKL",
3
  "_diffusers_version": "0.6.0",
4
+ "_name_or_path": "/home/patrick/stable-diffusion-v1-5/vae",
5
  "act_fn": "silu",
6
  "block_out_channels": [
7
  128,
 
20
  "layers_per_block": 2,
21
  "norm_num_groups": 32,
22
  "out_channels": 3,
23
+ "sample_size": 256,
24
  "up_block_types": [
25
  "UpDecoderBlock2D",
26
  "UpDecoderBlock2D",
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
 
tuneavideo/__pycache__/util.cpython-310.pyc CHANGED
Binary files a/tuneavideo/__pycache__/util.cpython-310.pyc and b/tuneavideo/__pycache__/util.cpython-310.pyc differ
 
tuneavideo/data/__pycache__/frames_dataset.cpython-310.pyc CHANGED
Binary files a/tuneavideo/data/__pycache__/frames_dataset.cpython-310.pyc and b/tuneavideo/data/__pycache__/frames_dataset.cpython-310.pyc differ
 
tuneavideo/data/__pycache__/multi_dataset.cpython-310.pyc CHANGED
Binary files a/tuneavideo/data/__pycache__/multi_dataset.cpython-310.pyc and b/tuneavideo/data/__pycache__/multi_dataset.cpython-310.pyc differ
 
tuneavideo/models/attention.py CHANGED
@@ -11,7 +11,8 @@ from diffusers.configuration_utils import ConfigMixin, register_to_config
11
  from diffusers.modeling_utils import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
- from diffusers.models.attention import CrossAttention, FeedForward, AdaLayerNorm
 
15
 
16
  from einops import rearrange, repeat
17
 
@@ -201,7 +202,7 @@ class BasicTransformerBlock(nn.Module):
201
  nn.init.zeros_(self.attn_temp.to_out[0].weight.data)
202
  self.norm_temp = AdaLayerNorm(dim, num_embeds_ada_norm) if self.use_ada_layer_norm else nn.LayerNorm(dim)
203
 
204
- def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_attention_xformers: bool):
205
  if not is_xformers_available():
206
  print("Here is how to install it")
207
  raise ModuleNotFoundError(
 
11
  from diffusers.modeling_utils import ModelMixin
12
  from diffusers.utils import BaseOutput
13
  from diffusers.utils.import_utils import is_xformers_available
14
+ from diffusers.models.attention import Attention as CrossAttention, FeedForward, AdaLayerNorm
15
+ from typing import Any, Callable, Dict, List, Optional, Union
16
 
17
  from einops import rearrange, repeat
18
 
 
202
  nn.init.zeros_(self.attn_temp.to_out[0].weight.data)
203
  self.norm_temp = AdaLayerNorm(dim, num_embeds_ada_norm) if self.use_ada_layer_norm else nn.LayerNorm(dim)
204
 
205
+ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_attention_xformers: bool, attention_op: Optional[Callable] = None):
206
  if not is_xformers_available():
207
  print("Here is how to install it")
208
  raise ModuleNotFoundError(