Skip to content

Add Flux diffusion model support#170

Open
ChuanLi1101 wants to merge 1 commit intomainfrom
feature/flux-support
Open

Add Flux diffusion model support#170
ChuanLi1101 wants to merge 1 commit intomainfrom
feature/flux-support

Conversation

@ChuanLi1101
Copy link
Collaborator

@ChuanLi1101 ChuanLi1101 commented Jan 29, 2026

Summary

Add support for Flux diffusion transformer model for image generation.

Changes

File Description
atom/models/flux.py Flux DiT transformer architecture
atom/models/flux_vae.py VAE encoder/decoder for latent space
atom/models/flux_text_encoder.py T5/CLIP text encoder wrapper
atom/model_ops/diffusion_sampler.py Flow matching sampler (Euler)
atom/model_engine/diffusion_runner.py Diffusion inference pipeline
atom/entrypoints/image_server.py OpenAI Images API server
atom/examples/simple_image_gen.py CLI example for image generation
atom/tests/test_flux.py Unit tests
atom/model_engine/model_runner.py Register FluxTransformer2DModel

Usage

# API server
python -m atom.entrypoints.image_server --model black-forest-labs/FLUX.1-dev

# CLI example  
python -m atom.examples.simple_image_gen --model black-forest-labs/FLUX.1-dev --prompt "A cat"

Test Results

  • Black/Ruff code style checks: PASSED
  • 4/6 ATOM LLM tests passed (2 failures are CI runner memory issues, not code related)

@ChuanLi1101
Copy link
Collaborator Author

ChuanLi1101 commented Jan 29, 2026

CI Test Results

Code style checks: All passed (Black, Ruff)

ATOM Tests:

  • Meta-Llama-3-8B-Instruct (1 GPU)
  • DeepSeek-R1-0528 (8 GPU)
  • Qwen3-235B-A22B-Instruct-2507-FP8 (8 GPU)
  • gpt-oss-120b (2 GPU)
  • Llama-3.3-70B-Instruct-MXFP4-Preview (1 GPU)
  • gpt-oss-120b (1 GPU)

Note: The 2 failed tests are due to insufficient GPU memory on single-GPU runners:

  • \AssertionError: need at least 2621440 KV cache\ (Llama-3.3-70B)
  • \AssertionError: need at least 589824 KV cache\ (gpt-oss-120b)

These failures are CI infrastructure issues, not related to the Flux diffusion model changes. The same tests pass on main when run on multi-GPU runners with sufficient memory.

- Add FluxTransformer model (flux.py) with DiT architecture
- Add VAE encoder/decoder (flux_vae.py)
- Add text encoder wrapper (flux_text_encoder.py)
- Add flow matching sampler (diffusion_sampler.py)
- Add diffusion model runner (diffusion_runner.py)
- Add OpenAI Images API server (image_server.py)
- Add example script (simple_image_gen.py)
- Add unit tests (test_flux.py)
- Register FluxTransformer2DModel in model_runner.py
@ChuanLi1101
Copy link
Collaborator Author

CI Test Failures - Infrastructure Issue

The two failing tests are not related to the Flux code changes in this PR:

Test Error
\Llama-3.3-70B-Instruct-MXFP4-Preview\ \AssertionError: need at least 2621440 KV cache\
\gpt-oss-120b\ \AssertionError: need at least 589824 KV cache\

Both tests are running on single GPU machines (\�tom-mi355-1gpu), but these 70B/120B models require more GPU memory than available to allocate the KV cache.

This is a CI infrastructure configuration issue - the large models need to run on multi-GPU runners instead.

Request: Could the maintainers please either:

  1. Adjust CI configuration to run these large model tests on appropriate hardware, or
  2. Skip/exclude these flaky tests for this PR

The branch has been rebased onto the latest \main. Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants