Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save esmevane/3f864f34520da7677a29aea7bcf76639 to your computer and use it in GitHub Desktop.
Save esmevane/3f864f34520da7677a29aea7bcf76639 to your computer and use it in GitHub Desktop.
guide to installing disco v5+ locally on windows

Install Disco Diffusion v5 for Windows

NOTE: Pytorch3d no longer has to be compiled i have stripped out the function we use to make this a lot easier and also so we do not have to use WSL2 with linux and can now run directly on your windows system.

Comments section is not checked often for issues please join the disco diffusion discord for assistance

https://discord.gg/mK4AneuycS

You may now use the official disco diffusion notebook with this tutorial as it has been uodated to reflect the changes here for better cross platform support

This will walk you through getting your environment setup to run most of the GANs with Anaconda as a Virtual Python Environment.

System Requirements:

  OS: Windows (11/10/8/7), Ubuntu(19,20)
  GPU: Nvidia (AMD hasnt been tested)
  VRAM: 12gb+

1) Download Tools!

  1. A) Cuda enabled GPU
  1. B) Python (Anaconda)
  1. C) Git
    • https://git-scm.com/downloads
    • version control manager for code
    • we just use it to download repos from GitHub
    • Must be on system PATH, When installing select the option add to system PATH
  1. D) FFmpeg
  1. E) ImageMagick
  1. F) Wget
    • used to download models for projects
    • Windows users need this verison
      • https://eternallybored.org/misc/wget/
      • (spoiler) Add to Path on Windows (spoiler)
      • download the .exe
      • create a new folder to put the .exe in (prefereable on the root of your C:/ drive)
        • e.g C:/wget/wget.exe
      • open Control Panel and search for environment variables
      • select the one with the shield icon Edit the system environment variables
      • click the button at the bottom Environment Virables...
      • under System variables find the and select the path variable
      • click Edit... button and then New
        • add the new path to folder the .exe is in
        • e.g C:/wget
      • once entered click Ok on each window until all 3 are closed
      • for the new env variables to be used you must reopen a new Command Prompt window
    • Linux users can just use the package in their distributions
  1. G) cURL
    • used to download models, some projects use this instead of wget
    • Latest versions of windows have cURL pre installed
    • Older versions that dont include cURL use this one
    • Linux users can just use the package in their distributions

2) Install Disco Dependencies

  1. A) Setup and activate conda env
    • conda create --name disco-diffusion python=3.9
    • conda activate disco-diffusion
  1. B) Install a few more pip dependencies
    • pip install ipykernel opencv-python pandas regex matplotlib ipywidgets
  1. C) Install Pytorch with CUDA support!
  1. D) Download disco diffusion repo!
    • git clone https://github.com/alembics/disco-diffusion.git
    • change directories into the downloaded repo
      • cd disco-diffusion

3) Run Disco Diffusion

there are several ways to run disco diffusion at this point:

1. [PYTHON .py]

plain python file wich means you will need to go into the file and manually find all the configuration options and change them as needed, an easy way to go about this is searching the document for #@param lines and edit ones containing that comment trailing the lines e.g. use_secondary_model = True #@param {type: 'boolean'}.

  • Run disco diffusion
    • python -m disco.py

2-3. [VS .py/.ipynb]

running the .ipynb file directly in VS also requires editing of the #@param lines in the code

4-5. [VS + Jupyter extension .py/.ipynb]

using the jupyter extension in VS we can get individual cell support to run the either the .ipynb or the .py file also requires editing of the #@param lines in the code

  • Download Visual Studio
  • Get the Jupyter Notebook extensions
    • head over the to the extensions tab in VS code
    • search for jupyter and install the one from Microsoft
    • after this is enabled the notebook should have several new toolbars and features
      • you can actually run both the .py file or .ipynb file which both support individual cells
    • ENJOY!

6. [Jupyter .ipynb]

using Jupyter notebooks to run the .ipynb file also requires editing of the #@param lines in the code

  • with anaconda installed you should already have jupyter notebook installed if you dont simple run:
    pip install jupyterlab
  • Run Jupyter
    • jupyter notebook
      • this launches the juptyer notebook in the current directory and open a webpage
    • under the Files tab double click and open the file named Disco-Diffusion.ipynb
    • ENJOY!

7. [Colab w/ Jupyter using colab links]

using Google Colab as a front end to get the nice view of all the editable fields while using Jupyter as middleware to connect your local resources

  • with anaconda installed you should already have jupyter notebook installed if you dont simple run:
    pip install jupyterlab
  • Connect to colab front end
    • pip install --upgrade jupyter_http_over_ws>=0.0.7
    • Enable the extension for jupyter
      • jupyter serverextension enable --py jupyter_http_over_ws
    • Start the jupyter server
      • jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0 --no-browser
    • Inside google colab click the down Arrow icon next to the Connect button to view more options
    • Select connect to Local Runtime and enter the Local Host Url that was printed in the console when we started jupyter server
    • ENJOY!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment