Skip to main content

Easily create your own AI avatar images!

Project description

Py-Dreambooth


Samples Py-Dreambooth is a Python package that makes it easy to create AI avatar images from photos of you, your family, friends, or pets!

  1. Tasks are pre-configured with the most efficient defaults, which greatly streamlines the workload. A number of helper functions are also provided.
  2. This is designed to be modular and extensible to many different models. Currently supported models are the Stable Diffusion Dreambooth, Stable Diffusion Dreambooth LoRA, and Stable Diffusion XL Dreambooth LoRA.
  3. This is designed to give you the flexibility to choose local or cloud resources to train your model and generate images.

⚙️ How to Install


pip install py-dreambooth

🚀 Quick Start


  • Prepare about 10-20 high-quality solo selfie photos (jpg or png) and put them in a specific directory.
  • Please run on a machine with a GPU of 16GB or more. (If you're fine-tuning SDXL, you'll need 24GB of VRAM.)
from py_dreambooth.dataset import LocalDataset
from py_dreambooth.model import SdDreamboothModel
from py_dreambooth.trainer import LocalTrainer
from py_dreambooth.utils.image_helpers import display_images
from py_dreambooth.utils.prompt_helpers import make_prompt

DATA_DIR = "data"  # The directory where you put your prepared photos
OUTPUT_DIR = "models"  

dataset = LocalDataset(DATA_DIR)
dataset = dataset.preprocess_images(detect_face=True)

SUBJECT_NAME = "<YOUR-NAME>"  
CLASS_NAME = "person"

model = SdDreamboothModel(subject_name=SUBJECT_NAME, class_name=CLASS_NAME)
trainer = LocalTrainer(output_dir=OUTPUT_DIR)

predictor = trainer.fit(model, dataset)

# Use the prompt helper to create an awesome AI avatar!
prompt = next(make_prompt(SUBJECT_NAME, CLASS_NAME))

images = predictor.predict(
    prompt, height=768, width=512, num_images_per_prompt=2,
)

display_images(images, fig_size=10)

🏃‍♀️ Tutorials


📚 Documentation


References


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-dreambooth-0.2.7.tar.gz (73.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_dreambooth-0.2.7-py2.py3-none-any.whl (81.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file py-dreambooth-0.2.7.tar.gz.

File metadata

  • Download URL: py-dreambooth-0.2.7.tar.gz
  • Upload date:
  • Size: 73.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for py-dreambooth-0.2.7.tar.gz
Algorithm Hash digest
SHA256 0dfeb338e1df4700067c32e72b8afc2ae67670848dc431ee4ed2d40a796e0f7e
MD5 a6edf0759403e4624795d798258f2cf1
BLAKE2b-256 3632a47ac3d3a80db302d5e4d2c03465fc50f03a83d33df9d04cbf6fa6ed995b

See more details on using hashes here.

File details

Details for the file py_dreambooth-0.2.7-py2.py3-none-any.whl.

File metadata

  • Download URL: py_dreambooth-0.2.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for py_dreambooth-0.2.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 09cd479bc6f0e527d1ef3b90485e583e54c4f8e48a4f29b45420784c79f1db60
MD5 fe93903d16079a6802fd82563745f574
BLAKE2b-256 d3cf6a69c220eabe86f52e37198d0279c2ec44a504a68cad429d9ac1df846e43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page