Giter Site home page Giter Site logo

dagger-ai's Introduction

๐ŸŒธ Fine-tuning Stable Diffusion using LoRA with Dagger

This example shows how to create brand assets for merchandise from some screenshots of a brand's website:

dagger-stable-diffusion-lora

It's implemented as a Stable Diffusion LoRA pipeline using Dagger: pipelines as (python) code.

  • Go to lambdalabs.com, or any other GPU provider of your choice (the instructions below were tested on Lambda)
  • Get an instance (e.g. A100 or A10). Min GPU memory is 16GB, tested on 24GB
  • Hit up Jupyter (or SSH in, but Jupyter makes viewing the outputs easier ๐Ÿ˜Š)

๐Ÿ‹ New terminal, add user to docker group

sudo adduser ubuntu docker
sudo su - ubuntu

๐Ÿ Install newer Python

sudo add-apt-repository ppa:deadsnakes/ppa

Press enter to install the PPA.

sudo apt install -y socat python3.10-venv
python3.10 -m virtualenv venv
. venv/bin/activate
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

๐Ÿš€ Install Dagger CLI

( cd /usr/local ; curl -L https://dl.dagger.io/dagger/install.sh | sudo sh )

โš™๏ธ Check out repo and configure it

git clone https://github.com/lukemarsden/dagger-stable-diffusion-lora
cd dagger-stable-diffusion-lora
pip install -r requirements.txt
cp config.yml.sample config.yml

Now open dagger-stable-diffusion-lora/config.yml in the Jupyter editor and change anything you like.

๐Ÿš‚ Train some LoRAs!

Back in the first terminal, run:

export _EXPERIMENTAL_DAGGER_INTERACTIVE_TUI=1
dagger run python lora.py

Now go and have lunch while you pull docker images & train some LoRAs ๐Ÿ˜Š

...

If you're curious to watch the progress, in another terminal tab, do sudo docker ps and sudo docker logs -f <container_id> for some of the running jobs.

Welcome back, check out output/inference to see the results!

๐Ÿƒ Observe the dagger cache making things faster

Now uncomment some of the prompts and/or brands in the config.yml and re-run, note how the Dagger cache saves you from having to redo any work that it's already done!

๐Ÿ’ธ Remember to shut down your GPU

If you like keeping your money!

dagger-ai's People

Contributors

lukemarsden avatar vikram-dagger avatar samalba 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.