> 📝 Click on the language section to expand / 蚀語をクリックしお展開 ## Dataset Configuration Please create a TOML file for dataset configuration. Image and video datasets are supported. The configuration file can include multiple datasets, either image or video datasets, with caption text files or metadata JSONL files. The cache directory must be different for each dataset. Each video is extracted frame by frame without additional processing and used for training. It is recommended to use videos with a frame rate of 24fps for HunyuanVideo, 16fps for Wan2.1 and 30fps for FramePack. You can check the videos that will be trained using `--debug_mode video` when caching latent (see [here](/README.md#latent-caching)).
日本語 デヌタセットの蚭定を行うためのTOMLファむルを䜜成しおください。 画像デヌタセットず動画デヌタセットがサポヌトされおいたす。蚭定ファむルには、画像たたは動画デヌタセットを耇数含めるこずができたす。キャプションテキストファむルたたはメタデヌタJSONLファむルを䜿甚できたす。 キャッシュディレクトリは、各デヌタセットごずに異なるディレクトリである必芁がありたす。 動画は远加のプロセスなしでフレヌムごずに抜出され、孊習に甚いられたす。そのため、HunyuanVideoは24fps、Wan2.1は16fps、FramePackは30fpsのフレヌムレヌトの動画を䜿甚するこずをお勧めしたす。latentキャッシュ時の`--debug_mode video`を䜿甚するず、孊習される動画を確認できたす[こちら](/README.ja.md#latentの事前キャッシュ)を参照。
### Sample for Image Dataset with Caption Text Files ```toml # resolution, caption_extension, batch_size, num_repeats, enable_bucket, bucket_no_upscale should be set in either general or datasets # otherwise, the default values will be used for each item # general configurations [general] resolution = [960, 544] caption_extension = ".txt" batch_size = 1 enable_bucket = true bucket_no_upscale = false [[datasets]] image_directory = "/path/to/image_dir" cache_directory = "/path/to/cache_directory" num_repeats = 1 # optional, default is 1. Number of times to repeat the dataset. Useful to balance the multiple datasets with different sizes. # multiple_target = true # optional, default is false. Set to true for Qwen-Image-Layered training. # other datasets can be added here. each dataset can have different configurations ``` `image_directory` is the directory containing images. The captions are stored in text files with the same filename as the image, but with the extension specified by `caption_extension` (for example, `image1.jpg` and `image1.txt`). `cache_directory` is optional, default is None to use the same directory as the image directory. However, we recommend to set the cache directory to avoid accidental sharing of the cache files between different datasets. `num_repeats` is also available. It is optional, default is 1 (no repeat). It repeats the images (or videos) that many times to expand the dataset. For example, if `num_repeats = 2` and there are 20 images in the dataset, each image will be duplicated twice (with the same caption) to have a total of 40 images. It is useful to balance the multiple datasets with different sizes. For Qwen-Image-Layered training, set `multiple_target = true`. Also, in the `image_directory`, for each "image to be trained + segmentation (layer) results" combination, store the following (if `caption_extension` is `.txt`): |Item|Example|Note| |---|---|---| |Caption file|`image1.txt`| | |Image to be trained (image to be layered)|`image1.png`| | |Segmentation (layer) result images|`image1_1.png`, `image1_2.png`, ...|Alpha channel required| The next combination would be stored as `/path/to/layer_images/image2.txt` for caption, and `/path/to/layer_images/image2.png`, `/path/to/layer_images/image2_0.png`, `/path/to/layer_images/image2_1.png` for images.
日本語 `image_directory`は画像を含むディレクトリのパスです。キャプションは、画像ず同じファむル名で、`caption_extension`で指定した拡匵子のテキストファむルに栌玍しおください䟋`image1.jpg`ず`image1.txt`。 `cache_directory` はオプションです。デフォルトは画像ディレクトリず同じディレクトリに蚭定されたす。ただし、異なるデヌタセット間でキャッシュファむルが共有されるのを防ぐために、明瀺的に別のキャッシュディレクトリを蚭定するこずをお勧めしたす。 `num_repeats` はオプションで、デフォルトは 1 です繰り返しなし。画像や動画を、その回数だけ単玔に繰り返しおデヌタセットを拡匵したす。たずえば`num_repeats = 2`ずしたずき、画像20枚のデヌタセットなら、各画像が2枚ず぀同䞀のキャプションで蚈40枚存圚した堎合ず同じになりたす。異なるデヌタ数のデヌタセット間でバランスを取るために䜿甚可胜です。 resolution, caption_extension, batch_size, num_repeats, enable_bucket, bucket_no_upscale は general たたは datasets のどちらかに蚭定しおください。省略時は各項目のデフォルト倀が䜿甚されたす。 `[[datasets]]`以䞋を远加するこずで、他のデヌタセットを远加できたす。各デヌタセットには異なる蚭定を持おたす。 Qwen-Image-Layeredの孊習の堎合、`multiple_target = true`を蚭定しおください。たた、`image_directory`内に、それぞれの「孊習する画像分割結果」組み合わせごずに、以䞋を栌玍しおください`caption_extension`が`.txt`の堎合。 |項目|䟋|備考| |---|---|---| |キャプションファむル|`image1.txt`| | |孊習する画像分割察象の画像|`image1.png`| | |分割結果のレむダヌ画像矀|`image1_1.png`, `image1_2.png`, ...|アルファチャンネル必須| 次の組み合わせは、`/path/to/layer_images/image2.txt`に察しお、`/path/to/layer_images/image2.png`, `/path/to/layer_images/image2_0.png`, `/path/to/layer_images/image2_1.png`のように栌玍したす。
### Sample for Image Dataset with Metadata JSONL File ```toml # resolution, batch_size, num_repeats, enable_bucket, bucket_no_upscale should be set in either general or datasets # caption_extension is not required for metadata jsonl file # cache_directory is required for each dataset with metadata jsonl file # general configurations [general] resolution = [960, 544] batch_size = 1 enable_bucket = true bucket_no_upscale = false [[datasets]] image_jsonl_file = "/path/to/metadata.jsonl" cache_directory = "/path/to/cache_directory" # required for metadata jsonl file num_repeats = 1 # optional, default is 1. Same as above. # multiple_target = true # optional, default is false. Set to true for Qwen-Image-Layered training. # other datasets can be added here. each dataset can have different configurations ``` JSONL file format for metadata: ```json {"image_path": "/path/to/image1.jpg", "caption": "A caption for image1"} {"image_path": "/path/to/image2.jpg", "caption": "A caption for image2"} ``` For Qwen-Image-Layered training, set `multiple_target = true`. Also, in the metadata JSONL file, for each "image to be trained + segmentation (layer) results" combination, specify the image paths with numbered attributes like `image_path_0`, `image_path_1`, etc. ```json {"image_path_0": "/path/to/image1_base.png", "image_path_1": "/path/to/image1_layer1.png", "image_path_2": "/path/to/image1_layer2.png", "caption": "A caption for image1"} {"image_path_0": "/path/to/image2_base.png", "image_path_1": "/path/to/image2_layer1.png", "image_path_2": "/path/to/image2_layer2.png", "caption": "A caption for image2"} ```
日本語 resolution, batch_size, num_repeats, enable_bucket, bucket_no_upscale は general たたは datasets のどちらかに蚭定しおください。省略時は各項目のデフォルト倀が䜿甚されたす。 metadata jsonl ファむルを䜿甚する堎合、caption_extension は必芁ありたせん。たた、cache_directory は必須です。 キャプションによるデヌタセットず同様に、耇数のデヌタセットを远加できたす。各デヌタセットには異なる蚭定を持おたす。 Qwen-Image-Layeredの孊習の堎合、`multiple_target = true`を蚭定しおください。たた、metadata jsonl ファむル内で、各画像に察しお耇数のタヌゲット画像を指定する堎合は、`image_path_0`, `image_path_1`のように数字を付䞎しおください。
### Sample for Video Dataset with Caption Text Files ```toml # Common parameters (resolution, caption_extension, batch_size, num_repeats, enable_bucket, bucket_no_upscale) # can be set in either general or datasets sections # Video-specific parameters (target_frames, frame_extraction, frame_stride, frame_sample, max_frames, source_fps) # must be set in each datasets section # general configurations [general] resolution = [960, 544] caption_extension = ".txt" batch_size = 1 enable_bucket = true bucket_no_upscale = false [[datasets]] video_directory = "/path/to/video_dir" cache_directory = "/path/to/cache_directory" # recommended to set cache directory target_frames = [1, 25, 45] frame_extraction = "head" source_fps = 30.0 # optional, source fps for videos in the directory, decimal number [[datasets]] video_directory = "/path/to/video_dir2" cache_directory = "/path/to/cache_directory2" # recommended to set cache directory frame_extraction = "full" max_frames = 45 # other datasets can be added here. each dataset can have different configurations ``` `video_directory` is the directory containing videos. The captions are stored in text files with the same filename as the video, but with the extension specified by `caption_extension` (for example, `video1.mp4` and `video1.txt`). __In HunyuanVideo and Wan2.1, the number of `target_frames` must be "N\*4+1" (N=0,1,2,...).__ Otherwise, it will be truncated to the nearest "N*4+1". In FramePack, it is recommended to set `frame_extraction` to `full` and `max_frames` to a sufficiently large value, as it can handle longer videos. However, if the video is too long, an Out of Memory error may occur during VAE encoding. The videos in FramePack are trimmed to "N * latent_window_size * 4 + 1" frames (for example, 37, 73, 109... if `latent_window_size` is 9). If the `source_fps` is specified, the videos in the directory are considered to be at this frame rate, and some frames will be skipped to match the model's frame rate (24 for HunyuanVideo and 16 for Wan2.1). __The value must be a decimal number, for example, `30.0` instead of `30`.__ The skipping is done automatically and does not consider the content of the images. Please check if the converted data is correct using `--debug_mode video`. If `source_fps` is not specified (default), all frames of the video will be used regardless of the video's frame rate.
日本語 共通パラメヌタresolution, caption_extension, batch_size, num_repeats, enable_bucket, bucket_no_upscaleは、generalたたはdatasetsのいずれかに蚭定できたす。 動画固有のパラメヌタtarget_frames, frame_extraction, frame_stride, frame_sample, max_frames, source_fpsは、各datasetsセクションに蚭定する必芁がありたす。 `video_directory`は動画を含むディレクトリのパスです。キャプションは、動画ず同じファむル名で、`caption_extension`で指定した拡匵子のテキストファむルに栌玍しおください䟋`video1.mp4`ず`video1.txt`。 __HunyuanVideoおよびWan2.1では、target_framesの数倀は「N\*4+1」である必芁がありたす。__ これ以倖の倀の堎合は、最も近いN\*4+1の倀に切り捚おられたす。 FramePackでも同様ですが、FramePackでは動画が長くおも孊習可胜なため、 `frame_extraction`に`full` を指定し、`max_frames`を十分に倧きな倀に蚭定するこずをお勧めしたす。ただし、あたりにも長すぎるずVAEのencodeでOut of Memory゚ラヌが発生する可胜性がありたす。FramePackの動画は、「N * latent_window_size * 4 + 1」フレヌムにトリミングされたすlatent_window_sizeが9の堎合、37、73、109  。 `source_fps`を指定した堎合、ディレクトリ内の動画をこのフレヌムレヌトずみなしお、モデルのフレヌムレヌトにあうようにいく぀かのフレヌムをスキップしたすHunyuanVideoは24、Wan2.1は16。__小数点を含む数倀で指定しおください。__ 䟋`30`ではなく`30.0`。スキップは機械的に行われ、画像の内容は考慮したせん。倉換埌のデヌタが正しいか、`--debug_mode video`で確認しおください。 `source_fps`を指定しない堎合、動画のフレヌムは動画自䜓のフレヌムレヌトに関係なくすべお䜿甚されたす。 他の泚意事項は画像デヌタセットず同様です。
### Sample for Video Dataset with Metadata JSONL File ```toml # Common parameters (resolution, caption_extension, batch_size, num_repeats, enable_bucket, bucket_no_upscale) # can be set in either general or datasets sections # Video-specific parameters (target_frames, frame_extraction, frame_stride, frame_sample, max_frames, source_fps) # must be set in each datasets section # caption_extension is not required for metadata jsonl file # cache_directory is required for each dataset with metadata jsonl file # general configurations [general] resolution = [960, 544] batch_size = 1 enable_bucket = true bucket_no_upscale = false [[datasets]] video_jsonl_file = "/path/to/metadata.jsonl" target_frames = [1, 25, 45] frame_extraction = "head" cache_directory = "/path/to/cache_directory_head" source_fps = 30.0 # optional, source fps for videos in the jsonl file # same metadata jsonl file can be used for multiple datasets [[datasets]] video_jsonl_file = "/path/to/metadata.jsonl" target_frames = [1] frame_stride = 10 cache_directory = "/path/to/cache_directory_stride" # other datasets can be added here. each dataset can have different configurations ``` JSONL file format for metadata: ```json {"video_path": "/path/to/video1.mp4", "caption": "A caption for video1"} {"video_path": "/path/to/video2.mp4", "caption": "A caption for video2"} ``` `video_path` can be a directory containing multiple images.
日本語 metadata jsonl ファむルを䜿甚する堎合、caption_extension は必芁ありたせん。たた、cache_directory は必須です。 `video_path`は、耇数の画像を含むディレクトリのパスでも構いたせん。 他の泚意事項は今たでのデヌタセットず同様です。
### frame_extraction Options - `head`: Extract the first N frames from the video. - `chunk`: Extract frames by splitting the video into chunks of N frames. - `slide`: Extract frames from the video with a stride of `frame_stride`. - `uniform`: Extract `frame_sample` samples uniformly from the video. - `full`: Extract all frames from the video. In the case of `full`, the entire video is used, but it is trimmed to "N*4+1" frames. It is also trimmed to the `max_frames` if it exceeds that value. To avoid Out of Memory errors, please set `max_frames`. The frame extraction methods other than `full` are recommended when the video contains repeated actions. `full` is recommended when each video represents a single complete motion. For example, consider a video with 40 frames. The following diagrams illustrate each extraction:
日本語 - `head`: 動画から最初のNフレヌムを抜出したす。 - `chunk`: 動画をNフレヌムず぀に分割しおフレヌムを抜出したす。 - `slide`: `frame_stride`に指定したフレヌムごずに動画からNフレヌムを抜出したす。 - `uniform`: 動画から䞀定間隔で、`frame_sample`個のNフレヌムを抜出したす。 - `full`: 動画から党おのフレヌムを抜出したす。 `full`の堎合、各動画の党䜓を甚いたすが、「N*4+1」のフレヌム数にトリミングされたす。たた`max_frames`を超える堎合もその倀にトリミングされたす。Out of Memory゚ラヌを避けるために、`max_frames`を蚭定しおください。 `full`以倖の抜出方法は、動画が特定の動䜜を繰り返しおいる堎合にお勧めしたす。`full`はそれぞれの動画がひず぀の完結したモヌションの堎合にお勧めしたす。 䟋えば、40フレヌムの動画を䟋ずした抜出に぀いお、以䞋の図で説明したす。
``` Original Video, 40 frames: x = frame, o = no frame oooooooooooooooooooooooooooooooooooooooo head, target_frames = [1, 13, 25] -> extract head frames: xooooooooooooooooooooooooooooooooooooooo xxxxxxxxxxxxxooooooooooooooooooooooooooo xxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooo chunk, target_frames = [13, 25] -> extract frames by splitting into chunks, into 13 and 25 frames: xxxxxxxxxxxxxooooooooooooooooooooooooooo oooooooooooooxxxxxxxxxxxxxoooooooooooooo ooooooooooooooooooooooooooxxxxxxxxxxxxxo xxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooo NOTE: Please do not include 1 in target_frames if you are using the frame_extraction "chunk". It will make the all frames to be extracted. 泚: frame_extraction "chunk" を䜿甚する堎合、target_frames に 1 を含めないでください。党おのフレヌムが抜出されおしたいたす。 slide, target_frames = [1, 13, 25], frame_stride = 10 -> extract N frames with a stride of 10: xooooooooooooooooooooooooooooooooooooooo ooooooooooxooooooooooooooooooooooooooooo ooooooooooooooooooooxooooooooooooooooooo ooooooooooooooooooooooooooooooxooooooooo xxxxxxxxxxxxxooooooooooooooooooooooooooo ooooooooooxxxxxxxxxxxxxooooooooooooooooo ooooooooooooooooooooxxxxxxxxxxxxxooooooo xxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooo ooooooooooxxxxxxxxxxxxxxxxxxxxxxxxxooooo uniform, target_frames =[1, 13, 25], frame_sample = 4 -> extract `frame_sample` samples uniformly, N frames each: xooooooooooooooooooooooooooooooooooooooo oooooooooooooxoooooooooooooooooooooooooo oooooooooooooooooooooooooxoooooooooooooo ooooooooooooooooooooooooooooooooooooooox xxxxxxxxxxxxxooooooooooooooooooooooooooo oooooooooxxxxxxxxxxxxxoooooooooooooooooo ooooooooooooooooooxxxxxxxxxxxxxooooooooo oooooooooooooooooooooooooooxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxooooooooooooooo oooooxxxxxxxxxxxxxxxxxxxxxxxxxoooooooooo ooooooooooxxxxxxxxxxxxxxxxxxxxxxxxxooooo oooooooooooooooxxxxxxxxxxxxxxxxxxxxxxxxx Three Original Videos, 20, 25, 35 frames: x = frame, o = no frame full, max_frames = 31 -> extract all frames (trimmed to the maximum length): video1: xxxxxxxxxxxxxxxxx (trimmed to 17 frames) video2: xxxxxxxxxxxxxxxxxxxxxxxxx (25 frames) video3: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (trimmed to 31 frames) ``` ### Sample for Image Dataset with Control Images The dataset with control images. This is used for the one frame training for FramePack, or for FLUX.1 Kontext, FLUX.2 and Qwen-Image-Edit training. The dataset configuration with caption text files is similar to the image dataset, but with an additional `control_directory` parameter. The control images are used from the `control_directory` with the same filename (or different extension) as the image, for example, `image_dir/image1.jpg` and `control_dir/image1.png`. The images in `image_directory` should be the target images (the images to be generated during inference, the changed images). The `control_directory` should contain the starting images for inference. The captions should be stored in `image_directory`. If multiple control images are specified, the filenames of the control images should be numbered (excluding the extension). For example, specify `image_dir/image1.jpg` and `control_dir/image1_0.png`, `control_dir/image1_1.png`. You can also specify the numbers with four digits, such as `image1_0000.png`, `image1_0001.png`. The metadata JSONL file format is the same as the image dataset, but with an additional `control_path` parameter. ```json {"image_path": "/path/to/image1.jpg", "control_path": "/path/to/control1.png", "caption": "A caption for image1"} {"image_path": "/path/to/image2.jpg", "control_path": "/path/to/control2.png", "caption": "A caption for image2"} If multiple control images are specified, the attribute names should be `control_path_0`, `control_path_1`, etc. ```json {"image_path": "/path/to/image1.jpg", "control_path_0": "/path/to/control1_0.png", "control_path_1": "/path/to/control1_1.png", "caption": "A caption for image1"} {"image_path": "/path/to/image2.jpg", "control_path_0": "/path/to/control2_0.png", "control_path_1": "/path/to/control2_1.png", "caption": "A caption for image2"} ``` The control images can also have an alpha channel. In this case, the alpha channel of the image is used as a mask for the latent. This is only for the one frame training of FramePack.
日本語 制埡画像を持぀デヌタセットです。珟時点ではFramePackの単䞀フレヌム孊習、FLUX.1 Kontext、FLUX.2、Qwen-Image-Editの孊習に䜿甚したす。 キャプションファむルを甚いる堎合は`control_directory`を远加で指定しおください。制埡画像は、画像ず同じファむル名たたは拡匵子のみが異なるファむル名の、`control_directory`にある画像が䜿甚されたす䟋`image_dir/image1.jpg`ず`control_dir/image1.png`。`image_directory`の画像は孊習察象の画像掚論時に生成する画像、倉化埌の画像ずしおください。`control_directory`には掚論時の開始画像を栌玍しおください。キャプションは`image_directory`ぞ栌玍しおください。 耇数枚の制埡画像が指定可胜です。この堎合、制埡画像のファむル名拡匵子を陀くぞ数字を付䞎しおください。䟋えば、`image_dir/image1.jpg`ず`control_dir/image1_0.png`, `control_dir/image1_1.png`のように指定したす。`image1_0000.png`, `image1_0001.png`のように数字を4桁で指定するこずもできたす。 メタデヌタJSONLファむルを䜿甚する堎合は、`control_path`を远加しおください。耇数枚の制埡画像を指定する堎合は、`control_path_0`, `control_path_1`のように数字を付䞎しおください。 FramePackの単䞀フレヌム孊習では、制埡画像はアルファチャンネルを持぀こずもできたす。この堎合、画像のアルファチャンネルはlatentぞのマスクずしお䜿甚されたす。
### Resizing Control Images for Image Dataset / 画像デヌタセットでの制埡画像のリサむズ By default, the control images are resized to the same size as the target images. You can change the resizing method with the following options: - `no_resize_control`: Do not resize the control images. They will be cropped to match the rounding unit of each architecture (for example, 16 pixels). - `control_resolution`: Resize the control images to the specified resolution. For example, specify `control_resolution = [1024, 1024]`. Aspect Ratio Bucketing will be applied. ```toml [[datasets]] # Image directory or metadata jsonl file as above image_directory = "/path/to/image_dir" control_directory = "/path/to/control_dir" control_resolution = [1024, 1024] no_resize_control = false ``` If both are specified, `control_resolution` is treated as the maximum resolution. That is, if the total number of pixels of the control image exceeds that of `control_resolution`, it will be resized to `control_resolution`. The recommended resizing method for control images may vary depending on the architecture. Please refer to the section for each architecture. The previous options `flux_kontext_no_resize_control` and `qwen_image_edit_no_resize_control` are still available, but it is recommended to use `no_resize_control`. The `qwen_image_edit_control_resolution` is also available, but it is recommended to use `control_resolution`. **The technical details of `no_resize_control`:** When this option is specified, the control image is trimmed to a multiple of 16 pixels (depending on the architecture) and converted to latent and passed to the model. Each element in the batch must have the same resolution, which is adjusted by advanced Aspect Ratio Bucketing (buckets are divided by the resolution of the target image and also the resolution of the control image).
日本語 デフォルトでは、制埡画像はタヌゲット画像ず同じサむズにリサむズされたす。以䞋のオプションで、リサむズ方匏を倉曎できたす。 - `no_resize_control`: 制埡画像をリサむズしたせん。アヌキテクチャごずの䞞め単䜍16ピクセルなどに合わせおトリミングされたす。 - `control_resolution`: 制埡画像を指定した解像床にリサむズしたす。䟋えば、`control_resolution = [1024, 1024]`ず指定したす。Aspect Ratio Bucketingが適甚されたす。 䞡方が同時に指定されるず、`control_resolution`は最倧解像床ずしお扱われたす。぀たり、制埡画像の総ピクセル数が`control_resolution`の総ピクセル数を超える堎合、`control_resolution`にリサむズされたす。 アヌキテクチャにより、掚奚の制埡画像のリサむズ方法は異なりたす。各アヌキテクチャの節を参照しおください。 以前のオプション`flux_kontext_no_resize_control`ず`qwen_image_edit_no_resize_control`は䜿甚可胜ですが、`no_resize_control`を䜿甚するこずを掚奚したす。 `qwen_image_edit_control_resolution`も䜿甚可胜ですが、`control_resolution`を䜿甚するこずを掚奚したす。 **`no_resize_control`の技術的な詳现:** このオプションが指定された堎合、制埡画像は16ピクセルの倍数アヌキテクチャに䟝存にトリミングされ、latentに倉換されおモデルに枡されたす。 バッチ内の各芁玠は同じ解像床である必芁がありたすが、タヌゲット画像の解像床ず制埡画像の解像床の䞡方でバケットが分割される高床なAspect Ratio Bucketingによっお調敎されたす。
### Sample for Video Dataset with Control Images The dataset with control videos is used for training ControlNet models. The dataset configuration with caption text files is similar to the video dataset, but with an additional `control_directory` parameter. The control video for a video is used from the `control_directory` with the same filename (or different extension) as the video, for example, `video_dir/video1.mp4` and `control_dir/video1.mp4` or `control_dir/video1.mov`. The control video can also be a directory without an extension, for example, `video_dir/video1.mp4` and `control_dir/video1`. ```toml [[datasets]] video_directory = "/path/to/video_dir" control_directory = "/path/to/control_dir" # required for dataset with control videos cache_directory = "/path/to/cache_directory" # recommended to set cache directory target_frames = [1, 25, 45] frame_extraction = "head" ``` The dataset configuration with metadata JSONL file is same as the video dataset, but metadata JSONL file must include the control video paths. The control video path can be a directory containing multiple images. ```json {"video_path": "/path/to/video1.mp4", "control_path": "/path/to/control1.mp4", "caption": "A caption for video1"} {"video_path": "/path/to/video2.mp4", "control_path": "/path/to/control2.mp4", "caption": "A caption for video2"} ```
日本語 制埡動画を持぀デヌタセットです。ControlNetモデルの孊習に䜿甚したす。 キャプションを甚いる堎合のデヌタセット蚭定は動画デヌタセットず䌌おいたすが、`control_directory`パラメヌタが远加されおいたす。䞊にある䟋を参照しおください。ある動画に察する制埡甚動画ずしお、動画ず同じファむル名たたは拡匵子のみが異なるファむル名の、`control_directory`にある動画が䜿甚されたす䟋`video_dir/video1.mp4`ず`control_dir/video1.mp4`たたは`control_dir/video1.mov`。たた、拡匵子なしのディレクトリ内の、耇数枚の画像を制埡甚動画ずしお䜿甚するこずもできたす䟋`video_dir/video1.mp4`ず`control_dir/video1`。 デヌタセット蚭定でメタデヌタJSONLファむルを䜿甚する堎合は、動画ず制埡甚動画のパスを含める必芁がありたす。制埡甚動画のパスは、耇数枚の画像を含むディレクトリのパスでも構いたせん。
## Architecture-specific Settings / アヌキテクチャ固有の蚭定 The dataset configuration is shared across all architectures. However, some architectures may require additional settings or have specific requirements for the dataset. ### FramePack For FramePack, you can set the latent window size for training. It is recommended to set it to 9 for FramePack training. The default value is 9, so you can usually omit this setting. ```toml [[datasets]] fp_latent_window_size = 9 ```
日本語 孊習時のlatent window sizeを指定できたす。FramePackの孊習においおは、9を指定するこずを掚奚したす。省略時は9が䜿甚されたすので、通垞は省略しお構いたせん。
### FramePack One Frame Training For the default one frame training of FramePack, you need to set the following parameters in the dataset configuration: ```toml [[datasets]] fp_1f_clean_indices = [0] fp_1f_target_index = 9 fp_1f_no_post = false ``` **Advanced Settings:** **Note that these parameters are still experimental, and the optimal values are not yet known.** The parameters may also change in the future. `fp_1f_clean_indices` sets the `clean_indices` value passed to the FramePack model. You can specify multiple indices. `fp_1f_target_index` sets the index of the frame to be trained (generated). `fp_1f_no_post` sets whether to add a zero value as `clean_latent_post`, default is `false` (add zero value). The number of control images should match the number of indices specified in `fp_1f_clean_indices`. The default values mean that the first image (control image) is at index `0`, and the target image (the changed image) is at index `9`. For training with 1f-mc, set `fp_1f_clean_indices` to `[0, 1]` and `fp_1f_target_index` to `9` (or another value). This allows you to use multiple control images to train a single generated image. The control images will be two in this case. ```toml [[datasets]] fp_1f_clean_indices = [0, 1] fp_1f_target_index = 9 fp_1f_no_post = false ``` For training with kisekaeichi, set `fp_1f_clean_indices` to `[0, 10]` and `fp_1f_target_index` to `1` (or another value). This allows you to use the starting image (the image just before the generation section) and the image following the generation section (equivalent to `clean_latent_post`) to train the first image of the generated video. The control images will be two in this case. `fp_1f_no_post` should be set to `true`. ```toml [[datasets]] fp_1f_clean_indices = [0, 10] fp_1f_target_index = 1 fp_1f_no_post = true ``` With `fp_1f_clean_indices` and `fp_1f_target_index`, you can specify any number of control images and any index of the target image for training. If you set `fp_1f_no_post` to `false`, the `clean_latent_post_index` will be `1 + fp1_latent_window_size`. You can also set the `no_2x` and `no_4x` options for cache scripts to disable the clean latents 2x and 4x. The 2x indices are `1 + fp1_latent_window_size + 1` for two indices (usually `11, 12`), and the 4x indices are `1 + fp1_latent_window_size + 1 + 2` for sixteen indices (usually `13, 14, ..., 28`), regardless of `fp_1f_no_post` and `no_2x`, `no_4x` settings.
日本語 ※ **以䞋のパラメヌタは研究䞭で最適倀はただ䞍明です。** たたパラメヌタ自䜓も倉曎される可胜性がありたす。 デフォルトの1フレヌム孊習を行う堎合、`fp_1f_clean_indices`に`[0]`を、`fp_1f_target_index`に`9`たたは5から15皋床の倀を、`no_post`に`false`を蚭定しおください。蚘述䟋は英語版ドキュメントを参照、以降同じ。 **より高床な蚭定** `fp_1f_clean_indices`は、FramePackモデルに枡される `clean_indices` の倀を蚭定したす。耇数指定が可胜です。`fp_1f_target_index`は、孊習生成察象のフレヌムのむンデックスを蚭定したす。`fp_1f_no_post`は、`clean_latent_post` をれロ倀で远加するかどうかを蚭定したすデフォルトは`false`で、れロ倀で远加したす。 制埡画像の枚数は`fp_1f_clean_indices`に指定したむンデックスの数ずあわせおください。 デフォルトの1フレヌム孊習では、開始画像制埡画像1枚をむンデックス`0`、生成察象の画像倉化埌の画像をむンデックス`9`に蚭定しおいたす。 1f-mcの孊習を行う堎合は、`fp_1f_clean_indices`に `[0, 1]`を、`fp_1f_target_index`に`9`を蚭定しおください。これにより動画の先頭の2枚の制埡画像を䜿甚しお、埌続の1枚の生成画像を孊習したす。制埡画像は2枚になりたす。 kisekaeichiの孊習を行う堎合は、`fp_1f_clean_indices`に `[0, 10]`を、`fp_1f_target_index`に`1`たたは他の倀を蚭定しおください。これは、開始画像生成セクションの盎前の画像`clean_latent_pre`に盞圓ず、生成セクションに続く1枚の画像`clean_latent_post`に盞圓を䜿甚しお、生成動画の先頭の画像`target_index=1`を孊習したす。制埡画像は2枚になりたす。`f1_1f_no_post`は`true`に蚭定しおください。 `fp_1f_clean_indices`ず`fp_1f_target_index`を応甚するこずで、任意の枚数の制埡画像を、任意のむンデックスを指定しお孊習するこずが可胜です。 `fp_1f_no_post`を`false`に蚭定するず、`clean_latent_post_index`は `1 + fp1_latent_window_size` になりたす。 掚論時の `no_2x`、`no_4x`に察応する蚭定は、キャッシュスクリプトの匕数で行えたす。なお、2xのindexは `1 + fp1_latent_window_size + 1` からの2個通垞は`11, 12`、4xのindexは `1 + fp1_latent_window_size + 1 + 2` からの16個になりたす通垞は`13, 14, ..., 28`です。これらの倀は`fp_1f_no_post`や`no_2x`, `no_4x`の蚭定に関わらず、垞に同じです。
### FLUX.1 Kontext [dev] The FLUX.1 Kontext dataset configuration uses an image dataset with control images. However, only one control image can be used. `fp_1f_*` settings are not used in FLUX.1 Kontext. Masks are also not used. If you set `no_resize_control`, it disables resizing of the control image. Since FLUX.1 Kontext assumes a fixed [resolution of control images](https://github.com/black-forest-labs/flux/blob/1371b2bc70ac80e1078446308dd5b9a2ebc68c87/src/flux/util.py#L584), it may be better to prepare the control images in advance to match these resolutions and use `no_resize_control`.
日本語 FLUX.1 Kontextのデヌタセット蚭定は、制埡画像を持぀画像デヌタセットを䜿甚したす。ただし、制埡画像は1枚しか䜿甚できたせん。 `fp_1f_*`の蚭定はFLUX.1 Kontextでは䜿甚したせん。たたマスクも䜿甚されたせん。 たた、`no_resize_control`を蚭定するず、制埡画像のリサむズを無効にしたす。 FLUX.1 Kontextは[制埡画像の固定解像床](https://github.com/black-forest-labs/flux/blob/1371b2bc70ac80e1078446308dd5b9a2ebc68c87/src/flux/util.py#L584)を想定しおいるため、これらの解像床にあわせお制埡画像を事前に甚意し、`no_resize_control`を䜿甚する方が良い堎合がありたす。
### Qwen-Image-Edit and Qwen-Image-Edit-2509/2511 The Qwen-Image-Edit dataset configuration uses an image dataset with control images. However, only one control image can be used for the standard model (not `2509` or `2511`). By default, the control image is resized to the same resolution (and aspect ratio) as the image. If you set `no_resize_control`, it disables resizing of the control image. For example, if the image is 960x544 and the control image is 512x512, the control image will remain 512x512. Also, you can specify the resolution of the control image separately from the training image resolution by using `control_resolution`. If you want to resize the control images the same as the official code, specify [1024,1024]. **We strongly recommend specifying this value.** `no_resize_control` can be specified together with `control_resolution`. If `no_resize_control` or `control_resolution` is specified, each control image can have a different resolution. The control image is resized according to the specified settings. ```toml [[datasets]] no_resize_control = false # optional, default is false. Disable resizing of control image control_resolution = [1024, 1024] # optional, default is None. Specify the resolution of the control image. ``` `fp_1f_*` settings are not used in Qwen-Image-Edit.
日本語 Qwen-Image-Editのデヌタセット蚭定は、制埡画像を持぀画像デヌタセットを䜿甚したす。耇数枚の制埡画像も䜿甚可胜ですが、無印`2509`たたは`2511`でないモデルでは1枚のみ䜿甚可胜です。 デフォルトでは、制埡画像は画像ず同じ解像床およびアスペクト比にリサむズされたす。 `no_resize_control`を蚭定するず、制埡画像のリサむズを無効にしたす。たずえば、画像が960x544で制埡画像が512x512の堎合、制埡画像は512x512のたたになりたす。 たた、`control_resolution`を䜿甚するこずで、制埡画像の解像床を孊習画像の解像床ず異なる倀に指定できたす。公匏のコヌドず同じように制埡画像をリサむズしたい堎合は、[1024, 1024]を指定しおください。**この倀の指定を匷く掚奚したす。** `no_resize_control`ず `control_resolution`は同時に指定できたす。 `no_resize_control`たたは`control_resolution`が指定された堎合、各制埡画像は異なる解像床を持぀こずができたす。制埡画像は指定された蚭定に埓っおリサむズされたす。 ```toml [[datasets]] no_resize_control = false # オプション、デフォルトはfalse。制埡画像のリサむズを無効にしたす control_resolution = [1024, 1024] # オプション、デフォルトはNone。制埡画像の解像床を指定したす ``` `fp_1f_*`の蚭定はQwen-Image-Editでは䜿甚したせん。
### FLUX.2 The FLUX.2 dataset configuration uses an image dataset with control images (it can also be trained without control images). Multiple control images can be used. `fp_1f_*` settings are not used in FLUX.2. If you set `no_resize_control`, it disables resizing of the control images. If you want to follow the official FLUX.2 inference settings, please specify this option. You can specify the resolution of the control images separately from the training image resolution by using `control_resolution`. If you want to follow the official FLUX.2 inference settings, specify [2024, 2024] (note that it is not 2048) when there is one control image, and [1024, 1024] when there are multiple control images, together with the `no_resize_control` option.
日本語 FLUX.2のデヌタセット蚭定は、制埡画像を持぀画像デヌタセットを䜿甚したす制埡画像なしでも孊習できたす。耇数枚の制埡画像が䜿甚可胜です。 `fp_1f_*`の蚭定はFLUX.2では䜿甚したせん。 `no_resize_control`を蚭定するず、制埡画像のリサむズを無効にしたす。FLUX.2公匏の掚論時蚭定に準拠する堎合は、このオプションを指定しおください。 `control_resolution`を䜿甚しお、制埡画像の解像床を孊習画像の解像床ず異なる倀に指定できたす。FLUX.2公匏の掚論時蚭定に準拠する堎合は、`no_resize_control`オプションず同時に、制埡画像が1枚の堎合は`[2024, 2024]`2048ではないので泚意、制埡画像が耇数の堎合は`[1024, 1024]`を指定しおください。
## Specifications ```toml # general configurations [general] resolution = [960, 544] # optional, [W, H], default is [960, 544]. This is the default resolution for all datasets caption_extension = ".txt" # optional, default is None. This is the default caption extension for all datasets batch_size = 1 # optional, default is 1. This is the default batch size for all datasets num_repeats = 1 # optional, default is 1. Number of times to repeat the dataset. Useful to balance the multiple datasets with different sizes. enable_bucket = true # optional, default is false. Enable bucketing for datasets bucket_no_upscale = false # optional, default is false. Disable upscaling for bucketing. Ignored if enable_bucket is false ### Image Dataset # sample image dataset with caption text files [[datasets]] image_directory = "/path/to/image_dir" caption_extension = ".txt" # required for caption text files, if general caption extension is not set resolution = [960, 544] # required if general resolution is not set batch_size = 4 # optional, overwrite the default batch size num_repeats = 1 # optional, overwrite the default num_repeats enable_bucket = false # optional, overwrite the default bucketing setting bucket_no_upscale = true # optional, overwrite the default bucketing setting cache_directory = "/path/to/cache_directory" # optional, default is None to use the same directory as the image directory. NOTE: caching is always enabled control_directory = "/path/to/control_dir" # optional, required for dataset with control images # sample image dataset with metadata **jsonl** file [[datasets]] image_jsonl_file = "/path/to/metadata.jsonl" # includes pairs of image files and captions resolution = [960, 544] # required if general resolution is not set cache_directory = "/path/to/cache_directory" # required for metadata jsonl file # caption_extension is not required for metadata jsonl file # batch_size, num_repeats, enable_bucket, bucket_no_upscale are also available for metadata jsonl file ### Video Dataset # sample video dataset with caption text files [[datasets]] video_directory = "/path/to/video_dir" caption_extension = ".txt" # required for caption text files, if general caption extension is not set resolution = [960, 544] # required if general resolution is not set control_directory = "/path/to/control_dir" # optional, required for dataset with control images # following configurations must be set in each [[datasets]] section for video datasets target_frames = [1, 25, 79] # required for video dataset. list of video lengths to extract frames. each element must be N*4+1 (N=0,1,2,...) # NOTE: Please do not include 1 in target_frames if you are using the frame_extraction "chunk". It will make the all frames to be extracted. frame_extraction = "head" # optional, "head" or "chunk", "full", "slide", "uniform". Default is "head" frame_stride = 1 # optional, default is 1, available for "slide" frame extraction frame_sample = 4 # optional, default is 1 (same as "head"), available for "uniform" frame extraction max_frames = 129 # optional, default is 129. Maximum number of frames to extract, available for "full" frame extraction # batch_size, num_repeats, enable_bucket, bucket_no_upscale, cache_directory are also available for video dataset # sample video dataset with metadata jsonl file [[datasets]] video_jsonl_file = "/path/to/metadata.jsonl" # includes pairs of video files and captions target_frames = [1, 79] cache_directory = "/path/to/cache_directory" # required for metadata jsonl file # frame_extraction, frame_stride, frame_sample, max_frames are also available for metadata jsonl file ``` The metadata with .json file will be supported in the near future.