SuperCS's picture
Add files using upload-large-folder tool
2336cc9 verified

FramePack One Frame (Single Frame) Inference and Training / FramePack 1フレヌム掚論ず孊習

Overview / 抂芁

This document explains advanced inference and training methods using the FramePack model, particularly focusing on "1-frame inference" and its extensions. These features aim to leverage FramePack's flexibility to enable diverse image generation and editing tasks beyond simple video generation.

The Concept and Development of 1-Frame Inference

While FramePack is originally a model for generating sequential video frames (or frame sections), it was discovered that by focusing on its internal structure, particularly how it handles temporal information with RoPE (Rotary Position Embedding), interesting control over single-frame generation is possible.

  1. Basic 1-Frame Inference:

    • It takes an initial image and a prompt as input, limiting the number of generated frames to just one.
    • In this process, by intentionally setting a large RoPE timestamp (target_index) for the single frame to be generated, a single static image can be obtained that reflects temporal and semantic changes from the initial image according to the prompt.
    • This utilizes FramePack's characteristic of being highly sensitive to RoPE timestamps, as it supports bidirectional contexts like "Inverted anti-drifting." This allows for operations similar to natural language-based image editing, albeit in a limited capacity, without requiring additional training.
  2. Kisekaeichi Method (Feature Merging via Post-Reference):

    • This method, an extension of basic 1-frame inference, was proposed by furusu. In addition to the initial image, it also uses a reference image corresponding to a "next section-start image" (treated as clean_latent_post) as input.
    • The RoPE timestamp (target_index) for the image to be generated is set to an intermediate value between the timestamps of the initial image and the section-end image.
    • More importantly, masking (e.g., zeroing out specific regions) is applied to the latent representation of each reference image. For example, by setting masks to extract a character's face and body shape from the initial image and clothing textures from the reference image, an image can be generated that fuses the desired features of both, similar to a character "dress-up" or outfit swapping. This method can also be fundamentally achieved without additional training.
  3. 1f-mc (one frame multi-control) Method (Proximal Frame Blending):

    • This method was proposed by mattyamonaca. It takes two reference images as input: an initial image (e.g., at t=0) and a subsequent image (e.g., at t=1, the first frame of a section), and generates a single image blending their features.
    • Unlike Kisekaeichi, latent masking is typically not performed.
    • To fully leverage this method, additional training using LoRA (Low-Rank Adaptation) is recommended. Through training, the model can better learn the relationship and blending method between the two input images to achieve specific editing effects.

Integration into a Generalized Control Framework

The concepts utilized in the methods above—specifying reference images, manipulating timestamps, and applying latent masks—have been generalized to create a more flexible control framework. Users can arbitrarily specify the following elements for both inference and LoRA training:

  • Control Images: Any set of input images intended to influence the model.
  • Clean Latent Index (Indices): Timestamps corresponding to each control image. These are treated as clean latent index internally by FramePack and can be set to any position on the time axis. This is specified as control_index.
  • Latent Masks: Masks applied to the latent representation of each control image, allowing selective control over which features from the control images are utilized. This is specified as control_image_mask_path or the alpha channel of the control image.
  • Target Index: The timestamp for the single frame to be generated.

This generalized control framework, along with corresponding extensions to the inference and LoRA training tools, has enabled advanced applications such as:

  • Development of LoRAs that stabilize 1-frame inference effects (e.g., a camera orbiting effect) that were previously unstable with prompts alone.
  • Development of Kisekaeichi LoRAs that learn to perform desired feature merging under specific conditions (e.g., ignoring character information from a clothing reference image), thereby automating the masking process through learning.

These features maximize FramePack's potential and open up new creative possibilities in static image generation and editing. Subsequent sections will detail the specific options for utilizing these functionalities.

日本語

このドキュメントでは、FramePackモデルを甚いた高床な掚論および孊習手法、特に「1フレヌム掚論」ずその拡匵機胜に぀いお解説したす。これらの機胜は、FramePackの柔軟性を掻かし、動画生成に留たらない倚様な画像生成・線集タスクを実珟するこずを目的ずしおいたす。

1フレヌム掚論の発想ず発展

FramePackは本来、連続する動画フレヌムたたはフレヌムセクションを生成するモデルですが、その内郚構造、特に時間情報を扱うRoPE (Rotary Position Embedding) の扱いに着目するこずで、単䞀フレヌムの生成においおも興味深い制埡が可胜になるこずが発芋されたした。

  1. 基本的な1フレヌム掚論:

    • 開始画像ずプロンプトを入力ずし、生成するフレヌム数を1フレヌムに限定したす。
    • この際、生成する1フレヌムに割り圓おるRoPEのタむムスタンプtarget_indexを意図的に倧きな倀に蚭定するこずで、開始画像からプロンプトに埓っお時間的・意味的に倉化した単䞀の静止画を埗るこずができたす。
    • これは、FramePackがInverted anti-driftingなどの双方向コンテキストに察応するため、RoPEのタむムスタンプに察しお敏感に反応する特性を利甚したものです。これにより、孊習なしで限定的ながら自然蚀語による画像線集に近い操䜜が可胜です。
  2. kisekaeichi方匏 (ポスト参照による特城マヌゞ):

    • 基本的な1フレヌム掚論を発展させたこの方匏は、furusu氏により提案されたした。開始画像に加え、「次のセクションの開始画像」に盞圓する参照画像clean_latent_postずしお扱われるも入力ずしお利甚したす。
    • 生成する画像のRoPEタむムスタンプtarget_indexを、開始画像のタむムスタンプずセクション終端画像のタむムスタンプの䞭間的な倀に蚭定したす。
    • さらに重芁な点ずしお、各参照画像のlatent衚珟に察しおマスク凊理特定領域を0で埋めるなどを斜したす。䟋えば、開始画像からはキャラクタヌの顔や䜓型を、参照画像からは服装のテクスチャを抜出するようにマスクを蚭定するこずで、キャラクタヌの「着せ替え」のような、䞡者の望たしい特城を融合させた画像を生成できたす。この手法も基本的には孊習䞍芁で実珟可胜です。
  3. 1f-mc (one frame multi-control) 方匏 (近接フレヌムブレンド):

    • この方匏は、mattyamonaca氏により提案されたした。開始画像䟋: t=0ず、その盎埌の画像䟋: t=1、セクションの最初のフレヌムの2぀を参照画像ずしお入力し、それらの特城をブレンドした単䞀画像を生成したす。
    • kisekaeichiずは異なり、latentマスクは通垞行いたせん。
    • この方匏の真䟡を発揮するには、LoRA (Low-Rank Adaptation) による远加孊習が掚奚されたす。孊習により、モデルは2぀の入力画像間の関係性やブレンド方法をより適切に孊習し、特定の線集効果を実珟できたす。

汎甚的な制埡フレヌムワヌクぞの統合

䞊蚘の各手法で利甚されおいた「参照画像の指定」「タむムスタンプの操䜜」「latentマスクの適甚」ずいった抂念を䞀般化し、より柔軟な制埡を可胜にするための拡匵が行われたした。 ナヌザヌは以䞋の芁玠を任意に指定しお、掚論およびLoRA孊習を行うこずができたす。

  • 制埡画像 (Control Images): モデルに圱響を䞎えるための任意の入力画像矀。
  • Clean Latent Index (Indices): 各制埡画像に察応するタむムスタンプ。FramePack内郚のclean latent indexずしお扱われ、時間軞䞊の任意の䜍眮を指定可胜です。control_indexずしお指定したす。
  • Latentマスク (Latent Masks): 各制埡画像のlatentに適甚するマスク。これにより、制埡画像から利甚する特城を遞択的に制埡したす。control_image_mask_pathたたは制埡画像のアルファチャンネルずしお指定したす。
  • Target Index: 生成したい単䞀フレヌムのタむムスタンプ。

この汎甚的な制埡フレヌムワヌクず、それに察応した掚論ツヌルおよびLoRA孊習ツヌルの拡匵により、以䞋のような高床な応甚が可胜になりたした。

  • プロンプトだけでは䞍安定だった1フレヌム掚論の効果䟋: カメラ旋回を安定化させるLoRAの開発。
  • マスク凊理を手動で行う代わりに、特定の条件䞋䟋: 服の参照画像からキャラクタヌ情報を無芖するで望たしい特城マヌゞを行うように孊習させたkisekaeichi LoRAの開発。

これらの機胜は、FramePackのポテンシャルを最倧限に匕き出し、静止画生成・線集における新たな創造の可胜性を拓くものです。以降のセクションでは、これらの機胜を実際に利甚するための具䜓的なオプションに぀いお説明したす。

One Frame (Single Frame) Training / 1フレヌム孊習

This feature is experimental. It trains in the same way as one frame inference.

The dataset must be an image dataset. If you use caption files, you need to specify control_directory and place the start images in that directory. The image_directory should contain the images after the change. The filenames of both directories must match. Caption files should be placed in the image_directory.

If you use JSONL files, specify them as {"image_path": "/path/to/target_image1.jpg", "control_path": "/path/to/source_image1.jpg", "caption": "The object changes to red."}. The image_path should point to the images after the change, and control_path should point to the starting images.

For the dataset configuration, see here and here. There are also examples for kisekaeichi and 1f-mc settings.

For single frame training, specify --one_frame in fpack_cache_latents.py to create the cache. You can also use --one_frame_no_2x and --one_frame_no_4x options, which have the same meaning as no_2x and no_4x during inference. It is recommended to set these options to match the inference settings.

If you change whether to use one frame training or these options, please overwrite the existing cache without specifying --skip_existing.

Specify --one_frame in fpack_train_network.py to change the inference method during sample generation.

The optimal training settings are currently unknown. Feedback is welcome.

Example of prompt file description for sample generation

The command line options --one_frame_inference corresponds to --of, and --control_image_path corresponds to --ci.

Note that --ci can be specified multiple times, but --control_image_path is specified as --control_image_path img1.png img2.png, while --ci is specified as --ci img1.png --ci img2.png.

Normal single frame training:

The girl wears a school uniform. --i path/to/start.png --ci path/to/start.png --of no_2x,no_4x,target_index=1,control_index=0 --d 1111 --f 1 --s 10 --fs 7 --d 1234 --w 384 --h 576

Kisekaeichi training:

The girl wears a school uniform. --i path/to/start_with_alpha.png --ci path/to/ref_with_alpha.png --ci path/to/start_with_alpha.png --of no_post,no_2x,no_4x,target_index=5,control_index=0;10 --d 1111 --f 1 --s 10 --fs 7 --d 1234 --w 384 --h 576
日本語

この機胜は実隓的なものです。 1フレヌム掚論ず同様の方法で孊習を行いたす。

デヌタセットは画像デヌタセットである必芁がありたす。キャプションファむルを甚いる堎合は、control_directoryを远加で指定し、そのディレクトリに開始画像を栌玍しおください。image_directoryには倉化埌の画像を栌玍したす。䞡者のファむル名は䞀臎させる必芁がありたす。キャプションファむルはimage_directoryに栌玍しおください。

JSONLファむルを甚いる堎合は、{"image_path": "/path/to/target_image1.jpg", "control_path": "/path/to/source_image1.jpg", "caption": "The object changes to red"}のように指定しおください。image_pathは倉化埌の画像、control_pathは開始画像を指定したす。

デヌタセットの蚭定に぀いおは、こちらずこちらも参照しおください。kisekaeichiず1f-mcの蚭定䟋もそちらにありたす。

1フレヌム孊習時は、fpack_cache_latents.pyに--one_frameを指定しおキャッシュを䜜成しおください。たた--one_frame_no_2xず--one_frame_no_4xオプションも利甚可胜です。掚論時のno_2x、no_4xず同じ意味を持ちたすので、掚論時ず同じ蚭定にするこずをお勧めしたす。

1フレヌム孊習か吊かを倉曎する堎合、たたこれらのオプションを倉曎する堎合は、--skip_existingを指定せずに既存のキャッシュを䞊曞きしおください。

たた、fpack_train_network.pyに--one_frameを指定しおサンプル画像生成時の掚論方法を倉曎しおください。

最適な孊習蚭定は今のずころ䞍明です。フィヌドバックを歓迎したす。

サンプル生成のプロンプトファむル蚘述䟋

コマンドラむンオプション--one_frame_inferenceに盞圓する --ofず、--control_image_pathに盞圓する--ciが甚意されおいたす。

※ --ciは耇数指定可胜ですが、--control_image_pathは--control_image_path img1.png img2.pngのようにスペヌスで区切るのに察しお、--ciは--ci img1.png --ci img2.pngのように指定するので泚意しおください。

通垞の1フレヌム孊習:

The girl wears a school uniform. --i path/to/start.png --ci path/to/start.png --of no_2x,no_4x,target_index=1,control_index=0 --d 1111 --f 1 --s 10 --fs 7 --d 1234 --w 384 --h 576

kisekaeichi方匏:

The girl wears a school uniform. --i path/to/start_with_alpha.png --ci path/to/ref_with_alpha.png --ci path/to/start_with_alpha.png --of no_post,no_2x,no_4x,target_index=5,control_index=0;10 --d 1111 --f 1 --s 10 --fs 7 --d 1234 --w 384 --h 576

One (single) Frame Inference / 1フレヌム掚論

This feature is highly experimental and not officially supported. It is intended for users who want to explore the potential of FramePack for one frame inference, which is not a standard feature of the model.

This script also allows for one frame inference, which is not an official feature of FramePack but rather a custom implementation.

Theoretically, it generates an image after a specified time from the starting image, following the prompt. This means that, although limited, it allows for natural language-based image editing.

To perform one frame inference, specify some option in the --one_frame_inference option. Here is an example:

--video_sections 1 --output_type latent_images --one_frame_inference default --image_path start_image.png --control_image_path start_image.png

The --image_path is used to obtain the SIGCLIP features for one frame inference. Normally, you should specify the starting image. The --control_image_path is newly used to specify the control image, but for normal one frame inference, you should also specify the starting image.

The --one_frame_inference option is recommended to be set to default or no_2x,no_4x. If you specify --output_type as latent_images, both the latent and image will be saved.

You can specify the following strings in the --one_frame_inference option, separated by commas:

  • no_2x: Generates without passing clean latents 2x with zero vectors to the model. Slightly improves generation speed. The impact on generation results is unknown.
  • no_4x: Generates without passing clean latents 4x with zero vectors to the model. Slightly improves generation speed. The impact on generation results is unknown.
  • no_post: Generates without passing clean latents post with zero vectors to the model. Improves generation speed by about 20%, but may result in unstable generation.
  • target_index=<integer>: Specifies the index of the image to be generated. The default is the last frame (i.e., latent_window_size).

For example, you can use --one_frame_inference default to pass clean latents 2x, clean latents 4x, and post to the model. --one_frame_inference no_2x,no_4x if you want to skip passing clean latents 2x and 4x to the model. --one_frame_inference target_index=9 can be used to specify the target index for the generated image.

The --one_frame_inference option also supports advanced inference, which is described in the next section. This option allows for more detailed control using additional parameters like target_index and control_index within this option.

Normally, specify --video_sections 1 to indicate only one section (one image).

Increasing target_index from the default of 9 may result in larger changes. It has been confirmed that generation can be performed without breaking up to around 40.

The --end_image_path is ignored for one frame inference.

日本語

この機胜は非垞に実隓的であり、公匏にはサポヌトされおいたせん。FramePackを䜿甚しお1フレヌム掚論の可胜性を詊したいナヌザヌに向けたものです。

このスクリプトでは、単䞀画像の掚論を行うこずもできたす。FramePack公匏の機胜ではなく、独自の実装です。

理論的には、開始画像から、プロンプトに埓い、指定時間経過埌の画像を生成したす。぀たり制限付きですが自然蚀語による画像線集を行うこずができたす。

単䞀画像掚論を行うには--one_frame_inferenceオプションに、䜕らかのオプションを指定しおください。蚘述䟋は以䞋の通りです。

--video_sections 1 --output_type latent_images --one_frame_inference default --image_path start_image.png --control_image_path start_image.png

--image_pathは、1フレヌム掚論ではSIGCLIPの特城量を取埗するために甚いられたす。通垞は開始画像を指定しおください。--control_image_pathは新しく远加された匕数で、制埡甚画像を指定するために甚いられたすが、通垞は開始画像を指定しおください。

--one_frame_inferenceのオプションは、defaultたたは no_2x,no_4xを掚奚したす。--output_typeにlatent_imagesを指定するずlatentず画像の䞡方が保存されたす。

--one_frame_inferenceのオプションには、カンマ区切りで以䞋のオプションを任意個数指定できたす。

  • no_2x: れロベクトルの clean latents 2xをモデルに枡さずに生成したす。わずかに生成速床が向䞊したす。生成結果ぞの圱響は䞍明です。
  • no_4x: れロベクトルの clean latents 4xをモデルに枡さずに生成したす。わずかに生成速床が向䞊したす。生成結果ぞの圱響は䞍明です。
  • no_post: れロベクトルの clean latents の post を枡さずに生成したす。生成速床が20%皋床向䞊したすが、生成結果が䞍安定になる堎合がありたす。
  • target_index=<敎数>: 生成する画像のindexを指定したす。デフォルトは最埌のフレヌムです=latent_window_size。

たずえば、--one_frame_inference defaultを䜿甚するず、clean latents 2x、clean latents 4x、postをモデルに枡したす。--one_frame_inference no_2x,no_4xを䜿甚するず、clean latents 2xず4xをモデルに枡すのをスキップしたす。--one_frame_inference target_index=9を䜿甚しお、生成する画像のタヌゲットむンデックスを指定できたす。

埌述の高床な掚論では、このオプション内で target_index、control_index ずいった远加のパラメヌタを指定しお、より詳现な制埡が可胜です。

clean latents 2x、clean latents 4x、postをモデルに枡す堎合でも倀はれロベクトルですが、倀を枡すか吊かで結果は倉わりたす。特にno_postを指定するず、latent_window_sizeを倧きくしたずきに生成結果が䞍安定になる堎合がありたす。

通垞は--video_sections 1 ずしお1セクションのみ画像1枚を指定しおください。

target_index をデフォルトの9から倧きくするず、倉化量が倧きくなる可胜性がありたす。40皋床たでは砎綻なく生成されるこずを確認しおいたす。

--end_image_pathは無芖されたす。

kisekaeichi method (Post Reference Options) and 1f-mc (Multi-Control) / kisekaeichi方匏ポスト参照オプションず1f-mcマルチコントロヌル

The kisekaeichi method was proposed by furusu. The 1f-mc method was proposed by mattyamonaca in pull request #304.

In this repository, these methods have been integrated and can be specified with the --one_frame_inference option. This allows for specifying any number of control images as clean latents, along with indices. This means you can specify multiple starting images and multiple clean latent posts. Additionally, masks can be applied to each image.

It is expected to work only with FramePack (non-F1 model) and not with F1 models.

The following options have been added to --one_frame_inference. These can be used in conjunction with existing flags like target_index, no_post, no_2x, and no_4x.

  • control_index=<integer_or_semicolon_separated_integers>: Specifies the index(es) of the clean latent for the control image(s). You must specify the same number of indices as the number of control images specified with --control_image_path.

Additionally, the following command-line options have been added. These arguments are only valid when --one_frame_inference is specified.

  • --control_image_path <path1> [<path2> ...] : Specifies the path(s) to control (reference) image(s) for one frame inference. Provide one or more paths separated by spaces. Images with an alpha channel can be specified. If an alpha channel is present, it is used as a mask for the clean latent.
  • --control_image_mask_path <path1> [<path2> ...] : Specifies the path(s) to grayscale mask(s) to be applied to the control image(s). Provide one or more paths separated by spaces. Each mask is applied to the corresponding control image. The 255 areas are referenced, while the 0 areas are ignored.

Example of specifying kisekaeichi:

The kisekaeichi method works without training, but using a dedicated LoRA may yield better results.

--video_sections 1 --output_type latent_images --image_path start_image.png --control_image_path start_image.png clean_latent_post_image.png \
--one_frame_inference target_index=1,control_index=0;10,no_post,no_2x,no_4x --control_image_mask_path ctrl_mask1.png ctrl_mask2.png

In this example, start_image.png (for clean_latent_pre) and clean_latent_post_image.png (for clean_latent_post) are the reference images. The target_index specifies the index of the generated image. The control_index specifies the clean latent index for each control image, so it will be 0;10. The masks for the control images are specified with --control_image_mask_path.

The optimal values for target_index and control_index are unknown. The target_index should be specified as 1 or higher. The control_index should be set to an appropriate value relative to latent_window_size. Specifying 1 for target_index results in less change from the starting image, but may introduce noise. Specifying 9 or 13 may reduce noise but result in larger changes from the original image.

The control_index should be larger than target_index. Typically, it is set to 10, but larger values (e.g., around 13-16) may also work.

Sample images and command lines for reproduction are as follows:

python fpack_generate_video.py --video_size 832 480 --video_sections 1 --infer_steps 25 \
    --prompt "The girl in a school blazer in a classroom." --save_path path/to/output --output_type latent_images \
    --dit path/to/dit --vae path/to/vae --text_encoder1 path/to/text_encoder1 --text_encoder2 path/to/text_encoder2 \
    --image_encoder path/to/image_encoder --attn_mode sdpa --vae_spatial_tile_sample_min_size 128 --vae_chunk_size 32 \
    --image_path path/to/kisekaeichi_start.png --control_image_path path/to/kisekaeichi_start.png path/to/kisekaeichi_ref.png 
    --one_frame_inference target_index=1,control_index=0;10,no_2x,no_4x,no_post 
    --control_image_mask_path path/to/kisekaeichi_start_mask.png path/to/kisekaeichi_ref_mask.png --seed 1234

Specify --fp8_scaled and --blocks_to_swap options according to your VRAM capacity.

Generation result: kisekaeichi_result.png

Example of 1f-mc (Multi-Control):

--video_sections 1 --output_type latent_images --image_path start_image.png --control_image_path start_image.png 2nd_image.png \
--one_frame_inference target_index=9,control_index=0;1,no_2x,no_4x 

In this example, start_image.png is the starting image, and 2nd_image.png is the reference image. The target_index=9 specifies the index of the generated image, while control_index=0;1 specifies the clean latent indices for each control image.

1f-mc is intended to be used in combination with a trained LoRA, so adjust target_index and control_index according to the LoRA's description.

日本語

kisekaeichi方匏はfurusu氏により提案されたした。たた1f-mc方匏はmattyamonaca氏によりPR #304 で提案されたした。

圓リポゞトリではこれらの方匏を統合し、--one_frame_inferenceオプションで指定できるようにしたした。これにより、任意の枚数の制埡甚画像を clean latentずしお指定し、さらにむンデックスを指定できたす。぀たり開始画像の耇数枚指定やclean latent postの耇数枚指定などが可胜です。たた、それぞれの画像にマスクを適甚するこずもできたす。

なお、FramePack無印のみ動䜜し、F1モデルでは動䜜しないず思われたす。

--one_frame_inferenceに以䞋のオプションが远加されおいたす。target_index、no_post、no_2xやno_4xなど既存のフラグず䜵甚できたす。

  • control_index=<敎数たたはセミコロン区切りの敎数>: 制埡甚画像のclean latentのむンデックスを指定したす。--control_image_pathで指定した制埡甚画像の数ず同じ数のむンデックスを指定しおください。

たたコマンドラむンオプションに以䞋が远加されおいたす。これらの匕数は--one_frame_inferenceを指定した堎合のみ有効です。

  • --control_image_path <パス1> [<パス2> ...] : 1フレヌム掚論甚の制埡甚参照画像のパスを1぀以䞊、スペヌス区切りで指定したす。アルファチャンネルを持぀画像が指定可胜です。アルファチャンネルがある堎合は、clean latentぞのマスクずしお利甚されたす。
  • --control_image_mask_path <パス1> [<パス2> ...] : 制埡甚画像に適甚するグレヌスケヌルマスクのパスを1぀以䞊、スペヌス区切りで指定したす。各マスクは察応する制埡甚画像に適甚されたす。255の郚分が参照される郚分、0の郚分が無芖される郚分です。

kisekaeichiの指定䟋:

kisekaeichi方匏は孊習なしでも動䜜したすが、専甚のLoRAを䜿甚するこずで、より良い結果が埗られる可胜性がありたす。

--video_sections 1 --output_type latent_images --image_path start_image.png --control_image_path start_image.png clean_latent_post_image.png \
--one_frame_inference target_index=1,control_index=0;10,no_post,no_2x,no_4x --control_image_mask_path ctrl_mask1.png ctrl_mask2.png

start_image.pngclean_latent_preに盞圓ずclean_latent_post_image.pngは参照画像clean_latent_postに盞圓です。target_indexは生成する画像のむンデックスを指定したす。control_indexはそれぞれの制埡甚画像のclean latent indexを指定したすので、0;10 になりたす。たた--control_image_mask_pathに制埡甚画像に適甚するマスクを指定したす。

target_index、control_indexの最適倀は䞍明です。target_indexは1以䞊を指定しおください。control_indexはlatent_window_sizeに察しお適切な倀を指定しおください。target_indexに1を指定するず開始画像からの倉化が少なくなりたすが、ノむズが乗ったりするこずが倚いようです。9や13などを指定するずノむズは改善されるかもしれたせんが、元の画像からの倉化が倧きくなりたす。

control_indexはtarget_indexより倧きい倀を指定しおください。通垞は10ですが、これ以䞊倧きな倀、たずえば`13~16皋床でも動䜜するようです。

サンプル画像ず再珟のためのコマンドラむンは以䞋のようになりたす。

python fpack_generate_video.py --video_size 832 480 --video_sections 1 --infer_steps 25 \
    --prompt "The girl in a school blazer in a classroom." --save_path path/to/output --output_type latent_images \
    --dit path/to/dit --vae path/to/vae --text_encoder1 path/to/text_encoder1 --text_encoder2 path/to/text_encoder2 \
    --image_encoder path/to/image_encoder --attn_mode sdpa --vae_spatial_tile_sample_min_size 128 --vae_chunk_size 32 \
    --image_path path/to/kisekaeichi_start.png --control_image_path path/to/kisekaeichi_start.png path/to/kisekaeichi_ref.png 
    --one_frame_inference target_index=1,control_index=0;10,no_2x,no_4x,no_post 
    --control_image_mask_path path/to/kisekaeichi_start_mask.png path/to/kisekaeichi_ref_mask.png --seed 1234

VRAM容量に応じお、--fp8_scaledや--blocks_to_swap等のオプションを調敎しおください。

生成結果:

1f-mcの指定䟋:

--video_sections 1 --output_type latent_images --image_path start_image.png --control_image_path start_image.png 2nd_image.png \
--one_frame_inference target_index=9,control_index=0;1,no_2x,no_4x 

この䟋では、start_image.pngが開始画像で、2nd_image.pngが参照画像です。target_index=9は生成する画像のむンデックスを指定し、control_index=0;1はそれぞれの制埡甚画像のclean latent indexを指定しおいたす。

1f-mcは孊習したLoRAず組み合わせるこずを想定しおいたすので、そのLoRAの説明に埓っお、target_indexやcontrol_indexを調敎しおください。