{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "t0gCc4zNO0-J", "outputId": "cb8cfaad-d4f1-4c26-92a6-644eb1bc9039" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: wandb in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.16.0)\n", "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", "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", "Requirement already satisfied: requests<3,>=2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (2.31.0)\n", "Requirement already satisfied: psutil>=5.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (5.9.5)\n", "Requirement already satisfied: sentry-sdk>=1.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.35.0)\n", "Requirement already satisfied: docker-pycreds>=0.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (0.4.0)\n", "Requirement already satisfied: PyYAML in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (6.0.1)\n", "Requirement already satisfied: setproctitle in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.3.3)\n", "Requirement already satisfied: setuptools in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (68.2.2)\n", "Requirement already satisfied: appdirs>=1.4.3 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from wandb) (1.4.4)\n", "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", "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", "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", "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", "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", "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", "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", "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", "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" ] }, { "name": "stderr", "output_type": "stream", "text": [ "wandb: ERROR Find detailed error logs at: C:\\Users\\texas\\AppData\\Local\\Temp\\debug-cli.texas.log\n", "Error: api_key not configured (no-tty). call wandb login [your_api_key]\n" ] } ], "source": [ "!pip install wandb\n", "!wandb login" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "UGH2QZ4tDlzw", "outputId": "0e2339d0-78b3-4a23-eddf-589c805adcc8" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.10/dist-packages (0.19.4)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (3.13.1)\n", "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2023.6.0)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2.31.0)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.66.1)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (6.0.1)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.5.0)\n", "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (23.2)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.3.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.4)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2.0.7)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2023.7.22)\n", "\n", " _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|\n", " _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", " _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|\n", " _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", " _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|\n", "\n", " To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .\n", "Token: \n", "Add token as git credential? (Y/n) Y\n", "Token is valid (permission: write).\n", "\u001b[1m\u001b[31mCannot authenticate through git-credential as no helper is defined on your machine.\n", "You might have to re-authenticate when pushing to the Hugging Face Hub.\n", "Run the following command in your terminal in case you want to set the 'store' credential helper as default.\n", "\n", "git config --global credential.helper store\n", "\n", "Read https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more details.\u001b[0m\n", "Token has not been saved to git credential helper.\n", "Your token has been saved to /root/.cache/huggingface/token\n", "Login successful\n" ] } ], "source": [ "!pip install huggingface_hub\n", "# You already have it if you installed transformers or datasets\n", "\n", "!huggingface-cli login" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "iPDlxLC9PFzV", "outputId": "076dead2-d2da-42bf-a867-1a0d59e0b3c2" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: einops in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.7.0)\n", "Requirement already satisfied: omegaconf in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.3.0)\n", "Requirement already satisfied: decord in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.6.0)\n", "Requirement already satisfied: safetensors in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.4.0)\n", "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", "Requirement already satisfied: transformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (4.25.1)\n", "Requirement already satisfied: xformers in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (0.0.16)\n", "Requirement already satisfied: triton==2.0.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.0.0)\n", "Collecting mediapy\n", " Downloading mediapy-1.1.9-py3-none-any.whl.metadata (4.8 kB)\n", "Requirement already satisfied: imageio[pyav] in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (2.27.0)\n", "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", "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", "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", "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", "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", "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", "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", "Requirement already satisfied: cmake in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (3.27.7)\n", "Requirement already satisfied: torch in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from triton==2.0.0) (1.13.1)\n", "Collecting accelerate>=0.11.0 (from diffusers[torch]==0.11.1)\n", " Downloading accelerate-0.24.1-py3-none-any.whl.metadata (18 kB)\n", "Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (4.9.3)\n", "Requirement already satisfied: PyYAML>=5.1.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from omegaconf) (6.0.1)\n", "Requirement already satisfied: packaging>=20.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (23.2)\n", "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", "Requirement already satisfied: tqdm>=4.27 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from transformers) (4.66.1)\n", "Requirement already satisfied: pyre-extensions==0.0.23 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from xformers) (0.0.23)\n", "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", "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", "Collecting av (from imageio[pyav])\n", " Downloading av-11.0.0-cp310-cp310-win_amd64.whl.metadata (4.7 kB)\n", "Requirement already satisfied: ipython in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (8.17.2)\n", "Requirement already satisfied: matplotlib in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from mediapy) (3.8.1)\n", "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", "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", "Requirement already satisfied: colorama in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from tqdm>=4.27->transformers) (0.4.6)\n", "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", "Requirement already satisfied: decorator in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.1.1)\n", "Requirement already satisfied: jedi>=0.16 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.19.1)\n", "Requirement already satisfied: matplotlib-inline in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.1.6)\n", "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", "Requirement already satisfied: pygments>=2.4.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (2.16.1)\n", "Requirement already satisfied: stack-data in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (0.6.2)\n", "Requirement already satisfied: traitlets>=5 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (5.13.0)\n", "Requirement already satisfied: exceptiongroup in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from ipython->mediapy) (1.1.3)\n", "Requirement already satisfied: contourpy>=1.0.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.2.0)\n", "Requirement already satisfied: cycler>=0.10 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (0.12.1)\n", "Requirement already satisfied: fonttools>=4.22.0 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (4.44.3)\n", "Requirement already satisfied: kiwisolver>=1.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (1.4.5)\n", "Requirement already satisfied: pyparsing>=2.3.1 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (3.1.1)\n", "Requirement already satisfied: python-dateutil>=2.7 in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from matplotlib->mediapy) (2.8.2)\n", "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", "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", "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", "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", "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", "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", "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", "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", "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", "Requirement already satisfied: pure-eval in c:\\users\\texas\\anaconda3\\envs\\animatediff\\lib\\site-packages (from stack-data->ipython->mediapy) (0.2.2)\n", "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", "Downloading mediapy-1.1.9-py3-none-any.whl (25 kB)\n", "Downloading accelerate-0.24.1-py3-none-any.whl (261 kB)\n", " ---------------------------------------- 0.0/261.4 kB ? eta -:--:--\n", " -------------- ------------------------- 92.2/261.4 kB 2.6 MB/s eta 0:00:01\n", " --------------------------------------- 256.0/261.4 kB 4.0 MB/s eta 0:00:01\n", " ---------------------------------------- 261.4/261.4 kB 2.7 MB/s eta 0:00:00\n", "Downloading av-11.0.0-cp310-cp310-win_amd64.whl (25.9 MB)\n", " ---------------------------------------- 0.0/25.9 MB ? eta -:--:--\n", " --------------------------------------- 0.6/25.9 MB 12.0 MB/s eta 0:00:03\n", " -- ------------------------------------- 1.5/25.9 MB 11.9 MB/s eta 0:00:03\n", " --- ------------------------------------ 2.0/25.9 MB 11.7 MB/s eta 0:00:03\n", " --- ------------------------------------ 2.2/25.9 MB 9.5 MB/s eta 0:00:03\n", " ---- ----------------------------------- 3.0/25.9 MB 10.8 MB/s eta 0:00:03\n", " ----- ---------------------------------- 3.5/25.9 MB 11.1 MB/s eta 0:00:03\n", " ------ --------------------------------- 4.2/25.9 MB 11.2 MB/s eta 0:00:02\n", " ------ --------------------------------- 4.3/25.9 MB 11.4 MB/s eta 0:00:02\n", " -------- ------------------------------- 5.4/25.9 MB 11.4 MB/s eta 0:00:02\n", " --------- ------------------------------ 5.9/25.9 MB 11.5 MB/s eta 0:00:02\n", " ---------- ----------------------------- 6.6/25.9 MB 11.6 MB/s eta 0:00:02\n", " ---------- ----------------------------- 7.1/25.9 MB 11.7 MB/s eta 0:00:02\n", " ----------- ---------------------------- 7.7/25.9 MB 11.7 MB/s eta 0:00:02\n", " ------------ --------------------------- 8.3/25.9 MB 11.8 MB/s eta 0:00:02\n", " ------------- -------------------------- 8.8/25.9 MB 11.8 MB/s eta 0:00:02\n", " -------------- ------------------------- 9.5/25.9 MB 11.9 MB/s eta 0:00:02\n", " --------------- ------------------------ 10.3/25.9 MB 11.9 MB/s eta 0:00:02\n", " ---------------- ----------------------- 10.9/25.9 MB 12.4 MB/s eta 0:00:02\n", " ----------------- ---------------------- 11.5/25.9 MB 12.1 MB/s eta 0:00:02\n", " ------------------ --------------------- 12.1/25.9 MB 12.1 MB/s eta 0:00:02\n", " ------------------- -------------------- 12.5/25.9 MB 12.8 MB/s eta 0:00:02\n", " ------------------- -------------------- 12.9/25.9 MB 12.1 MB/s eta 0:00:02\n", " ------------------- -------------------- 12.9/25.9 MB 11.5 MB/s eta 0:00:02\n", " --------------------- ------------------ 13.7/25.9 MB 11.3 MB/s eta 0:00:02\n", " --------------------- ------------------ 14.1/25.9 MB 11.1 MB/s eta 0:00:02\n", " ---------------------- ----------------- 14.5/25.9 MB 11.9 MB/s eta 0:00:01\n", " ----------------------- ---------------- 15.0/25.9 MB 11.3 MB/s eta 0:00:01\n", " ----------------------- ---------------- 15.3/25.9 MB 10.9 MB/s eta 0:00:01\n", " ------------------------ --------------- 15.8/25.9 MB 10.7 MB/s eta 0:00:01\n", " ------------------------ --------------- 16.1/25.9 MB 10.6 MB/s eta 0:00:01\n", " ------------------------- -------------- 16.6/25.9 MB 10.4 MB/s eta 0:00:01\n", " -------------------------- ------------- 17.0/25.9 MB 10.2 MB/s eta 0:00:01\n", " -------------------------- ------------- 17.4/25.9 MB 10.1 MB/s eta 0:00:01\n", " --------------------------- ------------ 18.0/25.9 MB 9.9 MB/s eta 0:00:01\n", " ---------------------------- ----------- 18.6/25.9 MB 9.9 MB/s eta 0:00:01\n", " ----------------------------- ---------- 19.1/25.9 MB 9.9 MB/s eta 0:00:01\n", " ------------------------------ --------- 19.7/25.9 MB 9.9 MB/s eta 0:00:01\n", " ------------------------------- -------- 20.3/25.9 MB 9.9 MB/s eta 0:00:01\n", " -------------------------------- ------- 20.9/25.9 MB 9.9 MB/s eta 0:00:01\n", " --------------------------------- ------ 21.4/25.9 MB 9.9 MB/s eta 0:00:01\n", " ---------------------------------- ----- 22.0/25.9 MB 9.8 MB/s eta 0:00:01\n", " ---------------------------------- ----- 22.5/25.9 MB 9.8 MB/s eta 0:00:01\n", " ----------------------------------- ---- 23.1/25.9 MB 10.9 MB/s eta 0:00:01\n", " ------------------------------------ --- 23.8/25.9 MB 10.7 MB/s eta 0:00:01\n", " ------------------------------------- -- 24.3/25.9 MB 10.7 MB/s eta 0:00:01\n", " -------------------------------------- - 24.9/25.9 MB 11.1 MB/s eta 0:00:01\n", " --------------------------------------- 25.3/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 11.1 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " --------------------------------------- 25.9/25.9 MB 10.9 MB/s eta 0:00:01\n", " ---------------------------------------- 25.9/25.9 MB 3.9 MB/s eta 0:00:00\n", "Installing collected packages: av, accelerate, mediapy\n", "Successfully installed accelerate-0.24.1 av-11.0.0 mediapy-1.1.9\n" ] } ], "source": [ "!pip install einops omegaconf decord safetensors diffusers[torch]==0.11.1 transformers xformers triton==2.0.0 imageio[pyav] mediapy" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "id": "0jsTnJgXVjC6" }, "outputs": [], "source": [ "# !pip install -U \"jax[cuda12_pip]\" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ePPaNOhFZFgH", "outputId": "e116c509-8495-4c8b-edda-a47d8754c462" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The following additional packages will be installed:\n", " libaria2-0 libc-ares2\n", "The following NEW packages will be installed:\n", " aria2 libaria2-0 libc-ares2\n", "0 upgraded, 3 newly installed, 0 to remove and 10 not upgraded.\n", "Need to get 1,513 kB of archives.\n", "After this operation, 5,441 kB of additional disk space will be used.\n", "Selecting previously unselected package libc-ares2:amd64.\n", "(Reading database ... 120880 files and directories currently installed.)\n", "Preparing to unpack .../libc-ares2_1.18.1-1ubuntu0.22.04.2_amd64.deb ...\n", "Unpacking libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n", "Selecting previously unselected package libaria2-0:amd64.\n", "Preparing to unpack .../libaria2-0_1.36.0-1_amd64.deb ...\n", "Unpacking libaria2-0:amd64 (1.36.0-1) ...\n", "Selecting previously unselected package aria2.\n", "Preparing to unpack .../aria2_1.36.0-1_amd64.deb ...\n", "Unpacking aria2 (1.36.0-1) ...\n", "Setting up libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.2) ...\n", "Setting up libaria2-0:amd64 (1.36.0-1) ...\n", "Setting up aria2 (1.36.0-1) ...\n", "Processing triggers for man-db (2.10.2-1) ...\n", "Processing triggers for libc-bin (2.35-0ubuntu3.4) ...\n", "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_0.so.3 is not a symbolic link\n", "\n", "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc.so.2 is not a symbolic link\n", "\n", "/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_5.so.3 is not a symbolic link\n", "\n", "/sbin/ldconfig.real: /usr/local/lib/libtbb.so.12 is not a symbolic link\n", "\n", "/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc_proxy.so.2 is not a symbolic link\n", "\n", "/sbin/ldconfig.real: /usr/local/lib/libtbbbind.so.3 is not a symbolic link\n", "\n", "\u001b[0m\n", "Download Results:\n", "gid |stat|avg speed |path/URI\n", "======+====+===========+=======================================================\n", "401ea6|\u001b[1;32mOK\u001b[0m | 168MiB/s|/content/AnimateDiff-SceneFusion/models/DreamBooth_LoRA/toonyou_beta3.safetensors\n", "\n", "Status Legend:\n", "(OK):download completed.\n" ] } ], "source": [ "!apt -y install -qq aria2\n", "!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" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jXBHQRi1LKnb", "outputId": "10219ae9-e50d-4a31-fa6f-37f8cccc1fb3" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting ffmpeg\n", " Downloading ffmpeg-1.4.tar.gz (5.1 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "Building wheels for collected packages: ffmpeg\n", " Building wheel for ffmpeg (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for ffmpeg: filename=ffmpeg-1.4-py3-none-any.whl size=6082 sha256=289c2192632ef676cb1b88a59f16c39dd96bd8cf3a7c2cf8f661d5b4d0481c1d\n", " Stored in directory: /root/.cache/pip/wheels/8e/7a/69/cd6aeb83b126a7f04cbe7c9d929028dc52a6e7d525ff56003a\n", "Successfully built ffmpeg\n", "Installing collected packages: ffmpeg\n", "Successfully installed ffmpeg-1.4\n" ] } ], "source": [ "!pip install ffmpeg" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Hdx9PUJXG-d_", "outputId": "c102aafb-7572-447c-bf13-84709c21c65d" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/content/AnimateDiff-SceneFusion\n" ] } ], "source": [ "%cd AnimateDiff-SceneFusion\n", "# !pip install -r requirements.txt" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "n581MT-dIxAh", "outputId": "5bf3af95-bec0-4888-b983-aebb2d7efd32" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Cloning into 'models/StableDiffusion'...\n", "Updating files: 47% (8/17)\n", "Updating files: 52% (9/17)\n", "Updating files: 58% (10/17)\n", "Updating files: 64% (11/17)\n", "Updating files: 70% (12/17)\n", "Updating files: 76% (13/17)\n", "Updating files: 82% (14/17)\n", "Updating files: 88% (15/17)\n", "Updating files: 94% (16/17)\n", "Updating files: 100% (17/17)\n", "Updating files: 100% (17/17), done.\n", "Filtering content: 50% (2/4), 394.42 MiB | 17.74 MiB/s\n", "Filtering content: 50% (2/4), 974.35 MiB | 10.32 MiB/s\n", "Filtering content: 75% (3/4), 974.35 MiB | 10.32 MiB/s\n", "Filtering content: 75% (3/4), 2.55 GiB | 6.73 MiB/s \n", "Filtering content: 100% (4/4), 2.55 GiB | 6.73 MiB/s\n", "Filtering content: 100% (4/4), 2.55 GiB | 5.89 MiB/s, done.\n" ] } ], "source": [ "# %cd /content/AnimateDiff-SceneFusion\n", "\n", "# import huggingface_hub\n", "\n", "# 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", "\n", "# for file in files:\n", "# huggingface_hub.hf_hub_download(\"runwayml/stable-diffusion-v1-5\", file, subfolder=\"unet\", local_dir=\"unet\")\n", "\n", "\n", "!git clone -b fp16 https://huggingface.co/runwayml/stable-diffusion-v1-5 models/StableDiffusion/" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RLuAKqD3I2pv", "outputId": "37bccf0c-bb76-4d0e-e668-f91254d4f3a3" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Access denied with the following error:\n", "Access denied with the following error:\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", " \tToo many users have viewed or downloaded this file recently. Please\n", "\ttry accessing the file again later. If the file you are trying to\n", "\taccess is particularly large or is shared with many people, it may\n", "\ttake up to 24 hours to be able to view or download the file. If you\n", "\tstill can't access a file after 24 hours, contact your domain\n", "\tadministrator. \n", "\n", "You may still be able to access the file from the browser:\n", "\n", "\t https://drive.google.com/uc?id=1RqkQuGPaCO5sGZ6V6KZ-jUWmsRu48Kdq \n", "\n", "\n", " \tToo many users have viewed or downloaded this file recently. Please\n", "\ttry accessing the file again later. If the file you are trying to\n", "\taccess is particularly large or is shared with many people, it may\n", "\ttake up to 24 hours to be able to view or download the file. If you\n", "\tstill can't access a file after 24 hours, contact your domain\n", "\tadministrator. \n", "\n", "You may still be able to access the file from the browser:\n", "\n", "\t https://drive.google.com/uc?id=1ql0g_Ys4UCz2RnokYlBjyOYPbttbIpbu \n", "\n" ] } ], "source": [ "# %cd AnimateDiff-SceneFusion\n", "!bash download_bashscripts/0-MotionModule.sh" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "id": "1VUbuB4M2UhZ" }, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, "id": "VZ-CXYNhKXuy", "outputId": "88d9be57-67dc-4c4b-a6cc-b39623118d2a" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[*] Weights will be saved at models/Motion_Module/test\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "The syntax of the command is incorrect.\n" ] } ], "source": [ "# @title TRAINING CONFIG\n", "# %cd /content/AnimateDiff-SceneFusion\n", "\n", "# @markdown ## Config\n", "\n", "PROJECT = \"test\" # @param{\"type\":\"string\"}\n", "\n", "OUTPUT_DIR = \"models/Motion_Module/%s\" % PROJECT\n", "\n", "print(f\"[*] Weights will be saved at {OUTPUT_DIR}\")\n", "\n", "!mkdir -p $OUTPUT_DIR\n", "\n", "# @markdown ## Model\n", "\n", "MODEL_NAME = \"models/StableDiffusion/\" # @param{\"type\":\"string\"}\n", "\n", "# @markdown ## Train\n", "\n", "CONFIG_NAME = f\"configs/{PROJECT}.yaml\" #@param {type:\"string\"}\n", "MOTION_MODULE_NAME=\"models/Motion_Module/mm_sd_v15.ckpt\" #@param{\"type\":\"string\"}\n", "\n", "train_video_folder = f\"data/output\" #@param {type:\"string\"}\n", "train_csv_path = f\"data/output.csv\" #@param {type:\"string\"}\n", "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", "video_length = 5 #@param {type:\"number\"}\n", "sample_size = 256 #@param {type:\"number\"}\n", "learning_rate = 3e-4 #@param {type:\"number\"}\n", "train_steps = 1 #@param {type:\"number\"}\n", "validation_steps = 1 #@param {type:\"number\"}\n", "\n", "\n", "# @markdown ## Infer\n", "LORA_DREAMBOOTH_PATH=\"models/DreamBooth_LoRA/toonyou_beta3.safetensors\" #@param{\"type\":\"string\"}\n", "\n", "\n", "from omegaconf import OmegaConf\n", "\n", "\n", "config = {\n", " \"pretrained_model_path\": \"models/StableDiffusion/\",\n", " \"motion_module\": MOTION_MODULE_NAME,\n", " \"output_dir\": OUTPUT_DIR,\n", " \"train_data\": {\n", " \"video_folder\": train_video_folder,\n", " \"csv_path\": train_csv_path,\n", " \"sample_n_frames\": video_length,\n", " \"sample_stride\": 100,\n", " \"sample_size\": sample_size\n", " },\n", " \"validation_data\": {\n", " \"prompts\": [\n", " f\"{train_prompt}\",\n", " ],\n", " \"video_length\": video_length,\n", " \"width\": sample_size,\n", " \"height\": sample_size,\n", " \"num_inference_steps\": 20,\n", " \"guidance_scale\": 12.5,\n", " \"temporal_context\": 24,\n", " \"use_inv_latent\": True,\n", " \"num_inv_steps\": 50,\n", " },\n", " \"learning_rate\": learning_rate,\n", " \"train_batch_size\": 1,\n", " \"max_train_steps\": train_steps,\n", " \"checkpointing_steps\": 100,\n", " \"validation_steps\": validation_steps,\n", " \"trainable_modules\": [\n", " \"to_q\",\n", " ],\n", " \"seed\": 33,\n", " \"mixed_precision\": \"fp16\",\n", " \"use_8bit_adam\": False,\n", " \"gradient_checkpointing\": True,\n", " \"enable_xformers_memory_efficient_attention\": True,\n", "}\n", "\n", "OmegaConf.save(config, CONFIG_NAME)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kpUetphRI9D3", "outputId": "d0bba9b2-b93c-476a-9909-94e9f7d5239b" }, "outputs": [], "source": [ "# %cd /content/AnimateDiff-SceneFusion\n", "# !python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 train.py --config configs/training/training.yaml\n", "\n", "# !accelerate launch train.py --config=configs/training/training.yaml\n", "!accelerate launch train.py --config=configs/{PROJECT}.yaml --python={3.10}" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 365 }, "id": "IZ2U776S06Gn", "outputId": "bae1ea5f-55e6-4a20-8b53-7c641b4ebba5" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "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", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "ename": "OSError", "evalue": "Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory models/StableDiffusion/.", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mOSError\u001b[0m Traceback (most recent call last)", "\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 25\u001b[0m \u001b[39m### >>> create validation pipeline >>> ###\u001b[39;00m\n\u001b[0;32m 26\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---> 27\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 28\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 29\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", "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", "\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/." ] } ], "source": [ "# %cd /content/AnimateDiff-SceneFusion\n", "\n", "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n", "from diffusers import AutoencoderKL, DDPMScheduler, DDIMScheduler\n", "from transformers import CLIPTextModel, CLIPTokenizer\n", "from omegaconf import OmegaConf\n", "from animatediff.models.unet import UNet3DConditionModel\n", "from animatediff.pipelines.pipeline_animation import AnimationPipeline\n", "from animatediff.utils.util import save_videos_grid\n", "from animatediff.utils.util import load_weights\n", "from diffusers.utils.import_utils import is_xformers_available\n", "from typing import Any\n", "import torch\n", "from einops import rearrange\n", "import torchvision\n", "\n", "import numpy as np\n", "\n", "\n", "model_path = \"models/StableDiffusion/\"\n", "inference_config_path = \"configs/inference/inference-v3.yaml\"\n", "motion_module = \"models/Motion_Module/mm_sd_v15.ckpt\"\n", "\n", "inference_config = OmegaConf.load(inference_config_path)\n", "### >>> create validation pipeline >>> ###\n", "tokenizer = CLIPTokenizer.from_pretrained(model_path, subfolder=\"tokenizer\")\n", "text_encoder = CLIPTextModel.from_pretrained(model_path, subfolder=\"text_encoder\")\n", "vae = AutoencoderKL.from_pretrained(model_path, subfolder=\"vae\")\n", "unet = UNet3DConditionModel.from_pretrained_2d(model_path, subfolder=\"unet\", unet_additional_kwargs=OmegaConf.to_container(inference_config.unet_additional_kwargs))\n", "\n", "if is_xformers_available(): unet.enable_xformers_memory_efficient_attention()\n", "else: assert False\n", "\n", "pipeline = AnimationPipeline(\n", " vae=vae, text_encoder=text_encoder, tokenizer=tokenizer, unet=unet,\n", " scheduler=DDIMScheduler(**OmegaConf.to_container(inference_config.noise_scheduler_kwargs.DDIMScheduler)),\n", ").to(\"cuda\")\n", "\n", "pipeline = load_weights(\n", " pipeline,\n", " # motion module\n", " motion_module_path = motion_module,\n", " motion_module_lora_configs = [],\n", " # image layers\n", " dreambooth_model_path = \"\",\n", " lora_model_path = \"\",\n", " lora_alpha = 0.8,\n", ").to(\"cuda\")\n", "\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "id": "VnDjPeeq1Sdx" }, "outputs": [], "source": [ "pipeline.save_config(\"./\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "nzn0gZA8F4Pk" }, "outputs": [], "source": [ "# prompt: save model to huggingface repo\n", "\n", "!git lfs install\n", "# !git clone https://huggingface.co/bluestarburst/AnimateDiff-SceneFusion /content/huggingface\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "H_OhGJrCPjYb" }, "outputs": [], "source": [ "!cp /content/AnimateDiff-SceneFusion/animatediff/pipelines/pipeline_animation.py /content/AnimateDiff-SceneFusion/pipeline.py" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "qvK9PwJlSUCg" }, "outputs": [], "source": [ "%cd /content/\n", "!huggingface-cli upload AnimateDiff-SceneFusion" ] } ], "metadata": { "accelerator": "GPU", "colab": { "gpuType": "T4", "machine_shape": "hm", "provenance": [] }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" } }, "nbformat": 4, "nbformat_minor": 0 }