# MiniMax-H3

  
    
  

MiniMax-H3 は、動画とそのサウンドトラックを同時に生成します。単一の transformer が、テキストの条件付け、条件付けメディア、およびターゲットとなる動画と音声の潜在変数を含む、1 つのパックされたシーケンスをデノイズします。独立した vocoder も、事後の音声処理パスも存在しません。動画と音声は、同じデノイジングループから出力されます。

[MiniMaxAI](https://huggingface.co/MiniMaxAI)組織の下で、元のMiniMax-H3のチェックポイントを見つけることができます。

MiniMax-H3 は [Modular Diffusers](../../modular_diffusers/overview) ブロックのみとして統合されており、[Anima](./anima) と同じです。つまり、ブロックとその [MiniMaxH3ModularPipeline](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.MiniMaxH3ModularPipeline) が統合のすべてであり、`DiffusionPipeline` 側は存在しません。

## チェックポイントのレイアウト

MiniMax-H3 は、transformer を除くすべてのコンポーネントを共有する 2 つのチェックポイントパーティションとしてリリースされたため、diffusers による変換では両方を**1 つのリポジトリ**にまとめます:

| サブフォルダ | ワークフロー |
|---|---|
| `transformer/` | `t2va`（テキストのみ）、`fl2va`（最初のキーフレームと/または最後のキーフレーム） |
| `transformer_ref/` | `ref2va`（画像、動画、音声の参照の順序付きミックス） |

Transformer 以外のコンポーネント、すなわち動画 VAE、音声 VAE、Qwen3-VL conditioner、その tokenizer と processor、および 2 つの scheduler は共有され、1 回だけ保存されます。

conditioner は `Qwen3VLForConditionalGeneration` であり、MiniMax-H3 は最後の層ではなく 50 番目の decoder layer 直後の *正規化されていない* hidden state を読み取ります。そのため、公開されている完全な checkpoint が使用され、language-model head は使用されません。

3つのタスクはすべて [MiniMaxH3Blocks](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.MiniMaxH3Blocks) のワークフローであり、リポジトリには各コンポーネントを独自の読み込み仕様とともに列挙した `modular_model_index.json` が含まれています。単一のタスクをサーブするには、そのワークフローを `from_pretrained` に渡します。これにより、そのワークフローのブロックのみが保持されるため、パイプラインのシグネチャ（`pipe.doc`）にはそのタスクのインプットのみがドキュメント化され、そのタスクのコンポーネントのみが宣言され、`load_components` はそれらのサブフォルダのみを取得します。つまり、`t2va` / `fl2va` パイプラインは `transformer_ref/` にアクセスせず、`ref2va` パイプラインは `transformer/` にアクセスしません。

```py
import torch
from diffusers import ModularPipeline

pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", workflow="ref2va")
pipe.load_components(dtype=torch.bfloat16)
```

> [!TIP]
> `pipe.doc` は、対象の pipeline が受け取る入力と返す出力を表示します。デフォルト値付きのすべての入力、期待されるコンポーネント、および生成される出力が列挙されます。特定の 1 つのワークフローに絞り込むことで、そのタスクが正確に記述されるため、リクエストを作成する前に必要なものを把握する最速の方法となります。

すべてのワークフローを1つのパイプラインで利用可能にするには、`workflow`引数を省略してください。そうすると、パイプラインは渡された入力に基づいて、呼び出しごとにワークフローを選択します。

```py
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3")
```

*読み込み*は、依然としてワークフローごとに1つずつ行われます。この1回の呼び出しで、`transformer/`とすべての共有コンポーネントを取得し、`t2va`と`fl2va`の両方に使用できます。

```py
pipe.load_components(workflow="t2va", dtype=torch.bfloat16)
```

`load_components()` に `workflow=` を指定しない場合、**両方の** 61.7GB の transformer パーティションが読み込まれます。これにより、追加の読み込み呼び出しなしで 1 つのパイプラインが 3 つのワークフローすべてに対応できます。[ComponentsManager](/docs/diffusers/main/ja/api/modular_diffusers/pipeline_components#diffusers.ComponentsManager) と自動オフロードを組み合わせると、重みはホスト RAM に保持され、マネージャーは各ステップに必要な分だけをアクセラレーター上に移動します。そのため、`ref2va` デノイザーがデバイスが必要になったとき、戦略は十分な空き領域を確保するためにオフロードを行います。具体的な手順は [メモリ](#memory) を参照してください。

## 2つのスケジューラ

1ステップごとの単一のtransformer呼び出し内で、動画と音声のlatentsはそれぞれ異なるスケジュールに沿ってステップダウンするため、ブロックは2つの[MiniMaxH3Scheduler](/docs/diffusers/main/ja/api/schedulers/minimax_h3#diffusers.MiniMaxH3Scheduler)インスタンスを期待します。動画latents用の`scheduler`（公開されているチェックポイントでは`shift=12.0`）と、音声latents用の`audio_scheduler`（`shift=3.0`）です。

両方の transformer パーティションは guidance-distilled であるため、この点はすべてのワークフローに当てはまります。guidance は重みに組み込まれており、guider も `negative_prompt` も `guidance_scale` も存在せず、各ステップでは正確に 1 回の forward pass が実行されます。

## 生成の制約

- **24 fps、5〜15秒。** `num_frames`は、動画VAEがデコード可能な次の`17 * n + 5`に切り上げられ、生成される動画の長さはその範囲内に収まる必要があります。
- **短辺768ピクセル。** `height`と`width`のデフォルト値は、MiniMax-H3独自のキャンバス（最初のキーフレームのアスペクト比、キーフレームがない場合は16:9）であり、32の倍数である必要があります。
- **1つのジェネレーターから3回のサンプリング。** リクエストは、まずキーフレームまたは参照条件のノイズ、次に動画ノイズ、最後に音声ノイズを、渡された`generator`から順にサンプリングします。そのため、同じジェネレーター状態から2回実行しても、同じ動画とサウンドトラックが返されます。`latents`または`audio_latents`を渡すと、対応するサンプリングが置き換えられます。
- **`num_inference_steps` counts sigma grid points**, the terminal `0` included, so it drives one model evaluation less.

## メモリ

transformer 単体は bfloat16 で 61.7 GB、Qwen3-VL conditioner はさらに 62.1 GB あるため、読み込み方法はハードウェアに依存します。すべての環境において、最も大きな速度改善の要因はキャンバスのサイズです。`height` と `width` は 32 の倍数であればよく、学習時の 1344x768 と比べて 960x544 を使用すると、ステップあたりの処理速度が約 2.3 倍速くなります。

80 GBのカード1枚上で、コンポーネントを[ComponentsManager](/docs/diffusers/main/ja/api/modular_diffusers/pipeline_components#diffusers.ComponentsManager)に登録し、アクセラレーターへの移動と退避を委ねます:

```py
import torch
from diffusers import ComponentsManager, ModularPipeline

manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", components_manager=manager)
pipe.load_components(workflow="t2va", dtype=torch.bfloat16)
manager.enable_auto_cpu_offload(device="cuda", memory_reserve_margin="12GB")  # or "mps", "xpu", "cpu"
pipe.transformer.set_attention_backend("_flash_3_hub")  # Hopper, roughly 3x faster; kernels fetched from the Hub
```

コンシューマー向けGPU（24〜32 GB）では、読み込み時に2つの大きなコンポーネントをint8に量子化し、transformerのブロックをCPU RAMからストリーミングします。以下では、サポートされているローダーのみを使用し、パッチは不要で、bfloat16のチェックポイントからそのまま動作します。

```py
import torch
from diffusers import MiniMaxH3Transformer3DModel, ModularPipeline, TorchAoConfig
from diffusers.hooks import apply_group_offloading
from transformers import Qwen3VLForConditionalGeneration
from transformers import TorchAoConfig as TransformersTorchAoConfig
from torchao.quantization import Int8WeightOnlyConfig

pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3")
pipe.update_components(
    transformer=MiniMaxH3Transformer3DModel.from_pretrained(
        "MiniMaxAI/MiniMax-H3", subfolder="transformer", dtype=torch.bfloat16,
        quantization_config=TorchAoConfig(
            Int8WeightOnlyConfig(version=2),
            modules_to_not_convert=[
                "proj_in", "audio_proj_in", "context_embedder", "time_embedder", "time_proj",
                "token_refiner", "norm_out", "proj_out", "audio_proj_out",
            ],
        ),
        low_cpu_mem_usage=False,
    ),
    text_encoder=Qwen3VLForConditionalGeneration.from_pretrained(
        "MiniMaxAI/MiniMax-H3", subfolder="text_encoder", dtype=torch.bfloat16,
        quantization_config=TransformersTorchAoConfig(
            Int8WeightOnlyConfig(version=2),
            modules_to_not_convert=["model.visual", "model.language_model.embed_tokens", "model.language_model.norm", "lm_head"],
        ),
    ),
)
pipe.load_components(workflow="t2va", dtype=torch.bfloat16)

# version=2 int8 tensors are pinnable, which streamed offload needs, and freezing removes the one autograd
# path the quantized tensors cannot serve.
pipe.transformer.requires_grad_(False)
pipe.text_encoder.requires_grad_(False)

offload = dict(onload_device=torch.device("cuda"), offload_device=torch.device("cpu"), use_stream=True)
pipe.transformer.enable_group_offload(offload_type="block_level", num_blocks_per_group=1, **offload)
apply_group_offloading(pipe.text_encoder.model, offload_type="leaf_level", **offload)
pipe.vae.to("cuda")  # or "mps", "xpu", "cpu"
pipe.audio_vae.to("cuda")
```

12〜16 GB の環境では、`offload_type="leaf_level"`（ストリームなし）でビデオ VAE グループもオフロードし、960x544 のような小さなキャンバスを使用することで、同じレシピが機能します。重みはホスト RAM に配置されるため、int8 量子化の場合、約 75 GB の RAM が必要になることを想定してください。

2枚のカードを使用する場合、オフロードは不要です。パイプラインを2分割し、それぞれの半分を個別のデバイスに配置します。

```py
import torch
from diffusers import ComponentsManager, ModularPipeline

workflow = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3").blocks.get_workflow("t2va")

text_manager = ComponentsManager()
text_manager.enable_auto_cpu_offload(device="cuda:1")
conditioner = workflow.sub_blocks.pop("text_encoder").init_pipeline(
    "MiniMaxAI/MiniMax-H3", components_manager=text_manager
)
conditioner.load_components(dtype=torch.bfloat16)

manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda:0")
rest = workflow.init_pipeline("MiniMaxAI/MiniMax-H3", components_manager=manager)
rest.load_components(dtype=torch.bfloat16)

prompt = "A red fox trotting through a snowy pine forest, snow crunching underfoot"
state = conditioner(prompt=prompt)
results = rest(
    state=state,
    num_frames=124,
    generator=torch.Generator().manual_seed(42),
    output=["videos", "audio", "sampling_rate"],
)
```

2枚の80 GBカードでは、この方法でフルのbfloat16を実行できます。各半分がそれぞれ1枚のカードに収まるため、一度メモリに読み込まれた後はホストメモリへ退避されません。2枚の48 GBカードでも、上記のint8読み込みを両方のコンポーネントに適用することで同様に動作します。

## テキストとキーフレーム

[MiniMaxH3Blocks](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.MiniMaxH3Blocks)は、テキストから動画と音声への生成、およびキーフレーム条件付けに対応しています。キーフレームは、動画の開始フレーム(`image`)、終了フレーム(`last_image`)、またはその両方として指定できます。

```py
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.utils import load_image
from diffusers.utils.export_utils import encode_video

# 61.7GB of transformer and 62.1GB of conditioner do not sit on one accelerator, so the components are
# registered in a manager that moves each one on and off as the blocks reach it. See [Memory](#memory).
manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda")  # or "mps", "xpu", "cpu"

pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", components_manager=manager)
pipe.load_components(workflow="fl2va", dtype=torch.bfloat16)

prompt = "A red fox trotting through a snowy pine forest, snow crunching underfoot"
# `output=` returns exactly the named outputs instead of the whole pipeline state.
outputs = ["videos", "audio", "sampling_rate"]

# Text to video + audio.
results = pipe(prompt=prompt, num_frames=124, generator=torch.Generator().manual_seed(42), output=outputs)

# First frame (and optionally last frame) to video + audio. The canvas follows the first keyframe.
image = load_image(
    "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg"
)
results = pipe(prompt=prompt, image=image, num_frames=124, generator=torch.Generator().manual_seed(42), output=outputs)

encode_video(
    results["videos"][0],
    fps=24,
    output_path="minimax_h3_fl2va.mp4",
    audio=results["audio"][0],
    audio_sample_rate=results["sampling_rate"],
)
```

動画と音声は同時に生成され、`sampling_rate` を伴うサウンドトラックとともに、`videos` と `audio` という別々の出力として呼び出しから返されます。これらを1つのファイルにマックスする処理は呼び出し側で行う必要があり、例えば [encode_video()](/docs/diffusers/main/ja/api/utilities#diffusers.utils.encode_video) を使用します。

## オムニリファレンス

`ref2va`ワークフローは、順序付きの参照リストを条件として使用します。最大9枚の画像、3本の動画、3つの音声クリップ、合計12個まで指定できます。順序には意味があります。プロンプト内の参照のラベル（`"<Picture 1>"`、`"<Audio 1>"`、`"<Video 1>"`）を決定し、共有される音声/動画のロータリークロックを進めるため、同じ参照を並べ替えると別のリクエストになります。

上記のキーフレームとは異なり、リファレンスは生成されるジオメトリを拘束しません。リファレンスは独自の解像度でエンコードされ、ターゲットキャンバスのデフォルトはMiniMax-H3の16:9です。

モダリティごとに1つの参照クラスがあり、それぞれがメモリ内のメディアと、そのメディアが持つレート（rate）を保持します。

| リファレンス | メディア | 宣言するレート |
| --- | --- | --- |
| [MiniMaxH3ImageReference](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference) | `image` | — |
| [MiniMaxH3VideoReference](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference) | `frames`、および独自のサウンドトラック用の`audio` | `fps`（デフォルトは MiniMax-H3 の 24.0）、および `sample_rate` |
| [MiniMaxH3AudioReference](/docs/diffusers/main/ja/api/pipelines/minimax_h3#diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference) | `audio` | `sample_rate`、デフォルトではオーディオVAE自身の |

レートは、すべてのリサンプリングの基準となります。具体的には、MiniMax-H3 独自の 24 fps へフレームを削除・複製して整える処理や、波形をオーディオ VAE のサンプルレートへ整える処理です。MiniMax-H3 独自のレートで生成されたメディアはそのまま処理されるため、他のレートで生成されたデータのみ、その旨を明示する必要があります。

リファレンスは2つの方法のいずれかで構築されます。クラスの`from_file`クラスメソッドでメディアファイルからデコードするか、リクエストがすでにメモリに保持しているメディアから直接構築するかです。後者の方法が、前回の生成結果をフィードバックする仕組みになっています（[生成結果をリファレンスとして利用する](#a-generation-as-a-reference)を参照）。

ブロックはメディアファイルを開くことはありません。パスのデコードは、ライブラリの他の箇所と同様に呼び出し側の責任です。各リファレンスクラスは、`from_file` クラスメソッドを通じてこれを行います。このメソッドはパスまたは URL を受け取り（動画と音声は [PyAV](https://github.com/PyAV-Org/PyAV) を経由します）、コンテナが報告するレートを持つリファレンスを返します。動画の場合は、フレームレートとサウンドトラックが一緒に含まれます。[load_video()](/docs/diffusers/main/ja/api/utilities#diffusers.utils.load_video) はフレームレートを失うため、`from_file` を優先してください。実際のレートが失われたフレームから構築されたリファレンスは、誤った速度で条件付けられ、何も警告されません。

```py
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.modular_pipelines.minimax_h3 import (
    MiniMaxH3AudioReference,
    MiniMaxH3ImageReference,
    MiniMaxH3VideoReference,
)
from diffusers.utils import load_video
from diffusers.utils.export_utils import encode_video

# `ref2va` is a workflow of the one MiniMax-H3 pipeline; selecting it loads only the `transformer_ref/`
# checkpoint partition, and the manager moves each component on and off the accelerator in turn.
manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda")  # or "mps", "xpu", "cpu"

pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", workflow="ref2va", components_manager=manager)
pipe.load_components(dtype=torch.bfloat16)

subject = MiniMaxH3ImageReference.from_file(
    "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg"
)

# Decoding a file brings its rates along: the video its own frame rate and its soundtrack, the clip its sample rate.
results = pipe(
    prompt="The character speaks in time with the reference recording, natural lip movement",
    references=[
        subject,
        MiniMaxH3VideoReference.from_file(
            "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4"
        ),
        MiniMaxH3AudioReference.from_file("voice.wav"),
    ],
    num_frames=124,
    output=["videos", "audio", "sampling_rate"],
)

# Frames a request already holds declare the rate they carry — `load_video` does not preserve it.
motion = load_video("motion_ref.mp4")
results = pipe(
    prompt="The subject walks toward camera, matching the reference video's shot rhythm",
    references=[subject, MiniMaxH3VideoReference(frames=motion, fps=30.0)],
    num_frames=124,
    output=["videos", "audio", "sampling_rate"],
)

encode_video(
    results["videos"][0],
    fps=24,
    output_path="minimax_h3_ref2va.mp4",
    audio=results["audio"][0],
    audio_sample_rate=results["sampling_rate"],
)
```

`num_frames` は `ref2va` に必須です。参照サウンドトラックと完全に同じ長さの動画を生成するには、クリップから計算します — `round(samples / sample_rate * 24)` — すると、動画 VAE がデコードできる次の `17 * n + 5` に切り上げられます。生成される動画の長さは、MiniMax-H3 が生成する 5 秒から 15 秒の範囲内に収まる必要があります。

### 参照としての世代

ワークフローが1つのパイプラインを共有しているため、`t2va` による生成結果をそのまま `ref2va` の参照として使用できます。インメモリコンストラクタは、まさにこの引き継ぎのために設計されています。生成されたメディアはすでに MiniMax-H3 自身のレート（フレームは 24 fps、サウンドトラックはオーディオ VAE のサンプルレート）で出力されるため、参照にはレート引数は不要であり、有損コンテナ経由で再エンコードされることもありません。

```py
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.modular_pipelines.minimax_h3 import MiniMaxH3VideoReference

manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda")  # or "mps", "xpu", "cpu"

# The full pipeline holds every workflow and picks one per call from the inputs. Loading without a
# `workflow=` brings both transformer partitions in one call, so the `ref2va` request that follows the
# `t2va` generation needs no further loading.
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", components_manager=manager)
pipe.load_components(dtype=torch.bfloat16)

results = pipe(
    prompt="An astronaut hiking through the mountains, humming a tune",
    num_frames=124,
    output=["videos", "audio", "sampling_rate"],
)

reference = MiniMaxH3VideoReference(
    frames=results["videos"][0],
    audio=results["audio"][0],
    sample_rate=results["sampling_rate"],
)
results = pipe(
    prompt="The same astronaut now walks along a beach at sunset, humming the same tune",
    references=[reference],
    num_frames=124,
    output=["videos", "audio", "sampling_rate"],
)
```

## MiniMaxH3ModularPipeline[[diffusers.MiniMaxH3ModularPipeline]]

#### diffusers.MiniMaxH3ModularPipeline[[diffusers.MiniMaxH3ModularPipeline]]

```python
diffusers.MiniMaxH3ModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/modular_pipeline.py#L150)

MiniMax-H3 による動画と音声の同時生成に対応した ModularPipeline: `t2va`（テキストのみ）および `fl2va`（先頭および/または末尾のキーフレーム）ワークフローは `transformer/` チェックポイントパーティションに対して、`ref2va`（オムニリファレンス）ワークフローは `transformer_ref/` に対して動作します。1 つのリポジトリに両方のパーティションが含まれており、ワークフローを選択すると、その

own:

```py
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", workflow="ref2va")
```

MiniMax-H3 は、テキストの条件付け、キーフレームの条件付け潜在変数、オーディオの潜在変数、およびビデオの潜在変数を同時に保持する**1つのパックされたシーケンス**をノイズ除去します。そのため、ブロックはモダリティごとのテンソルではなく行レイアウトを渡り回し、パイプラインはビデオ用に`shift = 12.0`、オーディオ用に`shift = 3.0`という2つのスケジューラを持ち、これらは単一のトランスフォーマー呼び出しの中でステップされます。

チェックポイントはガイダンス蒸留済みです。ガイダンスが重みに焼き込まれているため、guider も `negative_prompt` も `guidance_scale` も不要であり、各ステップでフォワードパスがちょうど 1 回だけ実行されます。

MiniMax-H3 はモジュール式のみです。このパイプラインとそのブロックが統合のすべてであり、`DiffusionPipeline` の半分というものは存在しません。このモジュールは、各ブロックが参照するモデルの事実を保持します。config から導出されたジオメトリはプロパティとして、キャンバスとフレーム数の計算は関数として実装されています。また、条件付け、エンコーディング、ノイズの契約はブロック自体に定義されています。

```py
import torch
from diffusers import ModularPipeline

pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3")
pipe.load_components(dtype=torch.bfloat16)
```

## MiniMaxH3Blocks[[diffusers.MiniMaxH3Blocks]]

#### diffusers.MiniMaxH3Blocks[[diffusers.MiniMaxH3Blocks]]

```python
diffusers.MiniMaxH3Blocks()
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/modular_blocks_minimax_h3.py#L659)

MiniMax-H3 による動画と音声の同時生成に対応した Auto Modular パイプラインブロックです。`t2va`（テキストのみ）、`fl2va`（先頭および/または末尾のキーフレーム）、`ref2va`（オムニリファレンス）のワークフローは、`references` とキーフレームの入力によって選択されます。`workflow=` を指定せずにコンポーネントを読み込むと、**両方の** 61.7GB のトランスフォーマーパーティションが読み込まれるため、タスクに必要なもののみを読み込むには、いずれかを指定してください。

サポートされているワークフロー:
- `t2va`: `prompt`が必要です
- `fl2va`: `prompt`、`image`、または `prompt`、`last_image` が必要です
- `ref2va`: `prompt`、`references` が必要です

コンポーネント: image_processor (`VaeImageProcessor`) text_encoder (`Qwen3VLForConditionalGeneration`) tokenizer (`Qwen2Tokenizer`) processor (`Qwen3VLProcessor`) vae (`AutoencoderKLMiniMaxH3`) audio_vae (`AutoencoderKLMiniMaxH3Audio`) scheduler (`MiniMaxH3Scheduler`) audio_scheduler (`MiniMaxH3Scheduler`) transformer_ref (`MiniMaxH3Transformer3DModel`) transformer (`MiniMaxH3Transformer3DModel`) video_processor (`VideoProcessor`)

設定: canvas_short_edge (デフォルト: 768) canvas_max_pixels (デフォルト: 1032192) reference_image_short_edge (デフォルト: 2048)

Inputs: references (`list`、*省略可*): 条件付けに使用する参照です。**モデルがそれらを参照する順序**に従って指定します。順序はプロンプト提示におけるラベル付けと、共有ロータリークロック上での配置を決定するため、順序が異なれば異なるリクエストとなります。モダリティごとに1つのデータクラスがあり、すべてメモリ内のメディアを保持します。`MiniMaxH3ImageReference`（最大9個）、独自の`fps`を持つ`MiniMaxH3VideoReference`（最大3個、その`audio`サウンドトラックも条件付けの対象）、または独自の`sample_rate`を持つ`MiniMaxH3AudioReference`（最大3個）です。参照の合計は最大12個までで、オーディオ参照のみを指定することはできません。これらのブロックはメディアファイルを開きません。各クラスの`from_file`クラスメソッドでデコードし、レートも一緒に読み込みます。height (`int`、*省略可*): 生成される動画のピクセル単位の縦幅です。32の倍数である必要があります。width (`int`、*省略可*): 生成される動画のピクセル単位の横幅です。32の倍数である必要があります。num_frames (`int`、*省略可*): 生成するフレーム数です。固定の24 fpsで生成されます。動画VAEがデコードできる次の`17 * n + 5`に切り上げられます。結果として得られる再生時間は5秒から15秒の間でなければなりません。参照サウンドトラックと同じ長さの動画を生成するには、`round(samples / sample_rate * 24)`を渡します。image (`Image`、*省略可*): 動画の開始となるキーフレームです。ターゲットキャンバスに*引き伸ばして*配置されます。デフォルトでは、キャンバスは画像自身のアスペクト比から導出されます。last_image (`Image`、*省略可*): 動画の終了となるキーフレームです。単独で渡すことで、フレームまで*生成*できます。`image`と組み合わせて渡す場合、2つのキーフレームのうち後続者となり、キャンバスにカバークロップで配置されます。prompt (`str`): 生成をガイドするプロンプトです。単一の文字列です。normalized_references (`list`、*省略可*): セットアップステップで正規化された参照です。パックされた順序で指定します。keyframes (`list`、*省略可*): ターゲットキャンバスに配置されたキーフレームです。パックされた順序で指定します。condition_latents (`list`、*省略可*): エンコードされた動画条件付けラテンツです。パックされた順序で、画像参照と動画参照ごとに1つです。その形状は、すべての参照ブロックのジオメトリの来源です。audio_condition_latents (`list`、*省略可*): エンコードされたオーディオ条件付け行です。パックされた順序で、オーディオを持つ参照ごとに1つです。generator (`Generator`、*省略可*): リクエストのジェネレーターです。条件付けノイズは、生成される行のノイズよりも先に、条件ごとに1回ずつ、このジェネレーターから抽出されます。latents (`Tensor`): 形状`(1, 24, num_latent_frames, latent_height, latent_width)`の事前生成された動画ノイズです。抽出の代わりに使用されます。audio_latents (`Tensor`): 形状`(2, 32, num_audio_latents)`の事前生成されたオーディオノイズです。num_inference_steps (`int`、*省略可*、デフォルトは50): デノイジングのステップ数です。**denoiser_input_fields (`None`、*省略可*): トランスフォーマーが名前によって読み取るパックされたシーケンスの構造記述です。`token_tags`、`position_ids`、および3つの行インデックステンソルです。attention_kwargs (`dict`、*省略可*): アテンションプロセッサ用の追加のkwargsです。keyframe_anchors (`tuple`、*省略可*、デフォルトは()): パックされた順序で、各キーフレームが動画のどの端にアンカーされるかを指定します。output_type (`str`、*省略可*、デフォルトはpil): 出力形式です。'pil'、'np'、または'pt'を指定します。

出力: videos (`list`): 生成された動画。 audio (`Tensor`): 生成されたサウンドトラック。形状は `(1, 2, num_samples)` です。 sampling_rate (`int`): 生成されたサウンドトラックのサンプリングレート (Hz)。

## MiniMaxH3ImageReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference]]

#### diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference]]

```python
diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor])
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L82)

**パラメータ:**

image (`PIL.Image.Image`、`np.ndarray` または `torch.Tensor`) : 参照画像: 画像、`(height, width, 3)` の配列、または `(3, height, width)` のテンソルで、`uint8` または `[0, 1]` 範囲の浮動小数点数です。生成されるジオメトリには決してバインドされません。リリースされたチェックポイントでは、リクエストが生成するキャンバスサイズに関わらず、自身の短辺を 2048 にしてエンコードされます。

被写体、スタイル、またはシーン参照: 1リクエストあたり最大9件。

#### from_file[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3ImageReference.from_file]]

```python
from_file(media)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L98)

**パラメータ:**

media (`str` または `os.PathLike`) : 画像のパスまたはURL。

`MiniMaxH3ImageReference`に、[load_image()](/docs/diffusers/main/ja/api/utilities#diffusers.utils.load_image)を通じて画像ファイルを読み込みます。

## MiniMaxH3VideoReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference]]

#### diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference]]

```python
diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference(frames: typing.Union[list[PIL.Image.Image], numpy.ndarray, torch.Tensor], fps: float | None = None, audio: typing.Optional[torch.Tensor] = None, sample_rate: int | None = None)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L110)

**パラメータ:**

frames (`list[PIL.Image.Image]`、`np.ndarray` または `torch.Tensor`) : 参照フレーム: 画像のリスト、`(num_frames, height, width, 3)` の配列、または `(num_frames, 3, height, width)` のテンソルで、`uint8` または `[0, 1]` 上の浮動小数点数です。

fps (`float`、*optional*、デフォルト値は 24.0) : `frames` が持つフレームレートです。この値により、参照のビジョンブロックがコンディショナーの 2 fps グリッド上に配置されます。MiniMax-H3 自体のクロックは 24 fps であるため、それ以外のレートは、フレーム全体を削除・複製することで 24 fps にリサンプリングされます。そのため、フレームがファイルから取得された場合は、このフィールドを正しく設定することが重要です。

audio (`torch.Tensor`、形状 `(channels, num_samples)`、*任意*) : この動画のサウンドトラック（モノラルまたはステレオ）。これは、参照そのものとしてではなく、参照のそれとして条件付けられます。省略した場合、参照はモーションのみを条件とします。

sample_rate (`int`, *optional*) : `audio` がサンプルを保持するレートです。省略した場合、オーディオ VAE 自身のレートが使用され、サンプルはそのまま保持されます。それ以外のレートが指定された場合は、そのレートにリサンプリングされます。

モーションとカメラのリファレンス: リクエストごとに最大3つまで、自身のサウンドトラックと合わせて条件付けられます。

#### from_file[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3VideoReference.from_file]]

```python
from_file(media)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L146)

**パラメータ:**

media (`str` または `os.PathLike`) : 動画のパスまたは URL。

**戻り値:** `MiniMaxH3VideoReference`

コンテナが報告するフレームレートで、音声ストリームがある場合はそのサウンドトラックおよびそのサウンドトラック自体のサンプルレートも保持する、`(num_frames, height, width, 3)` の `uint8` フレーム。

`MiniMaxH3VideoReference` に、元の解像度、フレームレート、および音声トラックを保持したまま、動画ファイルをデコードします。

レートは参照に反映されます。これが [load_video()](/docs/diffusers/main/ja/api/utilities#diffusers.utils.load_video) を使わずにこの方法でデコードする理由です。MiniMax-H3 は参照を独自の 24 fps にリサンプリングするため、入力時に失われたフレームレートは、誤った速度で条件付けされたリクエストとなり、何の警告も出されません。メタデータが誤っているコンテナは、返された参照の `fps` または `sample_rate` を上書きすることで修正できます。

[PyAV](https://github.com/PyAV-Org/PyAV)が必要です。

## MiniMaxH3AudioReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference]]

#### diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference]]

```python
diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference(audio: Tensor, sample_rate: int | None = None)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L172)

**パラメータ:**

audio (`torch.Tensor`、形状 `(channels, num_samples)`) : 参照用の波形（モノラルまたはステレオ）。

sample_rate (`int`, *optional*) : `audio` がサンプルを保持するレートです。省略した場合、オーディオ VAE 自身のレートが使用され、サンプルはそのまま保持されます。それ以外のレートが指定された場合は、そのレートにリサンプリングされます。

音声または音楽のリファレンス: 1リクエストあたり最大3つまで。単独では使用できず、オーディオリファレンスには少なくとも1つの画像または動画リファレンスとペアで指定する必要があります。コンディショナーには渡されず、オーディオVAEのみによってエンコードされます。

#### from_file[[diffusers.modular_pipelines.minimax_h3.MiniMaxH3AudioReference.from_file]]

```python
from_file(media)
```

[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/minimax_h3/references.py#L191)

**パラメータ:**

media (`str` または `os.PathLike`) : 音声のパスまたは URL、またはサウンドトラックを抽出する動画のパスまたは URL。

**戻り値:** `MiniMaxH3AudioReference`

コンテナが報告するサンプルレートでの、`(channels, num_samples)` の float32 波形。

オーディオファイルを、そのファイルが持つサンプルレートで`MiniMaxH3AudioReference`にデコードします。

[PyAV](https://github.com/PyAV-Org/PyAV)が必要です。

