Skip to main content

Training tools and scripts for FluxFlow text-to-image generation

Project description

FluxFlow Training

Training tools and scripts for FluxFlow text-to-image generation models.

Installation

Production Install

pip install fluxflow-training

What gets installed:

  • fluxflow-training - Training scripts and configuration tools
  • fluxflow core package (automatically installed as dependency)
  • CLI commands: fluxflow-train, fluxflow-generate

Package available on PyPI: fluxflow-training v0.1.1

Development Install

git clone https://github.com/danny-mio/fluxflow-training.git
cd fluxflow-training
pip install -e ".[dev]"

🚧 Training Status

Models Currently In Training: FluxFlow is actively training models following the systematic TRAINING_VALIDATION_PLAN.md.

Current Phase: Phase 1 - VAE Training (Weeks 1-4)

Progress:

  • 🔄 Bezier VAE training in progress
  • ⏳ ReLU baseline VAE pending
  • ⏳ Flow models pending VAE completion

When Available: Trained checkpoints and empirical performance metrics will be published to MODEL_ZOO.md upon validation completion.

Note: All performance claims in documentation are theoretical targets pending empirical validation.


Hardware Requirements for Training

Current Setup (December 2025 validation):

  • GPU: NVIDIA A6000 (48GB VRAM) via Paperspace
  • Constraint: Service interrupts every 6 hours
  • Solution: Automatic checkpoint/resume (every 30-60 min)

Alternative Options:

  • Local: 1× RTX 4090 (24GB) or 2× RTX 3090 (24GB each)
  • Cloud: AWS p3.2xlarge (V100 16GB), GCP A100 (40GB)

Minimum Requirements:

  • 16GB VRAM for VAE training (batch size 2-4)
  • 24GB VRAM for Flow training (batch size 1-2)
  • 48GB VRAM enables larger batches (batch size 8+)

Cost Comparison:

Platform GPU $/hr Est. Total (500 hrs)
Paperspace A6000 48GB $0.76 ~$456
AWS p3.2xlarge (V100 16GB) $3.06 ~$1,530
GCP A100 40GB $3.67 ~$1,835
Lambda Labs A100 40GB $1.10 ~$550

Pre-download LPIPS Weights (Optional)

The training uses LPIPS for perceptual loss, which requires VGG16 weights (~528MB). To pre-download:

python -c "import lpips; lpips.LPIPS(net='vgg')"

Weights will be cached in ~/.cache/torch/hub/checkpoints/. If not pre-downloaded, they'll download automatically on first training run.

Features

  • VAE Training: Train variational autoencoders with GAN losses and LPIPS perceptual loss
  • Flow Training: Train flow-based diffusion transformers
  • Data Loading: Efficient dataset handling with WebDataset support
  • Checkpointing: Robust checkpoint management with resumability
  • Training Visualization: Automatic diagram generation for loss curves and metrics
  • Optimizers: Multiple optimizer support (AdamW, Lion, SGD)
  • Schedulers: Various learning rate schedulers
  • Mixed Precision: Accelerate training with automatic mixed precision

Quick Start

Training a Model

# Create a config file (see config.example.yaml)
fluxflow-train --config config.yaml

# With automatic diagram generation on each checkpoint
fluxflow-train --config config.yaml --generate_diagrams

Generating Images

# Create a directory with .txt files containing prompts
mkdir prompts
echo "a beautiful sunset over mountains" > prompts/sunset.txt

# Generate images
fluxflow-generate \
    --model_checkpoint path/to/checkpoint.safetensors \
    --text_prompts_path prompts/ \
    --output_path outputs/

Visualizing Training Progress

# Training metrics are automatically logged to outputs/graph/training_metrics.jsonl

# Generate diagrams from logged metrics
python src/fluxflow_training/scripts/generate_training_graphs.py outputs/

# Diagrams are saved to outputs/graph/:
# - training_losses.png (VAE, Flow, Discriminator, Generator, LPIPS)
# - kl_loss.png (KL divergence with beta warmup)
# - learning_rates.png (LR schedules)
# - batch_times.png (training speed)
# - training_overview.png (combined overview)
# - training_summary.txt (statistics)

Package Contents

  • fluxflow_training.training - Training logic and trainers
  • fluxflow_training.data - Dataset implementations and transforms
  • fluxflow_training.scripts - CLI scripts for training and generation

Configuration

Training is configured via YAML files. See docs/TRAINING_GUIDE.md for detailed configuration options.

Example:

model:
  vae_dim: 128
  feature_maps_dim: 128
  text_embedding_dim: 1024

data:
  data_path: "/path/to/images"
  captions_file: "/path/to/captions.txt"  # image_name<tab>caption
  fixed_prompt_prefix: null  # Optional: e.g., "style anime" to prepend to all prompts
  img_size: 1024
  reduced_min_sizes: null  # Optional: [128, 256, 512]

training:
  n_epochs: 100
  batch_size: 1
  lr: 0.00001
  train_vae: true
  use_fp16: false

output:
  output_path: "outputs/flux"
  log_interval: 10
  checkpoint_save_interval: 50
  sample_sizes:  # Optional: generate samples at various sizes
    - 512
    - [768, 512]  # landscape
    - 1024

Documentation

Training Guide: See docs/TRAINING_GUIDE.md for:

  • Detailed configuration options
  • Dataset preparation
  • Training strategies
  • Troubleshooting

Links

License

MIT License - see LICENSE file for details.

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

fluxflow_training-0.1.1.tar.gz (72.4 kB view details)

Uploaded Source

Built Distribution

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

fluxflow_training-0.1.1-py3-none-any.whl (61.3 kB view details)

Uploaded Python 3

File details

Details for the file fluxflow_training-0.1.1.tar.gz.

File metadata

  • Download URL: fluxflow_training-0.1.1.tar.gz
  • Upload date:
  • Size: 72.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fluxflow_training-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2a41065193ac1786f1af690944a9ad7a07aab3dc21bf4d11e0fa2754d9615a79
MD5 69e0fb6449a3b659180b20e2da8c0c4d
BLAKE2b-256 38ff4462b3b3a96d6df582f4a266ec981c145ea96ba6235a7ef62b8efd5a2382

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxflow_training-0.1.1.tar.gz:

Publisher: ci.yml on danny-mio/fluxflow-training

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fluxflow_training-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fluxflow_training-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 861c111799a414dcefca50e12951a75cdf622d2759a950089e77b681d7cd538c
MD5 529f4506c2268a11e86d48b1539ceac4
BLAKE2b-256 9ea3e40bbf3c58b24e8f40aeb38206131175ba6384955f2e622d61624946efa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxflow_training-0.1.1-py3-none-any.whl:

Publisher: ci.yml on danny-mio/fluxflow-training

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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