Conversation
There was a problem hiding this comment.
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 | |||
lightx2v/models/networks/flux2_klein/infer/transformer_infer.py
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,15 @@ | |||
| #!/bin/bash | |||
| lightx2v_path=/mnt/afs1/wangshankun/LightX2V | |||
| model_path="/data/temp/FLUX.2-klein-9B" | |||
There was a problem hiding this comment.
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.
| 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" \ |
There was a problem hiding this comment.
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.
| --prompt "A cat dressed like a wizard" \ | |
| --image_path "${IMAGE_PATH:-${lightx2v_path}/save_results/flux2_klein_distill.png}" \ |
No description provided.