Skip to content

Dev/flux2 klein#960

Merged
helloyongyang merged 7 commits intomainfrom
dev/flux2_klein
Mar 27, 2026
Merged

Dev/flux2 klein#960
helloyongyang merged 7 commits intomainfrom
dev/flux2_klein

Conversation

@wangshankun
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the flux2_klein model, implementing its transformer architecture, Qwen3-based text encoder, VAE, and scheduler to support both text-to-image and image-to-image tasks. The integration includes new configuration files, inference scripts, and runner logic. Feedback identifies a potential AttributeError on non-CUDA devices, several copy-paste errors in comments and docstrings, and style improvements such as avoiding wildcard imports. Additionally, it is recommended to replace assertions with explicit error handling for production stability and to enhance script portability by parameterizing hardcoded absolute paths.

@@ -0,0 +1,12 @@
# LongCat Image Infer
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment # LongCat Image Infer appears to be a copy-paste error. This file is part of the flux2_klein model, so the comment should reflect that for better clarity and accuracy.

Suggested change
# LongCat Image Infer
# Flux2Klein Infer

@@ -0,0 +1,15 @@
#!/bin/bash
lightx2v_path=/mnt/afs1/wangshankun/LightX2V
model_path="/data/temp/FLUX.2-klein-9B"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding absolute paths like /data/temp/FLUX.2-klein-9B can cause issues when the script is run in different environments. Consider making this path configurable, for example, by using an environment variable or a command-line argument.

Suggested change
model_path="/data/temp/FLUX.2-klein-9B"
model_path="${MODEL_PATH:-/data/temp/FLUX.2-klein-9B}"

--model_cls flux2_klein \
--task i2i \
--model_path $model_path \
--prompt "A cat dressed like a wizard" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The image_path is constructed using a hardcoded lightx2v_path. This makes the script less portable. Consider making this path configurable, perhaps relative to the script or via an environment variable.

Suggested change
--prompt "A cat dressed like a wizard" \
--image_path "${IMAGE_PATH:-${lightx2v_path}/save_results/flux2_klein_distill.png}" \

@helloyongyang helloyongyang merged commit 11678e1 into main Mar 27, 2026
2 checks passed
@helloyongyang helloyongyang deleted the dev/flux2_klein branch March 27, 2026 06:16
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.

2 participants