Skip to content

Instantly share code, notes, and snippets.

@sugatoray
Forked from awni/mflux_steps.md
Created August 16, 2024 03:37
Show Gist options
  • Save sugatoray/7cdf2cd4ecca3715cde4d0206a2dc4ec to your computer and use it in GitHub Desktop.
Save sugatoray/7cdf2cd4ecca3715cde4d0206a2dc4ec to your computer and use it in GitHub Desktop.

Clone the model

This can take a little while:

# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install

git clone https://huggingface.co/black-forest-labs/FLUX.1-schnell

Setup the repo

git clone [email protected]:filipstrand/mflux.git
cd mflux && pip install -r requirements.txt

Make a run script

Name this anything, maybe flux.py:

import sys
sys.path.append("/path/to/mflux/repo/src")

from flux_1_schnell.config.config import Config
from flux_1_schnell.models.flux import Flux1Schnell

flux = Flux1Schnell("path/to/model/FLUX.1-schnell/")

image = flux.generate_image(
    seed=3,
    prompt="A rocketship exactly in the style of the cartoon rocket emoji. The rocket ship is flying in the sky. The logo 'MLX' is written on the side of the ship in black letters.",
    config=Config(num_inference_steps=2)
)

image.save("/path/to/save/image.png")

Run the script

python flux.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment