From 950842f59570b38fd51d7f3a47282bbac6e43086 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 16:40:26 -0400 Subject: [PATCH 1/7] :package: fix packaging issues --- .github/workflows/python-publish.yml | 31 + README.md | 52 +- requirements.txt | 2 +- setup.py | 28 + stable_diffusion_videos.ipynb | 1279 ++++++++++++++++- stable_diffusion_videos/__init__.py | 118 ++ app.py => stable_diffusion_videos/app.py | 2 +- .../stable_diffusion_pipeline.py | 13 + .../stable_diffusion_walk.py | 2 +- 9 files changed, 1475 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/python-publish.yml create mode 100644 setup.py create mode 100644 stable_diffusion_videos/__init__.py rename app.py => stable_diffusion_videos/app.py (97%) rename stable_diffusion_pipeline.py => stable_diffusion_videos/stable_diffusion_pipeline.py (94%) rename stable_diffusion_walk.py => stable_diffusion_videos/stable_diffusion_walk.py (98%) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..3bd2eb8 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* \ No newline at end of file diff --git a/README.md b/README.md index 738bf0e..4fbb0ab 100644 --- a/README.md +++ b/README.md @@ -26,40 +26,42 @@ The app is built with [Gradio](https://gradio.app/), which allows you to interac - Set the `num_walk_steps` - for testing you can use a small number like 3 or 5, but to get great results you'll want to use something larger (60-200 steps). - You can (and should) use the `name` input to separate out where the images/videos are saved. (Note that currently ffmpeg will not overwrite if you already made a video with the same name. You'll have to use ffmpeg to create the video yourself if the app fails to do so.) -### The Script +### Python Package #### Setup +Install the package + ``` -git clone https://github.com/nateraw/stable-diffusion-videos -cd stable-diffusion-videos -pip install -r requirements.txt +pip install stable_diffusion_videos ``` -#### Usage +Authenticate with Hugging Face -If you would prefer to use the `stable_diffusion_walk.py` script directly, you can do so by running: - -Run with `num_steps` set to 3 or 5 for testing, then up it to something like 60-200 for better results. - -```bash -python stable_diffusion_walk.py \ - --prompts "['a cat', 'a dog', 'a horse']" \ - --seeds 903,123,42 \ - --output_dir dreams \ - --name animals_test \ - --guidance_scale 8.5 \ - --num_steps 5 \ - --height 512 \ - --width 512 \ - --num_inference_steps 50 \ - --scheduler klms \ - --disable_tqdm \ - --make_video \ - --use_lerp_for_text \ - --do_loop +``` +huggingface-cli login ``` +#### Usage + +```python +from stable_diffusion_videos import walk + +walk( + prompts=['a cat', 'a dog'], + seeds=[42, 1337], + output_dir='dreams', # Where images/videos will be saved + name='animals_test', # Subdirectory of output_dir where images/videos will be saved + guidance_scale=8.5, # Higher adheres to prompt more, lower lets model take the wheel + num_steps=5, # Change to 60-200 for better results...3-5 for testing + num_inference_steps=50, + scheduler='klms', # One of: "klms", "default", "ddim" + disable_tqdm=False, # Set to True to disable tqdm progress bar + make_video=True, # If false, just save images + use_lerp_for_text=True, # Use lerp for text embeddings instead of slerp + do_loop=False, # Change to True if you want last prompt to loop back to first prompt +) +``` ## Credits diff --git a/requirements.txt b/requirements.txt index 5ee12c7..b340ccc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ transformers -git+https://github.com/huggingface/diffusers@f085d2f5c6569a1c0d90327c51328622036ef76e +diffusers==0.2.4 scipy fire gradio \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f9c0261 --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +from setuptools import find_packages, setup + + +def get_version() -> str: + rel_path = "stable_diffusion_videos/__init__.py" + with open(rel_path, "r") as fp: + for line in fp.read().splitlines(): + if line.startswith("__version__"): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + raise RuntimeError("Unable to find version string.") + + +with open("requirements.txt", "r") as f: + requirements = f.read().splitlines() + +setup( + name="stable_diffusion_videos", + version=get_version(), + author="Nathan Raw", + author_email="naterawdata@gmail.com", + description=( + "Create πŸ”₯ videos with Stable Diffusion by exploring the latent space and morphing between text prompts." + ), + license="Apache", + install_requires=requirements, + packages=find_packages(), +) diff --git a/stable_diffusion_videos.ipynb b/stable_diffusion_videos.ipynb index 212ca54..1bbcc4d 100644 --- a/stable_diffusion_videos.ipynb +++ b/stable_diffusion_videos.ipynb @@ -5,7 +5,7 @@ "colab": { "provenance": [], "collapsed_sections": [], - "authorship_tag": "ABX9TyN/ZOFCUNqBdfOYeo31y+2Q", + "authorship_tag": "ABX9TyNZyDjZP79RGU3YLDXIc3ME", "include_colab_link": true }, "kernelspec": { @@ -16,7 +16,1037 @@ "name": "python" }, "accelerator": "GPU", - "gpuClass": "standard" + "gpuClass": "standard", + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "0a8ecbd1828546bba15205813d1b0f69": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_9ce7086bdb6e46459f93ba3b4a287ed4", + "IPY_MODEL_fb67885e7b62489c969140d869bcc395", + "IPY_MODEL_f006908f524042ecab08acfdff798711" + ], + "layout": "IPY_MODEL_f1624911cea24fb9a4166bc0ff9147ff" + } + }, + "9ce7086bdb6e46459f93ba3b4a287ed4": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_71cbb8228690400c827fedd888574db2", + "placeholder": "​", + "style": "IPY_MODEL_50ebf57a89fb44f8b66c3f71f2a1cca8", + "value": "100%" + } + }, + "fb67885e7b62489c969140d869bcc395": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_a835971d2aaf41bf9aece12fc4e018de", + "max": 50, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_f43a84b793184a388ab77041afb6f265", + "value": 50 + } + }, + "f006908f524042ecab08acfdff798711": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_223d3bdc9e6c490e9370b7a7456e8a65", + "placeholder": "​", + "style": "IPY_MODEL_5e37f24b6dee48cfba113169870bb40b", + "value": " 50/50 [00:20<00:00, 2.91it/s]" + } + }, + "f1624911cea24fb9a4166bc0ff9147ff": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "71cbb8228690400c827fedd888574db2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "50ebf57a89fb44f8b66c3f71f2a1cca8": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "a835971d2aaf41bf9aece12fc4e018de": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "f43a84b793184a388ab77041afb6f265": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "223d3bdc9e6c490e9370b7a7456e8a65": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "5e37f24b6dee48cfba113169870bb40b": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "b9feec6022af4a7d99ef61b70704e155": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_93ef8fbb70974269888260e6cce34c47", + "IPY_MODEL_87d87ee6b95c44a8af763e27b429ea54", + "IPY_MODEL_2398cffa8f504dbaa713331447bb9a82" + ], + "layout": "IPY_MODEL_e859642054834d25a81f67653cc447ee" + } + }, + "93ef8fbb70974269888260e6cce34c47": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_08443ad18c1f4fd5be1557311ab99429", + "placeholder": "​", + "style": "IPY_MODEL_54263f000bf04338983abd9d2cf13da5", + "value": "100%" + } + }, + "87d87ee6b95c44a8af763e27b429ea54": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_981fbe6ca88545498d0d4ec6cf3eb784", + "max": 50, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_720def4a72814bc1b20cfc76e6c8c145", + "value": 50 + } + }, + "2398cffa8f504dbaa713331447bb9a82": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_e066b0bd9a5449118bb274ef5d249baa", + "placeholder": "​", + "style": "IPY_MODEL_f97618aba6704d7eae4bbb7798f3be57", + "value": " 50/50 [00:17<00:00, 2.91it/s]" + } + }, + "e859642054834d25a81f67653cc447ee": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "08443ad18c1f4fd5be1557311ab99429": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "54263f000bf04338983abd9d2cf13da5": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "981fbe6ca88545498d0d4ec6cf3eb784": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "720def4a72814bc1b20cfc76e6c8c145": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "e066b0bd9a5449118bb274ef5d249baa": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "f97618aba6704d7eae4bbb7798f3be57": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "4a69984efa3147728d5f2ae09742c899": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_6ff526cda6df4479be5414bcad3035da", + "IPY_MODEL_cbc648d399d84cf19ecd9b06ca24fa31", + "IPY_MODEL_c251244395514c9b9ad7498b4094eee2" + ], + "layout": "IPY_MODEL_301d9d180a9942689085fdb572f91456" + } + }, + "6ff526cda6df4479be5414bcad3035da": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_379b9204eea54b019611d98a027466a2", + "placeholder": "​", + "style": "IPY_MODEL_a58050a6d31744a99c4c9d667c36adbc", + "value": "100%" + } + }, + "cbc648d399d84cf19ecd9b06ca24fa31": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_690e446b0de24b9a9e4afb40be0e04e2", + "max": 50, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_0f96a290b44f4c3388b0df3d6ecbb43d", + "value": 50 + } + }, + "c251244395514c9b9ad7498b4094eee2": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_e5e9a7db20194aa482bfef109c0d651b", + "placeholder": "​", + "style": "IPY_MODEL_7a4e4e685fe3494a8a9b0687b27f4e31", + "value": " 50/50 [00:17<00:00, 2.91it/s]" + } + }, + "301d9d180a9942689085fdb572f91456": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "379b9204eea54b019611d98a027466a2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a58050a6d31744a99c4c9d667c36adbc": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "690e446b0de24b9a9e4afb40be0e04e2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "0f96a290b44f4c3388b0df3d6ecbb43d": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "e5e9a7db20194aa482bfef109c0d651b": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "7a4e4e685fe3494a8a9b0687b27f4e31": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + } + } + } }, "cells": [ { @@ -26,7 +1056,7 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { @@ -47,7 +1077,7 @@ "Enjoy πŸ€—" ], "metadata": { - "id": "B4V57sVzLHu3" + "id": "z4GhhH25OdYq" } }, { @@ -56,21 +1086,18 @@ "## Setup" ], "metadata": { - "id": "0L9zhmONL81f" + "id": "dvdCBpWWOhW-" } }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": { - "id": "klUR9ie1DVm-" + "id": "Xwfc0ej1L9A0" }, "outputs": [], "source": [ - "%%capture\n", - "! git clone https://github.com/nateraw/stable-diffusion-videos\n", - "%cd /content/stable-diffusion-videos/\n", - "! pip install -r requirements.txt\n", + "! pip install stable_diffusion_videos\n", "! git config --global credential.helper store" ] }, @@ -82,7 +1109,7 @@ "You have to be a registered user in πŸ€— Hugging Face Hub, and you'll also need to use an access token for the code to work. For more information on access tokens, please refer to [this section of the documentation](https://huggingface.co/docs/hub/security-tokens)." ], "metadata": { - "id": "BoTBdktZDs8B" + "id": "dR5iVGYbOky5" } }, { @@ -93,7 +1120,7 @@ "notebook_login()" ], "metadata": { - "id": "8jVV1OLBDZ8o" + "id": "GmejIGhFMTXG" }, "execution_count": null, "outputs": [] @@ -104,7 +1131,7 @@ "## Run the App πŸš€" ], "metadata": { - "id": "TbW39aWzIdsn" + "id": "H7UOKJhVOonb" } }, { @@ -115,19 +1142,16 @@ "This step will take a couple minutes the first time you run it." ], "metadata": { - "id": "jCWuRT78Jt0L" + "id": "g71hslP8OntM" } }, { "cell_type": "code", "source": [ - "# in case you restarted runtime, we need to be in this directory\n", - "%cd /content/stable-diffusion-videos/\n", - "\n", - "from app import interface" + "from stable_diffusion_videos import interface" ], "metadata": { - "id": "a6Eey_-YDvFc" + "id": "bgSNS368L-DV" }, "execution_count": null, "outputs": [] @@ -147,10 +1171,12 @@ "2. Generate videos using the \"Videos\" tab\n", " - Using the images you found from the step above, provide the prompts/seeds you recorded\n", " - Set the `num_walk_steps` - for testing you can use a small number like 3 or 5, but to get great results you'll want to use something larger (60-200 steps). \n", - " - You can (and should) use the `name` input to separate out where the images/videos are saved. " + " - You can (and should) use the `name` input to separate out where the images/videos are saved. \n", + "\n", + "πŸ’‘ **Pro tip** - Click the link that looks like `https://.gradio.app` below , and you'll be able to view it in full screen." ], "metadata": { - "id": "Po9vuzMnJzka" + "id": "VxjRVNnMOtgU" } }, { @@ -159,10 +1185,215 @@ "interface.launch()" ], "metadata": { - "id": "fflAEZaLIYGP" + "colab": { + "base_uri": "https://localhost:8080/", + "height": 677 + }, + "id": "8es3_onUOL3J", + "outputId": "0e25db4b-e977-43ed-98c5-0923ab16bd37" }, - "execution_count": null, + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Rerunning server... use `close()` to stop if you need to change `launch()` parameters.\n", + "----\n", + "Colab notebook detected. To show errors in colab notebook, set `debug=True` in `launch()`\n", + "Running on public URL: https://16071.gradio.app\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting, check out Spaces: https://huggingface.co/spaces\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "
" + ] + }, + "metadata": {} + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(,\n", + " 'http://127.0.0.1:7860/',\n", + " 'https://16071.gradio.app')" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "---" + ], + "metadata": { + "id": "mFCoTvlnPi4u" + } + }, + { + "cell_type": "markdown", + "source": [ + "## Use `walk` programatically\n", + "\n", + "The other option is to not use the interface, and instead use `walk` programatically. Here's how you would do that..." + ], + "metadata": { + "id": "SjTQLCiLOWeo" + } + }, + { + "cell_type": "markdown", + "source": [ + "First we define a helper fn for visualizing videos in colab" + ], + "metadata": { + "id": "fGQPClGwOR9R" + } + }, + { + "cell_type": "code", + "source": [ + "from IPython.display import HTML\n", + "from base64 import b64encode\n", + "\n", + "def visualize_video_colab(video_path):\n", + " mp4 = open(video_path,'rb').read()\n", + " data_url = \"data:video/mp4;base64,\" + b64encode(mp4).decode()\n", + " return HTML(\"\"\"\n", + " \n", + " \"\"\" % data_url)" + ], + "metadata": { + "id": "GqTWc8ZhNeLU" + }, + "execution_count": 14, "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "Walk! πŸšΆβ€β™€οΈ" + ], + "metadata": { + "id": "Vd_RzwkoPM7X" + } + }, + { + "cell_type": "code", + "source": [ + "from stable_diffusion_videos import walk\n", + "\n", + "video_path = walk(['a cat', 'a dog'], [42, 1337], num_steps=3, make_video=True)\n", + "visualize_video_colab(video_path)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 130, + "referenced_widgets": [ + "0a8ecbd1828546bba15205813d1b0f69", + "9ce7086bdb6e46459f93ba3b4a287ed4", + "fb67885e7b62489c969140d869bcc395", + "f006908f524042ecab08acfdff798711", + "f1624911cea24fb9a4166bc0ff9147ff", + "71cbb8228690400c827fedd888574db2", + "50ebf57a89fb44f8b66c3f71f2a1cca8", + "a835971d2aaf41bf9aece12fc4e018de", + "f43a84b793184a388ab77041afb6f265", + "223d3bdc9e6c490e9370b7a7456e8a65", + "5e37f24b6dee48cfba113169870bb40b", + "b9feec6022af4a7d99ef61b70704e155", + "93ef8fbb70974269888260e6cce34c47", + "87d87ee6b95c44a8af763e27b429ea54", + "2398cffa8f504dbaa713331447bb9a82", + "e859642054834d25a81f67653cc447ee", + "08443ad18c1f4fd5be1557311ab99429", + "54263f000bf04338983abd9d2cf13da5", + "981fbe6ca88545498d0d4ec6cf3eb784", + "720def4a72814bc1b20cfc76e6c8c145", + "e066b0bd9a5449118bb274ef5d249baa", + "f97618aba6704d7eae4bbb7798f3be57", + "4a69984efa3147728d5f2ae09742c899", + "6ff526cda6df4479be5414bcad3035da", + "cbc648d399d84cf19ecd9b06ca24fa31", + "c251244395514c9b9ad7498b4094eee2", + "301d9d180a9942689085fdb572f91456", + "379b9204eea54b019611d98a027466a2", + "a58050a6d31744a99c4c9d667c36adbc", + "690e446b0de24b9a9e4afb40be0e04e2", + "0f96a290b44f4c3388b0df3d6ecbb43d", + "e5e9a7db20194aa482bfef109c0d651b", + "7a4e4e685fe3494a8a9b0687b27f4e31" + ] + }, + "id": "Hv2wBZXXMQ-I", + "outputId": "32b67ac6-e404-4008-fa81-78ebcb93bc1a" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "COUNT: 1/3\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + " 0%| | 0/50 [00:00 list of attributes / functions. + These attributes are imported as they are used. + + Returns: + __getattr__, __dir__, __all__ + + """ + if submod_attrs is None: + submod_attrs = {} + + if submodules is None: + submodules = set() + else: + submodules = set(submodules) + + attr_to_modules = { + attr: mod for mod, attrs in submod_attrs.items() for attr in attrs + } + + __all__ = list(submodules | attr_to_modules.keys()) + + def __getattr__(name): + if name in submodules: + return importlib.import_module(f"{package_name}.{name}") + elif name in attr_to_modules: + submod_path = f"{package_name}.{attr_to_modules[name]}" + submod = importlib.import_module(submod_path) + attr = getattr(submod, name) + + # If the attribute lives in a file (module) with the same + # name as the attribute, ensure that the attribute and *not* + # the module is accessible on the package. + if name == attr_to_modules[name]: + pkg = sys.modules[package_name] + pkg.__dict__[name] = attr + + return attr + else: + raise AttributeError(f"No {package_name} attribute {name}") + + def __dir__(): + return __all__ + + if os.environ.get("EAGER_IMPORT", ""): + for attr in set(attr_to_modules.keys()) | submodules: + __getattr__(attr) + + return __getattr__, __dir__, list(__all__) + + + +__getattr__, __dir__, __all__ = _attach( + __name__, + submodules=[], + submod_attrs={ + "commands.user": ["notebook_login"], + "app": [ + "interface", + ], + "stable_diffusion_pipeline": [ + "StableDiffusionPipeline", + ], + "stable_diffusion_walk": [ + "walk", + "SCHEDULERS", + ] + }, +) + +__version__ = "0.1.0" \ No newline at end of file diff --git a/app.py b/stable_diffusion_videos/app.py similarity index 97% rename from app.py rename to stable_diffusion_videos/app.py index a2f29e9..9fc48f9 100644 --- a/app.py +++ b/stable_diffusion_videos/app.py @@ -1,7 +1,7 @@ import gradio as gr import torch -from stable_diffusion_walk import SCHEDULERS, pipeline, walk +from .stable_diffusion_walk import SCHEDULERS, pipeline, walk def fn_images( diff --git a/stable_diffusion_pipeline.py b/stable_diffusion_videos/stable_diffusion_pipeline.py similarity index 94% rename from stable_diffusion_pipeline.py rename to stable_diffusion_videos/stable_diffusion_pipeline.py index 21068ef..4e2d324 100644 --- a/stable_diffusion_pipeline.py +++ b/stable_diffusion_videos/stable_diffusion_pipeline.py @@ -219,3 +219,16 @@ def embed_text(self, text): with torch.no_grad(): embed = self.text_encoder(text_input.input_ids.to(self.device))[0] return embed + + def progress_bar(self, iterable): + if not hasattr(self, "_progress_bar_config"): + self._progress_bar_config = {} + elif not isinstance(self._progress_bar_config, dict): + raise ValueError( + f"`self._progress_bar_config` should be of type `dict`, but is {type(self._progress_bar_config)}." + ) + + return tqdm(iterable, **self._progress_bar_config) + + def set_progress_bar_config(self, **kwargs): + self._progress_bar_config = kwargs \ No newline at end of file diff --git a/stable_diffusion_walk.py b/stable_diffusion_videos/stable_diffusion_walk.py similarity index 98% rename from stable_diffusion_walk.py rename to stable_diffusion_videos/stable_diffusion_walk.py index 5a22c03..d742b85 100644 --- a/stable_diffusion_walk.py +++ b/stable_diffusion_videos/stable_diffusion_walk.py @@ -6,7 +6,7 @@ from diffusers.schedulers import (DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler) -from stable_diffusion_pipeline import StableDiffusionPipeline +from .stable_diffusion_pipeline import StableDiffusionPipeline pipeline = StableDiffusionPipeline.from_pretrained( "CompVis/stable-diffusion-v1-4", From 53c03aa0063bcc509f227dca9ed1a8e206e33197 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 16:42:07 -0400 Subject: [PATCH 2/7] :pushpin: pin version --- stable_diffusion_videos/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable_diffusion_videos/__init__.py b/stable_diffusion_videos/__init__.py index 8985116..f94c713 100644 --- a/stable_diffusion_videos/__init__.py +++ b/stable_diffusion_videos/__init__.py @@ -115,4 +115,4 @@ def __dir__(): }, ) -__version__ = "0.1.0" \ No newline at end of file +__version__ = "0.1.1" \ No newline at end of file From 0b253d98a26bdd605b28838ee509033c21d0b3ee Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 16:44:20 -0400 Subject: [PATCH 3/7] :bug: tqdm --- stable_diffusion_videos/stable_diffusion_pipeline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/stable_diffusion_videos/stable_diffusion_pipeline.py b/stable_diffusion_videos/stable_diffusion_pipeline.py index 4e2d324..d3cdd50 100644 --- a/stable_diffusion_videos/stable_diffusion_pipeline.py +++ b/stable_diffusion_videos/stable_diffusion_pipeline.py @@ -1,5 +1,6 @@ import inspect import warnings +from tqdm.auto import tqdm from typing import List, Optional, Union import torch From 19654273d629f1d8e7d5053fdaa9456246ed09ca Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 16:57:57 -0400 Subject: [PATCH 4/7] :bug: fix vae output --- stable_diffusion_videos/stable_diffusion_pipeline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable_diffusion_videos/stable_diffusion_pipeline.py b/stable_diffusion_videos/stable_diffusion_pipeline.py index d3cdd50..c147a13 100644 --- a/stable_diffusion_videos/stable_diffusion_pipeline.py +++ b/stable_diffusion_videos/stable_diffusion_pipeline.py @@ -190,7 +190,7 @@ def __call__( # scale and decode the image latents with vae latents = 1 / 0.18215 * latents - image = self.vae.decode(latents).sample + image = self.vae.decode(latents) image = (image / 2 + 0.5).clamp(0, 1) image = image.cpu().permute(0, 2, 3, 1).numpy() From a8078d4eca03b81b6c8c46589adf091f5e81b392 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 17:08:50 -0400 Subject: [PATCH 5/7] :sparkles: save output to new dir + use output_dir not name --- stable_diffusion_videos/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stable_diffusion_videos/app.py b/stable_diffusion_videos/app.py index 9fc48f9..4841e3f 100644 --- a/stable_diffusion_videos/app.py +++ b/stable_diffusion_videos/app.py @@ -1,3 +1,5 @@ +import time + import gradio as gr import torch @@ -35,7 +37,7 @@ def fn_videos( do_loop, disable_tqdm, use_lerp_for_text, - name, + output_dir, ): prompts = [prompt_1, prompt_2] seeds = [seed_1, seed_2] @@ -52,7 +54,8 @@ def fn_videos( num_steps=num_walk_steps, num_inference_steps=num_inference_steps, use_lerp_for_text=use_lerp_for_text, - name=name, + output_dir=output_dir, + name=time.strftime("%Y%m%d-%H%M%S"), scheduler=scheduler, disable_tqdm=disable_tqdm, ) From 6b8fb1f9fe28f49d8339250c3dc29b501f9240b2 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 7 Sep 2022 17:09:47 -0400 Subject: [PATCH 6/7] :sparkles: update gradio placeholder --- stable_diffusion_videos/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stable_diffusion_videos/app.py b/stable_diffusion_videos/app.py index 4841e3f..725e3a2 100644 --- a/stable_diffusion_videos/app.py +++ b/stable_diffusion_videos/app.py @@ -77,9 +77,9 @@ def fn_videos( gr.Checkbox(False), gr.Checkbox(False), gr.Textbox( - "stable_diffusion_video", + "dreams", placeholder=( - "Name of this experiment. Change to avoid overwriting previous outputs" + "Folder where outputs will be saved. Each output will be saved in a new folder." ), ), ], From 4af0cc2cc7114308dca013fbbc30880e8c90e427 Mon Sep 17 00:00:00 2001 From: Nathan Raw Date: Wed, 7 Sep 2022 17:58:06 -0400 Subject: [PATCH 7/7] Created using Colaboratory --- stable_diffusion_videos.ipynb | 1224 ++------------------------------- 1 file changed, 50 insertions(+), 1174 deletions(-) diff --git a/stable_diffusion_videos.ipynb b/stable_diffusion_videos.ipynb index 1bbcc4d..7eba97f 100644 --- a/stable_diffusion_videos.ipynb +++ b/stable_diffusion_videos.ipynb @@ -5,7 +5,7 @@ "colab": { "provenance": [], "collapsed_sections": [], - "authorship_tag": "ABX9TyNZyDjZP79RGU3YLDXIc3ME", + "authorship_tag": "ABX9TyMDsciHN/HhWLYEdURcy00d", "include_colab_link": true }, "kernelspec": { @@ -16,1037 +16,7 @@ "name": "python" }, "accelerator": "GPU", - "gpuClass": "standard", - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "0a8ecbd1828546bba15205813d1b0f69": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HBoxModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HBoxModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HBoxView", - "box_style": "", - "children": [ - "IPY_MODEL_9ce7086bdb6e46459f93ba3b4a287ed4", - "IPY_MODEL_fb67885e7b62489c969140d869bcc395", - "IPY_MODEL_f006908f524042ecab08acfdff798711" - ], - "layout": "IPY_MODEL_f1624911cea24fb9a4166bc0ff9147ff" - } - }, - "9ce7086bdb6e46459f93ba3b4a287ed4": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_71cbb8228690400c827fedd888574db2", - "placeholder": "​", - "style": "IPY_MODEL_50ebf57a89fb44f8b66c3f71f2a1cca8", - "value": "100%" - } - }, - "fb67885e7b62489c969140d869bcc395": { - "model_module": "@jupyter-widgets/controls", - "model_name": "FloatProgressModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "FloatProgressModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "ProgressView", - "bar_style": "success", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_a835971d2aaf41bf9aece12fc4e018de", - "max": 50, - "min": 0, - "orientation": "horizontal", - "style": "IPY_MODEL_f43a84b793184a388ab77041afb6f265", - "value": 50 - } - }, - "f006908f524042ecab08acfdff798711": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_223d3bdc9e6c490e9370b7a7456e8a65", - "placeholder": "​", - "style": "IPY_MODEL_5e37f24b6dee48cfba113169870bb40b", - "value": " 50/50 [00:20<00:00, 2.91it/s]" - } - }, - "f1624911cea24fb9a4166bc0ff9147ff": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "71cbb8228690400c827fedd888574db2": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "50ebf57a89fb44f8b66c3f71f2a1cca8": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "a835971d2aaf41bf9aece12fc4e018de": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "f43a84b793184a388ab77041afb6f265": { - "model_module": "@jupyter-widgets/controls", - "model_name": "ProgressStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "ProgressStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "bar_color": null, - "description_width": "" - } - }, - "223d3bdc9e6c490e9370b7a7456e8a65": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "5e37f24b6dee48cfba113169870bb40b": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "b9feec6022af4a7d99ef61b70704e155": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HBoxModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HBoxModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HBoxView", - "box_style": "", - "children": [ - "IPY_MODEL_93ef8fbb70974269888260e6cce34c47", - "IPY_MODEL_87d87ee6b95c44a8af763e27b429ea54", - "IPY_MODEL_2398cffa8f504dbaa713331447bb9a82" - ], - "layout": "IPY_MODEL_e859642054834d25a81f67653cc447ee" - } - }, - "93ef8fbb70974269888260e6cce34c47": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_08443ad18c1f4fd5be1557311ab99429", - "placeholder": "​", - "style": "IPY_MODEL_54263f000bf04338983abd9d2cf13da5", - "value": "100%" - } - }, - "87d87ee6b95c44a8af763e27b429ea54": { - "model_module": "@jupyter-widgets/controls", - "model_name": "FloatProgressModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "FloatProgressModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "ProgressView", - "bar_style": "success", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_981fbe6ca88545498d0d4ec6cf3eb784", - "max": 50, - "min": 0, - "orientation": "horizontal", - "style": "IPY_MODEL_720def4a72814bc1b20cfc76e6c8c145", - "value": 50 - } - }, - "2398cffa8f504dbaa713331447bb9a82": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_e066b0bd9a5449118bb274ef5d249baa", - "placeholder": "​", - "style": "IPY_MODEL_f97618aba6704d7eae4bbb7798f3be57", - "value": " 50/50 [00:17<00:00, 2.91it/s]" - } - }, - "e859642054834d25a81f67653cc447ee": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "08443ad18c1f4fd5be1557311ab99429": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "54263f000bf04338983abd9d2cf13da5": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "981fbe6ca88545498d0d4ec6cf3eb784": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "720def4a72814bc1b20cfc76e6c8c145": { - "model_module": "@jupyter-widgets/controls", - "model_name": "ProgressStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "ProgressStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "bar_color": null, - "description_width": "" - } - }, - "e066b0bd9a5449118bb274ef5d249baa": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "f97618aba6704d7eae4bbb7798f3be57": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "4a69984efa3147728d5f2ae09742c899": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HBoxModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HBoxModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HBoxView", - "box_style": "", - "children": [ - "IPY_MODEL_6ff526cda6df4479be5414bcad3035da", - "IPY_MODEL_cbc648d399d84cf19ecd9b06ca24fa31", - "IPY_MODEL_c251244395514c9b9ad7498b4094eee2" - ], - "layout": "IPY_MODEL_301d9d180a9942689085fdb572f91456" - } - }, - "6ff526cda6df4479be5414bcad3035da": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_379b9204eea54b019611d98a027466a2", - "placeholder": "​", - "style": "IPY_MODEL_a58050a6d31744a99c4c9d667c36adbc", - "value": "100%" - } - }, - "cbc648d399d84cf19ecd9b06ca24fa31": { - "model_module": "@jupyter-widgets/controls", - "model_name": "FloatProgressModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "FloatProgressModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "ProgressView", - "bar_style": "success", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_690e446b0de24b9a9e4afb40be0e04e2", - "max": 50, - "min": 0, - "orientation": "horizontal", - "style": "IPY_MODEL_0f96a290b44f4c3388b0df3d6ecbb43d", - "value": 50 - } - }, - "c251244395514c9b9ad7498b4094eee2": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_e5e9a7db20194aa482bfef109c0d651b", - "placeholder": "​", - "style": "IPY_MODEL_7a4e4e685fe3494a8a9b0687b27f4e31", - "value": " 50/50 [00:17<00:00, 2.91it/s]" - } - }, - "301d9d180a9942689085fdb572f91456": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "379b9204eea54b019611d98a027466a2": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "a58050a6d31744a99c4c9d667c36adbc": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "690e446b0de24b9a9e4afb40be0e04e2": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "0f96a290b44f4c3388b0df3d6ecbb43d": { - "model_module": "@jupyter-widgets/controls", - "model_name": "ProgressStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "ProgressStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "bar_color": null, - "description_width": "" - } - }, - "e5e9a7db20194aa482bfef109c0d651b": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "7a4e4e685fe3494a8a9b0687b27f4e31": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - } - } - } + "gpuClass": "standard" }, "cells": [ { @@ -1056,7 +26,7 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { @@ -1091,13 +61,14 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "id": "Xwfc0ej1L9A0" }, "outputs": [], "source": [ - "! pip install stable_diffusion_videos\n", + "# ! pip install stable_diffusion_videos\n", + "! pip install git+https://github.com/nateraw/stable-diffusion-videos@package-try-2\n", "! git config --global credential.helper store" ] }, @@ -1134,6 +105,16 @@ "id": "H7UOKJhVOonb" } }, + { + "cell_type": "markdown", + "source": [ + "### Optional - Connect Google Drive\n", + "\n" + ], + "metadata": { + "id": "GjfrKeeR2NQZ" + } + }, { "cell_type": "markdown", "source": [ @@ -1156,6 +137,33 @@ "execution_count": null, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "#@title Connect to Google Drive to Save Outputs\n", + "\n", + "#@markdown If you want to connect Google Drive, click the checkbox below and run this cell. You'll be prompted to authenticate.\n", + "\n", + "#@markdown If you just want to save your outputs in this Colab session, don't worry about this cell\n", + "\n", + "connect_google_drive = True #@param {type:\"boolean\"}\n", + "\n", + "#@markdown Then, in the interface, use this path as the `output` in the Video tab to save your videos to Google Drive:\n", + "\n", + "#@markdown > /content/gdrive/MyDrive/stable_diffusion_videos\n", + "\n", + "\n", + "if connect_google_drive:\n", + " from google.colab import drive\n", + "\n", + " drive.mount('/content/gdrive')" + ], + "metadata": { + "id": "kidtsR3c2P9Z" + }, + "execution_count": null, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -1185,52 +193,10 @@ "interface.launch()" ], "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 677 - }, - "id": "8es3_onUOL3J", - "outputId": "0e25db4b-e977-43ed-98c5-0923ab16bd37" + "id": "8es3_onUOL3J" }, - "execution_count": 13, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Rerunning server... use `close()` to stop if you need to change `launch()` parameters.\n", - "----\n", - "Colab notebook detected. To show errors in colab notebook, set `debug=True` in `launch()`\n", - "Running on public URL: https://16071.gradio.app\n", - "\n", - "This share link expires in 72 hours. For free permanent hosting, check out Spaces: https://huggingface.co/spaces\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "
" - ] - }, - "metadata": {} - }, - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "(,\n", - " 'http://127.0.0.1:7860/',\n", - " 'https://16071.gradio.app')" - ] - }, - "metadata": {}, - "execution_count": 13 - } - ] + "execution_count": null, + "outputs": [] }, { "cell_type": "markdown", @@ -1279,7 +245,7 @@ "metadata": { "id": "GqTWc8ZhNeLU" }, - "execution_count": 14, + "execution_count": null, "outputs": [] }, { @@ -1300,100 +266,10 @@ "visualize_video_colab(video_path)" ], "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 130, - "referenced_widgets": [ - "0a8ecbd1828546bba15205813d1b0f69", - "9ce7086bdb6e46459f93ba3b4a287ed4", - "fb67885e7b62489c969140d869bcc395", - "f006908f524042ecab08acfdff798711", - "f1624911cea24fb9a4166bc0ff9147ff", - "71cbb8228690400c827fedd888574db2", - "50ebf57a89fb44f8b66c3f71f2a1cca8", - "a835971d2aaf41bf9aece12fc4e018de", - "f43a84b793184a388ab77041afb6f265", - "223d3bdc9e6c490e9370b7a7456e8a65", - "5e37f24b6dee48cfba113169870bb40b", - "b9feec6022af4a7d99ef61b70704e155", - "93ef8fbb70974269888260e6cce34c47", - "87d87ee6b95c44a8af763e27b429ea54", - "2398cffa8f504dbaa713331447bb9a82", - "e859642054834d25a81f67653cc447ee", - "08443ad18c1f4fd5be1557311ab99429", - "54263f000bf04338983abd9d2cf13da5", - "981fbe6ca88545498d0d4ec6cf3eb784", - "720def4a72814bc1b20cfc76e6c8c145", - "e066b0bd9a5449118bb274ef5d249baa", - "f97618aba6704d7eae4bbb7798f3be57", - "4a69984efa3147728d5f2ae09742c899", - "6ff526cda6df4479be5414bcad3035da", - "cbc648d399d84cf19ecd9b06ca24fa31", - "c251244395514c9b9ad7498b4094eee2", - "301d9d180a9942689085fdb572f91456", - "379b9204eea54b019611d98a027466a2", - "a58050a6d31744a99c4c9d667c36adbc", - "690e446b0de24b9a9e4afb40be0e04e2", - "0f96a290b44f4c3388b0df3d6ecbb43d", - "e5e9a7db20194aa482bfef109c0d651b", - "7a4e4e685fe3494a8a9b0687b27f4e31" - ] - }, - "id": "Hv2wBZXXMQ-I", - "outputId": "32b67ac6-e404-4008-fa81-78ebcb93bc1a" + "id": "Hv2wBZXXMQ-I" }, - "execution_count": 6, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "COUNT: 1/3\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - " 0%| | 0/50 [00:00