Status: reviewed # LoRA Training Guide for FLUX.1 using `flux_train_network.py` / `flux_train_network.py` を用いたFLUX.1モデルのLoRA学習ガイド This document explains how to train LoRA models for the FLUX.1 model using `flux_train_network.py` included in the `sd-scripts` repository.
日本語 このドキュメントでは、`sd-scripts`リポジトリに含まれる`flux_train_network.py`を使用して、FLUX.1モデルに対するLoRA (Low-Rank Adaptation) モデルを学習する基本的な手順について解説します。
## 1. Introduction / はじめに `flux_train_network.py` trains additional networks such as LoRA on the FLUX.1 model, which uses a transformer-based architecture different from Stable Diffusion. Two text encoders, CLIP-L and T5-XXL, and a dedicated AutoEncoder are used. This guide assumes you know the basics of LoRA training. For common options see [train_network.py](train_network.md) and [sdxl_train_network.py](sdxl_train_network.md). **Prerequisites:** * The repository is cloned and the Python environment is ready. * A training dataset is prepared. See the dataset configuration guide.
日本語 `flux_train_network.py`は、FLUX.1モデルに対してLoRAなどの追加ネットワークを学習させるためのスクリプトです。FLUX.1はStable Diffusionとは異なるアーキテクチャを持つ画像生成モデルであり、このスクリプトを使用することで、特定のキャラクターや画風を再現するLoRAモデルを作成できます。 このガイドは、基本的なLoRA学習の手順を理解しているユーザーを対象としています。基本的な使い方や共通のオプションについては、[`train_network.py`のガイド](train_network.md)を参照してください。また一部のパラメータは [`sdxl_train_network.py`](sdxl_train_network.md) と同様のものがあるため、そちらも参考にしてください。 **前提条件:** * `sd-scripts`リポジトリのクローンとPython環境のセットアップが完了していること。 * 学習用データセットの準備が完了していること。(データセットの準備については[データセット設定ガイド](link/to/dataset/config/doc)を参照してください)
## 2. Differences from `train_network.py` / `train_network.py` との違い `flux_train_network.py` is based on `train_network.py` but adapted for FLUX.1. Main differences include: * **Target model:** FLUX.1 model (dev or schnell version). * **Model structure:** Unlike Stable Diffusion, FLUX.1 uses a Transformer-based architecture with two text encoders (CLIP-L and T5-XXL) and a dedicated AutoEncoder (AE) instead of VAE. * **Required arguments:** Additional arguments for FLUX.1 model, CLIP-L, T5-XXL, and AE model files. * **Incompatible options:** Some Stable Diffusion-specific arguments (e.g., `--v2`, `--clip_skip`, `--max_token_length`) are not used in FLUX.1 training. * **FLUX.1-specific arguments:** Additional arguments for FLUX.1-specific training parameters like timestep sampling and guidance scale.
日本語 `flux_train_network.py`は`train_network.py`をベースに、FLUX.1モデルに対応するための変更が加えられています。主な違いは以下の通りです。 * **対象モデル:** FLUX.1モデル(dev版またはschnell版)を対象とします。 * **モデル構造:** Stable Diffusionとは異なり、FLUX.1はTransformerベースのアーキテクチャを持ちます。Text EncoderとしてCLIP-LとT5-XXLの二つを使用し、VAEの代わりに専用のAutoEncoder (AE) を使用します。 * **必須の引数:** FLUX.1モデル、CLIP-L、T5-XXL、AEの各モデルファイルを指定する引数が追加されています。 * **一部引数の非互換性:** Stable Diffusion向けの引数の一部(例: `--v2`, `--clip_skip`, `--max_token_length`)はFLUX.1の学習では使用されません。 * **FLUX.1特有の引数:** タイムステップのサンプリング方法やガイダンススケールなど、FLUX.1特有の学習パラメータを指定する引数が追加されています。
## 3. Preparation / 準備 Before starting training you need: 1. **Training script:** `flux_train_network.py` 2. **FLUX.1 model file:** Base FLUX.1 model `.safetensors` file (e.g., `flux1-dev.safetensors`). 3. **Text Encoder model files:** - CLIP-L model `.safetensors` file (e.g., `clip_l.safetensors`) - T5-XXL model `.safetensors` file (e.g., `t5xxl.safetensors`) 4. **AutoEncoder model file:** FLUX.1-compatible AE model `.safetensors` file (e.g., `ae.safetensors`). 5. **Dataset definition file (.toml):** TOML format file describing training dataset configuration (e.g., `my_flux_dataset_config.toml`).
日本語 学習を開始する前に、以下のファイルが必要です。 1. **学習スクリプト:** `flux_train_network.py` 2. **FLUX.1モデルファイル:** 学習のベースとなるFLUX.1モデルの`.safetensors`ファイル(例: `flux1-dev.safetensors`)。 3. **Text Encoderモデルファイル:** - CLIP-Lモデルの`.safetensors`ファイル。例として`clip_l.safetensors`を使用します。 - T5-XXLモデルの`.safetensors`ファイル。例として`t5xxl.safetensors`を使用します。 4. **AutoEncoderモデルファイル:** FLUX.1に対応するAEモデルの`.safetensors`ファイル。例として`ae.safetensors`を使用します。 5. **データセット定義ファイル (.toml):** 学習データセットの設定を記述したTOML形式のファイル。(詳細は[データセット設定ガイド](link/to/dataset/config/doc)を参照してください)。例として`my_flux_dataset_config.toml`を使用します。
## 4. Running the Training / 学習の実行 Run `flux_train_network.py` from the terminal with FLUX.1 specific arguments. Here's a basic command example: ```bash accelerate launch --num_cpu_threads_per_process 1 flux_train_network.py \ --pretrained_model_name_or_path="" \ --clip_l="" \ --t5xxl="" \ --ae="" \ --dataset_config="my_flux_dataset_config.toml" \ --output_dir="" \ --output_name="my_flux_lora" \ --save_model_as=safetensors \ --network_module=networks.lora_flux \ --network_dim=16 \ --network_alpha=1 \ --learning_rate=1e-4 \ --optimizer_type="AdamW8bit" \ --lr_scheduler="constant" \ --sdpa \ --max_train_epochs=10 \ --save_every_n_epochs=1 \ --mixed_precision="fp16" \ --gradient_checkpointing \ --guidance_scale=1.0 \ --timestep_sampling="flux_shift" \ --model_prediction_type="raw" \ --blocks_to_swap=18 \ --cache_text_encoder_outputs \ --cache_latents ``` ### Training Chroma Models If you want to train a Chroma model, specify `--model_type=chroma`. Chroma does not use CLIP-L, so the `--clip_l` argument is not needed. T5XXL and AE are same as FLUX.1. The command would look like this: ```bash accelerate launch --num_cpu_threads_per_process 1 flux_train_network.py \ --pretrained_model_name_or_path="" \ --model_type=chroma \ --t5xxl="" \ --ae="" \ --dataset_config="my_flux_dataset_config.toml" \ --output_dir="" \ --output_name="my_chroma_lora" \ --guidance_scale=0.0 \ --timestep_sampling="sigmoid" \ --apply_t5_attn_mask \ ... ``` Note that for Chroma models, `--guidance_scale=0.0` is required to disable guidance scale, and `--apply_t5_attn_mask` is needed to apply attention masks for T5XXL Text Encoder.
日本語 学習は、ターミナルから`flux_train_network.py`を実行することで開始します。基本的なコマンドラインの構造は`train_network.py`と同様ですが、FLUX.1特有の引数を指定する必要があります。 コマンドラインの例は英語のドキュメントを参照してください。 #### Chromaモデルの学習 Chromaモデルを学習したい場合は、`--model_type=chroma`を指定します。ChromaはCLIP-Lを使用しないため、`--clip_l`引数は不要です。T5XXLとAEはFLUX.1と同様です。 コマンドラインの例は英語のドキュメントを参照してください。
### 4.1. Explanation of Key Options / 主要なコマンドライン引数の解説 The script adds FLUX.1 specific arguments. For common arguments (like `--output_dir`, `--output_name`, `--network_module`, etc.), see the [`train_network.py` guide](train_network.md). #### Model-related [Required] * `--pretrained_model_name_or_path=""` **[Required]** - Specifies the path to the base FLUX.1 or Chroma model `.safetensors` file. Diffusers format directories are not currently supported. * `--model_type=` - Specifies the type of base model for training. Choose from `flux` or `chroma`. Default is `flux`. * `--clip_l=""` **[Required when flux is selected]** - Specifies the path to the CLIP-L Text Encoder model `.safetensors` file. Not needed when `--model_type=chroma`. * `--t5xxl=""` **[Required]** - Specifies the path to the T5-XXL Text Encoder model `.safetensors` file. * `--ae=""` **[Required]** - Specifies the path to the FLUX.1-compatible AutoEncoder model `.safetensors` file. #### FLUX.1 Training Parameters * `--guidance_scale=` - FLUX.1 dev version is distilled with specific guidance scale values, but for training, specify `1.0` to disable guidance scale. Default is `3.5`, so be sure to specify this. Usually ignored for schnell version. - Chroma requires `--guidance_scale=0.0` to disable guidance scale. * `--timestep_sampling=` - Specifies the sampling method for timesteps (noise levels) during training. Choose from `sigma`, `uniform`, `sigmoid`, `shift`, `flux_shift`. Default is `sigma`. Recommended is `flux_shift`. For Chroma models, `sigmoid` is recommended. * `--sigmoid_scale=` - Scale factor when `timestep_sampling` is set to `sigmoid`, `shift`, or `flux_shift`. Default and recommended value is `1.0`. * `--model_prediction_type=` - Specifies what the model predicts. Choose from `raw` (use prediction as-is), `additive` (add to noise input), `sigma_scaled` (apply sigma scaling). Default is `sigma_scaled`. Recommended is `raw`. * `--discrete_flow_shift=` - Specifies the shift value for the scheduler used in Flow Matching. Default is `3.0`. This value is ignored when `timestep_sampling` is set to other than `shift`. #### Memory/Speed Related * `--fp8_base` - Enables training in FP8 format for FLUX.1, CLIP-L, and T5-XXL. This can significantly reduce VRAM usage, but the training results may vary. * `--blocks_to_swap=` **[Experimental Feature]** - Setting to reduce VRAM usage by swapping parts of the model (Transformer blocks) between CPU and GPU. Specify the number of blocks to swap as an integer (e.g., `18`). Larger values reduce VRAM usage but decrease training speed. Adjust according to your GPU's VRAM capacity. Can be used with `gradient_checkpointing`. - Cannot be used with `--cpu_offload_checkpointing`. * `--cache_text_encoder_outputs` - Caches the outputs of CLIP-L and T5-XXL. This reduces memory usage. * `--cache_latents`, `--cache_latents_to_disk` - Caches the outputs of AE. Similar functionality to [sdxl_train_network.py](sdxl_train_network.md). #### Incompatible/Deprecated Arguments * `--v2`, `--v_parameterization`, `--clip_skip`: These are Stable Diffusion-specific arguments and are not used in FLUX.1 training. * `--max_token_length`: This is an argument for Stable Diffusion v1/v2. For FLUX.1, use `--t5xxl_max_token_length`. * `--split_mode`: Deprecated argument. Use `--blocks_to_swap` instead.
日本語 [`train_network.py`のガイド](train_network.md)で説明されている引数に加え、以下のFLUX.1特有の引数を指定します。共通の引数(`--output_dir`, `--output_name`, `--network_module`, `--network_dim`, `--network_alpha`, `--learning_rate`など)については、上記ガイドを参照してください。 コマンドラインの例と詳細な引数の説明は英語のドキュメントを参照してください。
### 4.2. Starting Training / 学習の開始 Training begins once you run the command with the required options. Log checking is the same as in [`train_network.py`](train_network.md#32-starting-the-training--学習の開始).
日本語 必要な引数を設定し、コマンドを実行すると学習が開始されます。基本的な流れやログの確認方法は[`train_network.py`のガイド](train_network.md#32-starting-the-training--学習の開始)と同様です。
## 5. Using the Trained Model / 学習済みモデルの利用 After training, a LoRA model file is saved in `output_dir` and can be used in inference environments supporting FLUX.1 (e.g. ComfyUI + Flux nodes).
日本語 学習が完了すると、指定した`output_dir`にLoRAモデルファイル(例: `my_flux_lora.safetensors`)が保存されます。このファイルは、FLUX.1モデルに対応した推論環境(例: ComfyUI + ComfyUI-FluxNodes)で使用できます。
## 6. Advanced Settings / 高度な設定 ### 6.1. VRAM Usage Optimization / VRAM使用量の最適化 FLUX.1 is a relatively large model, so GPUs without sufficient VRAM require optimization. Here are settings to reduce VRAM usage (with `--fp8_base`): #### Recommended Settings by GPU Memory | GPU Memory | Recommended Settings | |------------|---------------------| | 24GB VRAM | Basic settings work fine (batch size 2) | | 16GB VRAM | Set batch size to 1 and use `--blocks_to_swap` | | 12GB VRAM | Use `--blocks_to_swap 16` and 8bit AdamW | | 10GB VRAM | Use `--blocks_to_swap 22`, recommend fp8 format for T5XXL | | 8GB VRAM | Use `--blocks_to_swap 28`, recommend fp8 format for T5XXL | #### Key VRAM Reduction Options - **`--fp8_base`**: Enables training in FP8 format. - **`--blocks_to_swap `**: Swaps blocks between CPU and GPU to reduce VRAM usage. Higher numbers save more VRAM but reduce training speed. FLUX.1 supports up to 35 blocks for swapping. - **`--cpu_offload_checkpointing`**: Offloads gradient checkpoints to CPU. Can reduce VRAM usage by up to 1GB but decreases training speed by about 15%. Cannot be used with `--blocks_to_swap`. Chroma models do not support this option. - **Using Adafactor optimizer**: Can reduce VRAM usage more than 8bit AdamW: ``` --optimizer_type adafactor --optimizer_args "relative_step=False" "scale_parameter=False" "warmup_init=False" --lr_scheduler constant_with_warmup --max_grad_norm 0.0 ``` - **Using T5XXL fp8 format**: For GPUs with less than 10GB VRAM, using fp8 format T5XXL checkpoints is recommended. Download `t5xxl_fp8_e4m3fn.safetensors` from [comfyanonymous/flux_text_encoders](https://huggingface.co/comfyanonymous/flux_text_encoders) (use without `scaled`). - **FP8/FP16 Mixed Training [Experimental]**: Specify `--fp8_base_unet` to train the FLUX.1 model in FP8 format while training Text Encoders (CLIP-L/T5XXL) in BF16/FP16 format. This can further reduce VRAM usage.
日本語 FLUX.1モデルは比較的大きなモデルであるため、十分なVRAMを持たないGPUでは工夫が必要です。VRAM使用量を削減するための設定の詳細は英語のドキュメントを参照してください。 主要なVRAM削減オプション: - `--fp8_base`: FP8形式での学習を有効化 - `--blocks_to_swap`: CPUとGPU間でブロックをスワップ - `--cpu_offload_checkpointing`: 勾配チェックポイントをCPUにオフロード - Adafactorオプティマイザの使用 - T5XXLのfp8形式の使用 - FP8/FP16混合学習(実験的機能)
### 6.2. Important FLUX.1 LoRA Training Settings / FLUX.1 LoRA学習の重要な設定 FLUX.1 training has many unknowns, and several settings can be specified with arguments: #### Timestep Sampling Methods The `--timestep_sampling` option specifies how timesteps (0-1) are sampled: - `sigma`: Sigma-based like SD3 - `uniform`: Uniform random - `sigmoid`: Sigmoid of normal distribution random (similar to x-flux, AI-toolkit) - `shift`: Sigmoid value of normal distribution random with shift. The `--discrete_flow_shift` setting is used to shift the sigmoid value. - `flux_shift`: Shift sigmoid value of normal distribution random according to resolution (similar to FLUX.1 dev inference). `--discrete_flow_shift` only applies when `--timestep_sampling` is set to `shift`. #### Model Prediction Processing The `--model_prediction_type` option specifies how to interpret and process model predictions: - `raw`: Use as-is (similar to x-flux) **[Recommended]** - `additive`: Add to noise input - `sigma_scaled`: Apply sigma scaling (similar to SD3) #### Recommended Settings Based on experiments, the following settings work well: ``` --timestep_sampling shift --discrete_flow_shift 3.1582 --model_prediction_type raw --guidance_scale 1.0 ``` **About Guidance Scale**: FLUX.1 dev version is distilled with specific guidance scale values, but for training, specify `--guidance_scale 1.0` to disable guidance scale. `--timestep_sampling sigmoid --model_prediction_type raw --guidance_scale 0.0` is recommended for Chroma models.
日本語 FLUX.1の学習には多くの未知の点があり、いくつかの設定は引数で指定できます。詳細な説明とコマンドラインの例は英語のドキュメントを参照してください。 主要な設定オプション: - タイムステップのサンプリング方法(`--timestep_sampling`) - モデル予測の処理方法(`--model_prediction_type`) - 推奨設定の組み合わせ
### 6.3. Layer-specific Rank Configuration / 各層に対するランク指定 You can specify different ranks (network_dim) for each layer of FLUX.1. This allows you to emphasize or disable LoRA effects for specific layers. Specify the following network_args to set ranks for each layer. Setting 0 disables LoRA for that layer: | network_args | Target Layer | |--------------|--------------| | img_attn_dim | DoubleStreamBlock img_attn | | txt_attn_dim | DoubleStreamBlock txt_attn | | img_mlp_dim | DoubleStreamBlock img_mlp | | txt_mlp_dim | DoubleStreamBlock txt_mlp | | img_mod_dim | DoubleStreamBlock img_mod | | txt_mod_dim | DoubleStreamBlock txt_mod | | single_dim | SingleStreamBlock linear1 and linear2 | | single_mod_dim | SingleStreamBlock modulation | Example usage: ``` --network_args "img_attn_dim=4" "img_mlp_dim=8" "txt_attn_dim=2" "txt_mlp_dim=2" "img_mod_dim=2" "txt_mod_dim=2" "single_dim=4" "single_mod_dim=2" ``` To apply LoRA to FLUX conditioning layers, specify `in_dims` in network_args as a comma-separated list of 5 numbers: ``` --network_args "in_dims=[4,2,2,2,4]" ``` Each number corresponds to `img_in`, `time_in`, `vector_in`, `guidance_in`, `txt_in`. The example above applies LoRA to all conditioning layers with ranks of 4 for `img_in` and `txt_in`, and ranks of 2 for others.
日本語 FLUX.1の各層に対して異なるランク(network_dim)を指定できます。これにより、特定の層に対してLoRAの効果を強調したり、無効化したりできます。 詳細な設定方法とコマンドラインの例は英語のドキュメントを参照してください。
### 6.4. Block Selection for Training / 学習するブロックの指定 You can specify which blocks to train using `train_double_block_indices` and `train_single_block_indices` in network_args. Indices are 0-based. Default is to train all blocks if omitted. Specify indices as integer lists like `0,1,5,8` or integer ranges like `0,1,4-5,7`: - Double blocks: 19 blocks, valid range 0-18 - Single blocks: 38 blocks, valid range 0-37 - Specify `all` to train all blocks - Specify `none` to skip training blocks Example usage: ``` --network_args "train_double_block_indices=0,1,8-12,18" "train_single_block_indices=3,10,20-25,37" ``` Or: ``` --network_args "train_double_block_indices=none" "train_single_block_indices=10-15" ```
日本語 FLUX.1 LoRA学習では、network_argsの`train_double_block_indices`と`train_single_block_indices`を指定することで、学習するブロックを指定できます。 詳細な設定方法とコマンドラインの例は英語のドキュメントを参照してください。
### 6.5. Text Encoder LoRA Support / Text Encoder LoRAのサポート FLUX.1 LoRA training supports training CLIP-L and T5XXL LoRA: - To train only FLUX.1: specify `--network_train_unet_only` - To train FLUX.1 and CLIP-L: omit `--network_train_unet_only` - To train FLUX.1, CLIP-L, and T5XXL: omit `--network_train_unet_only` and add `--network_args "train_t5xxl=True"` You can specify individual learning rates for CLIP-L and T5XXL with `--text_encoder_lr`. For example, `--text_encoder_lr 1e-4 1e-5` sets the first value for CLIP-L and the second for T5XXL. Specifying one value uses the same learning rate for both. If `--text_encoder_lr` is not specified, the default `--learning_rate` is used for both.
日本語 FLUX.1 LoRA学習は、CLIP-LとT5XXL LoRAのトレーニングもサポートしています。 詳細な設定方法とコマンドラインの例は英語のドキュメントを参照してください。
### 6.6. Multi-Resolution Training / マルチ解像度トレーニング You can define multiple resolutions in the dataset configuration file, with different batch sizes for each resolution. Configuration file example: ```toml [general] # Common settings flip_aug = true color_aug = false keep_tokens_separator= "|||" shuffle_caption = false caption_tag_dropout_rate = 0 caption_extension = ".txt" [[datasets]] # First resolution settings batch_size = 2 enable_bucket = true resolution = [1024, 1024] [[datasets.subsets]] image_dir = "path/to/image/directory" num_repeats = 1 [[datasets]] # Second resolution settings batch_size = 3 enable_bucket = true resolution = [768, 768] [[datasets.subsets]] image_dir = "path/to/image/directory" num_repeats = 1 ```
日本語 データセット設定ファイルで複数の解像度を定義できます。各解像度に対して異なるバッチサイズを指定することができます。 設定ファイルの例は英語のドキュメントを参照してください。
### 6.7. Validation / 検証 You can calculate validation loss during training using a validation dataset to evaluate model generalization performance. To set up validation, add a `[validation]` section to your dataset configuration TOML file. Configuration is similar to training datasets, but `num_repeats` is usually set to 1. ```toml # ... (training dataset configuration) ... [validation] batch_size = 1 enable_bucket = true resolution = [1024, 1024] # Resolution for validation [[validation.subsets]] image_dir = "path/to/validation/images" num_repeats = 1 caption_extension = ".txt" # ... other validation dataset settings ... ``` **Notes:** * Validation loss calculation uses fixed timestep sampling and random seeds to reduce loss variation due to randomness for more stable evaluation. * Currently, validation loss is not supported when using `--blocks_to_swap` or Schedule-Free optimizers (`AdamWScheduleFree`, `RAdamScheduleFree`, `ProdigyScheduleFree`).
日本語 学習中に検証データセットを使用して損失 (Validation Loss) を計算し、モデルの汎化性能を評価できます。 詳細な設定方法とコマンドラインの例は英語のドキュメントを参照してください。
## 7. Additional Options / 追加オプション ### 7.1. Other FLUX.1-specific Options / その他のFLUX.1特有のオプション - **T5 Attention Mask Application**: Specify `--apply_t5_attn_mask` to apply attention masks during T5XXL Text Encoder training and inference. Not recommended due to limited inference environment support. **For Chroma models, this option is required.** - **IP Noise Gamma**: Use `--ip_noise_gamma` and `--ip_noise_gamma_random_strength` to adjust Input Perturbation noise gamma values during training. See Stable Diffusion 3 training options for details. - **LoRA-GGPO Support**: Use LoRA-GGPO (Gradient Group Proportion Optimizer) to stabilize LoRA training: ```bash --network_args "ggpo_sigma=0.03" "ggpo_beta=0.01" ``` - **Q/K/V Projection Layer Splitting [Experimental]**: Specify `--network_args "split_qkv=True"` to individually split and apply LoRA to Q/K/V (and SingleStreamBlock Text) projection layers within Attention layers.
日本語 その他のFLUX.1特有のオプション: - T5 Attention Maskの適用(Chromaモデルでは必須) - IPノイズガンマ - LoRA-GGPOサポート - Q/K/V射影層の分割(実験的機能) 詳細な設定方法とコマンドラインの例は英語のドキュメントを参照してください。
### 7.2. Dataset-related Additional Options / データセット関連の追加オプション #### Interpolation Method for Resizing You can specify the interpolation method when resizing dataset images to training resolution. Specify `interpolation_type` in the `[[datasets]]` or `[general]` section of the dataset configuration TOML file. Available values: `bicubic` (default), `bilinear`, `lanczos`, `nearest`, `area` ```toml [[datasets]] resolution = [1024, 1024] enable_bucket = true interpolation_type = "lanczos" # Example: Use Lanczos interpolation # ... ```
日本語 データセットの画像を学習解像度にリサイズする際の補間方法を指定できます。 設定方法とオプションの詳細は英語のドキュメントを参照してください。
## 8. Related Tools / 関連ツール Several related scripts are provided for models trained with `flux_train_network.py` and to assist with the training process: * **`networks/flux_extract_lora.py`**: Extracts LoRA models from the difference between trained and base models. * **`convert_flux_lora.py`**: Converts trained LoRA models to other formats like Diffusers (AI-Toolkit) format. When trained with Q/K/V split option, converting with this script can reduce model size. * **`networks/flux_merge_lora.py`**: Merges trained LoRA models into FLUX.1 base models. * **`flux_minimal_inference.py`**: Simple inference script for generating images with trained LoRA models. You can specify `flux` or `chroma` with the `--model_type` argument.
日本語 `flux_train_network.py` で学習したモデルや、学習プロセスに役立つ関連スクリプトが提供されています: * **`networks/flux_extract_lora.py`**: 学習済みモデルとベースモデルの差分から LoRA モデルを抽出 * **`convert_flux_lora.py`**: 学習した LoRA モデルを Diffusers (AI-Toolkit) 形式など他の形式に変換 * **`networks/flux_merge_lora.py`**: 学習した LoRA モデルを FLUX.1 ベースモデルにマージ * **`flux_minimal_inference.py`**: 学習した LoRA モデルを適用して画像を生成するシンプルな推論スクリプト
## 9. Others / その他 `flux_train_network.py` includes many features common with `train_network.py`, such as sample image generation (`--sample_prompts`, etc.) and detailed optimizer settings. For these features, refer to the [`train_network.py` guide](train_network.md#5-other-features--その他の機能) or the script help (`python flux_train_network.py --help`).
日本語 `flux_train_network.py`には、サンプル画像の生成 (`--sample_prompts`など) や詳細なオプティマイザ設定など、`train_network.py`と共通の機能も多く存在します。これらについては、[`train_network.py`のガイド](train_network.md#5-other-features--その他の機能)やスクリプトのヘルプ (`python flux_train_network.py --help`) を参照してください。