Giter VIP home page Giter VIP logo

generative-tasks-through-stable-diffusion's Introduction

The following repository is an implementation of the diffusers library by hugging face and more particularly the pre trained stable diffusion models.

Stable.Diffusion.Demo.mp4

Generated images

Darth Vader f1

Anakin vs Darth Vader on Mustafar

Diffusers Library by Hugging Face

The diffusers library by Hugging Face is a powerful tool for implementing diffusion models which are a class of generative models that leverage the concept of diffusion processes to generate high-quality samples. This repo contains the implementation of the Text to Image and Image to Image tasks through stable diffusion models.

Note: For all the pretrained models, I have set the value of safety_checker to None. The documentation does not advice to this, however, I was getting an error Potential NSFW content was detected in one or more images. A black image will be returned instead. Try again with a different prompt and/or seed. and changed the variable as per this issue

Installation

  1. Clone this repository
git clone https://github.com/Dhruv16S/Generative-Tasks-through-Stable-Diffusion.git
  1. Install required dependencies through
pip install -r requirements.txt
  1. Create a file called auth_token.py and define a variable token=<INSERT HUGGING FACE TOKEN HERE>. Specify the user access token in <>. To create a user access token follow the instructions here. Ensure you have a hugging face account before generating your token.

  2. Run the application

python app.py

Debugging

If "AssertionError: Torch not compiled with CUDA enabled is encountered, follow the below steps:

  1. Run the following command in the same directory
python check_config.py

check the torch version and if CUDA is enabled

  1. Make sure you have a compatible NVIDIA GPU and have installed the corresponding CUDA toolkit. You can find the CUDA toolkit version compatible with your GPU on the NVIDIA website

  2. Run the following command

pip uninstall torch torchvision -y
  1. Install PyTorch with CUDA support by following the instructions (here)[https://pytorch.org/get-started/locally/]. The following command worked for me:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  1. Re run the flask application
python app.py

generative-tasks-through-stable-diffusion's People

Contributors

dhruv16s avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.