dreambooth-training
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.6%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: bhuvvaan
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 43.1 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
If running on GCP use the following configurations for your VM instance, Deep Learning VM for PyTorch 2.3 with CUDA 12.1, M125, Debian 11, Python 3.10, with PyTorch 2.3 and fast.ai preinstalled
Training data for dreambooth needs to be on Huggingface Hub for easy access from any system. The dataset used in the code below is at https://huggingface.co/datasets/bhuv1-c/valid-warehouses-dataset.
```bash
!/bin/bash
Clone the diffusers repository
git clone https://github.com/bhuvvaan/dreambooth-training.git
cd dreambooth-training
Create a virtual environment
python3 -m venv diffusion-venv
Activate the virtual environment
source diffusion-venv/bin/activate
Install the diffusers package
pip install .
Install accelerate
pip install accelerate
Configure accelerate
accelerate config
cd examples/dreambooth
Install requirements for the dreambooth example
pip install -U -r requirements.txt
Login to Hugging Face
huggingface-cli login --token #your token here
export MODELNAME="CompVis/stable-diffusion-v1-4" # Model on the hub export INSTANCEHFREPO="bhuv1-c/fruits-for-intent" # Dataset on the hub export INSTANCEDIR="fruits-for-intent" # Local dataset directory export OUTPUT_DIR="md-intent-prediction-data-2" # Output folder on the hub
Download dataset from Hugging Face Hub (only images)
python3 <<EOF import os from huggingfacehub import snapshotdownload
Download all files
repodir = snapshotdownload( repoid="bhuv1-c/fruits-for-intent", # Correct string format localdir="fruits-for-intent", repotype="dataset", localdirusesymlinks=False # Prevents extra cache files )
Filter only image files
validexts = {'.png', '.jpg', '.jpeg', '.bmp', '.gif', '.webp'} for root, _, files in os.walk(repodir): for file in files: if not any(file.lower().endswith(ext) for ext in valid_exts): os.remove(os.path.join(root, file)) # Delete non-image files
Check if dataset is present before training
imagefiles = [f for f in os.listdir(repodir) if f.lower().endswith(tuple(validexts))] if not imagefiles: print("Error: No images found in dataset. Exiting.") exit(1)
print("Dataset downloaded and cleaned successfully!") EOF
Ensure dataset exists before proceeding
if [ ! -d "$INSTANCEDIR" ]; then echo "Error: Dataset folder '$INSTANCEDIR' does not exist!" exit 1 fi
Remove any .cache directories
if [ -d "$INSTANCEDIR/.cache" ]; then rm -rf "$INSTANCEDIR/.cache" echo "Removed .cache directory." fi
Run training
accelerate launch traindreambooth.py \ --pretrainedmodelnameorpath=$MODELNAME \ --instancedatadir=$INSTANCEDIR \ --outputdir=$OUTPUTDIR \ --traintextencoder \ --instanceprompt="a close-up photo of an apple, two lemon, one lime, one onion, three oranges and pear on a rustic wooden table"\ --classprompt="fruits on table" \ --resolution=256 \ --trainbatchsize=1 \ --gradientaccumulationsteps=4 \ --learningrate=3e-6 \ --lrscheduler="constant" \ --lrwarmupsteps=0 \ --maxtrainsteps=800 \ --pushto_hub
```
Hyperparameters can be changed according to the users convenience. A helpful guide on hyperparameters can be found at https://huggingface.co/blog/dreambooth.
For original diffusers readme, refer to https://github.com/huggingface/diffusers
Owner
- Login: bhuvvaan
- Kind: user
- Repositories: 1
- Profile: https://github.com/bhuvvaan
Citation (CITATION.cff)
cff-version: 1.2.0
title: 'Diffusers: State-of-the-art diffusion models'
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Patrick
family-names: von Platen
- given-names: Suraj
family-names: Patil
- given-names: Anton
family-names: Lozhkov
- given-names: Pedro
family-names: Cuenca
- given-names: Nathan
family-names: Lambert
- given-names: Kashif
family-names: Rasul
- given-names: Mishig
family-names: Davaadorj
- given-names: Dhruv
family-names: Nair
- given-names: Sayak
family-names: Paul
- given-names: Steven
family-names: Liu
- given-names: William
family-names: Berman
- given-names: Yiyi
family-names: Xu
- given-names: Thomas
family-names: Wolf
repository-code: 'https://github.com/huggingface/diffusers'
abstract: >-
Diffusers provides pretrained diffusion models across
multiple modalities, such as vision and audio, and serves
as a modular toolbox for inference and training of
diffusion models.
keywords:
- deep-learning
- pytorch
- image-generation
- hacktoberfest
- diffusion
- text2image
- image2image
- score-based-generative-modeling
- stable-diffusion
- stable-diffusion-diffusers
license: Apache-2.0
version: 0.12.1
GitHub Events
Total
- Push event: 25
- Fork event: 1
Last Year
- Push event: 25
- Fork event: 1