Skip to content

aime-labs/flux

 
 

Repository files navigation

FLUX

by Black Forest Labs: https://blackforestlabs.ai

grid

This repo is intended to run FLUX text-to-image and image-to-image models as worker for the scalable AIME API Server.

Setup & Installation

Method1: Installation with Python venv

cd $HOME && git clone https://github.com/black-forest-labs/flux
cd $HOME/flux
python3.10 -m venv .venv
source .venv/bin/activate
pip install -e ".[all]"

Method2: Installation with AIME MLC

Use AIME MLC to install in a dockerized container.

mlc-create flux1dev Pytorch 2.4.0
mlc-open flux1dev

git clone https://github.com/black-forest-labs/flux
cd flux

sudo apt install libgl1-mesa-glx libglib2.0-0

pip install -r requirements.txt
pip install -e .

Models

These models are avaible:

  • FLUX.1 [dev] guidance-distilled variant
  • FLUX.1 [schnell] guidance and step-distilled variant
Name HuggingFace repo License md5sum
FLUX.1 [schnell] https://huggingface.co/black-forest-labs/FLUX.1-schnell apache-2.0 a9e1e277b9b16add186f38e3f5a34044
FLUX.1 [dev] https://huggingface.co/black-forest-labs/FLUX.1-dev FLUX.1-dev Non-Commercial License a6bd8c16dfc23db6aee2f63a2eba78c0

The weights of the autoencoder are also released under apache-2.0 and can be found in either of the two HuggingFace repos above. They are the same for both models.

Command Line Usage

The weights will be downloaded automatically from HuggingFace once you start one of the demos. To download FLUX.1 [dev], you will need to be logged in, see here. If you have downloaded the model weights manually, you can specify the downloaded paths via environment-variables:

export FLUX_SCHNELL=<path_to_flux_schnell_sft_file>
export FLUX_DEV=<path_to_flux_dev_sft_file>
export AE=<path_to_ae_sft_file>

For interactive sampling run

python -m flux --name <name> --loop

Or to generate a single sample run

python -m flux --name <name> \
  --height <height> --width <width> \
  --prompt "<prompt>"

Start as AIME API Worker

Run following command line:

python3 main.py --ckpt_dir {{directory where the model was downloaded}} --api_server https://{{ url to your api server}}

This will register the worker to an AIME API Server to process distributed API job requests.

About

AIME API Worker for FLUX.1 models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%