# Qwen3-Omni-MOE

## 概要

Qwen3-Omni-MOEモデルは、Alibaba GroupのQwenチームが[Qwen3-Omni Technical Report](https://huggingface.co/papers/2509.17765)で提案した、統一されたマルチモーダルモデルです。

技術レポートの要旨は以下の通りです。

Qwen3-Omni は、テキスト、画像、音声、動画のいずれにおいても、単一モーダルモデルと比較して性能の劣化なしに最先端の性能を維持する、単一のマルチモーダルモデルです。Qwen3-Omni は Qwen シリーズ内の同サイズの単一モーダルモデルと同等の性能を発揮し、特に音声タスクで優れています。36 の音声および音視覚ベンチマークにおいて、Qwen3-Omni は 32 のベンチマークでオープンソース SOTA、22 のベンチマークで総合 SOTA を達成し、Gemini-2.5-Pro、Seed-ASR、GPT-4o-Transcribe といった強力なクローズドソースモデルを上回っています。Qwen3-Omni は Thinker-Talker MoE アーキテクチャを採用し、テキスト、画像、音声、動画にまたがる知覚と生成を統合することで、流暢なテキストと自然なリアルタイム音声を実現します。119 言語でのテキスト対話、19 言語での音声理解、10 言語での音声生成に対応しています。ストリーミング合成におけるファーストパケットのレイテンシを低減するため、Talker はマルチコードブック方式を用いて離散音声コーデックを自己回帰的に予測します。これらのコードブックの表現能力を活用し、計算負荷の高いブロックワイズ拡散を軽量な因果 ConvNet に置き換えることで、最初のコーデックフレームからのストリーミングを可能にしました。コールドスタート設定において、Qwen3-Omni は理論上のエンドツーエンドのファーストパケットレイテンシ 234 ms を達成します。マルチモーダル推論をさらに強化するため、任意のモーダルからの入力を明示的に推論する Thinking モデルを導入しました。研究コミュニティには汎用的な音声キャプショニングモデルが現状不足しているため、Qwen3-Omni-30B-A3B をファインチューニングして Qwen3-Omni-30B-A3B-Captioner を作成しました。これにより、任意の音声入力に対して詳細でハルシネーションの少ないキャプションを生成します。Qwen3-Omni-30B-A3B、Qwen3-Omni-30B-A3B-Thinking、Qwen3-Omni-30B-A3B-Captioner は Apache 2.0 ライセンスの下で公開されています。

## 注記

- [Qwen3OmniMoeForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeForConditionalGeneration) を使用して、音声とテキストの出力を生成します。出力タイプを1つだけ生成する場合は、テキストのみの出力には [Qwen3OmniMoeThinkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeThinkerForConditionalGeneration) を、音声のみの出力には [Qwen3OmniMoeTalkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerForConditionalGeneration) を使用します。
- 動画入力での処理時にメモリ不足エラーが発生する場合は、`processor.max_pixels`を小さくしてください。デフォルトでは最大値が非常に大きな値に設定されており、解像度が`processor.max_pixels`を超えない限り、高解像度のビジュアルはリサイズされません。
- プロセッサには、チャットメッセージをモデルの入力に変換するための独自の [apply_chat_template()](/docs/transformers/main/ja/main_classes/processors#transformers.ProcessorMixin.apply_chat_template) メソッドがあります。

## 使用例

`Qwen3-Omni`は[Huggingface Hub](https://huggingface.co/Qwen)で利用できます。

### 単一メディア推論

モデルはテキスト、画像、音声、動画をインプットとして受け取ることができます。推論のコード例を以下に示します。

```python
import soundfile as sf

from transformers import Qwen3OmniMoeForConditionalGeneration, Qwen3OmniMoeProcessor

model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto"
)
processor = Qwen3OmniMoeProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

conversations = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [
            {"type": "video", "video": "/path/to/video.mp4"},
            {"type": "text", "text": "What can't you hear and see in this video?"},
        ],
    },
]

inputs = processor.apply_chat_template(
    conversations,
    load_audio_from_video=True,
    add_generation_prompt=True,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
    fps=1,

    # kwargs to be passed to `Qwen3OmniMoeProcessor`
    padding=True,
    use_audio_in_video=True,
).to(model.device)

# Generation params for audio or text can be different and have to be prefixed with `thinker_` or `talker_`
text_ids, audio = model.generate(**inputs, use_audio_in_video=True, thinker_do_sample=False, talker_do_sample=True)
text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)

sf.write(
    "output.wav",
    audio.reshape(-1).detach().cpu().numpy(),
    samplerate=24000,
)
print(text)
```

### テキストのみの生成

テキスト出力のみを生成し、音声生成モデルを読み込まないことで計算量を節約するには、`Qwen3OmniMoeThinkerForConditionalGeneration`モデルを使用できます。

```python
from transformers import Qwen3OmniMoeProcessor, Qwen3OmniMoeThinkerForConditionalGeneration

model = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto",
)
processor = Qwen3OmniMoeProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

conversations = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [
            {"type": "video", "video": "/path/to/video.mp4"},
            {"type": "text", "text": "What can't you hear and see in this video?"},
        ],
    },
]

inputs = processor.apply_chat_template(
    conversations,
    load_audio_from_video=True,
    add_generation_prompt=True,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
    fps=1,

    # kwargs to be passed to `Qwen3OmniMoeProcessor`
    padding=True,
    use_audio_in_video=True,
).to(model.device)

text_ids = model.generate(**inputs, use_audio_in_video=True)
text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)

print(text)
```

### バッチ混在メディア推論

`Qwen3OmniMoeThinkerForConditionalGeneration` モデルを使用する場合、テキスト、画像、音声、動画など、さまざまなタイプのサンプルが混在した入力をバッチとして処理できます。以下に例を示します。

```python
import soundfile as sf
from transformers import Qwen3OmniMoeForConditionalGeneration, Qwen3OmniMoeProcessor

model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto"
)
processor = Qwen3OmniMoeProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

# Conversation with video only
conversation1 = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [
            {"type": "video", "path": "/path/to/video.mp4"},
        ]
    }
]

# Conversation with audio only
conversation2 = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [
            {"type": "audio", "path": "/path/to/audio.wav"},
        ]
    }
]

# Conversation with pure text
conversation3 = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [{"type": "text", "text": "who are you?"}],
    }
]

# Conversation with mixed media
conversation4 = [
    {
        "role": "system",
        "content": [
            {"type": "text", "text": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech."}
        ],
    },
    {
        "role": "user",
        "content": [
            {"type": "image", "path": "/path/to/image.jpg"},
            {"type": "video", "path": "/path/to/video.mp4"},
            {"type": "audio", "path": "/path/to/audio.wav"},
            {"type": "text", "text": "What are the elements can you see and hear in these media?"},
        ],
    }
]

conversations = [conversation1, conversation2, conversation3, conversation4]

inputs = processor.apply_chat_template(
    conversations,
    load_audio_from_video=True,
    add_generation_prompt=True,
    tokenize=True,
    return_dict=True,
    return_tensors="pt",
    fps=1,

    # kwargs to be passed to `Qwen3OmniMoeProcessor`
    padding=True,
    use_audio_in_video=True,
).to(model.thinker.device)

text_ids = model.generate(**inputs, use_audio_in_video=True)
text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)

print(text)
```

### オーディオのバッチ生成

[Qwen3OmniMoeForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeForConditionalGeneration) は、バッチ処理による音声出力の生成をサポートしています。例えば、テキストから音声へのバッチ生成が挙げられます。バッチサイズが 1 より大きい場合、生成された音声は、サンプルごとに 1 つの波形を含むリストとして返されます。各波形は自身の長さに合わせてトリミング済みのため、短いサンプルに不要な音声がパディングされることはありません。単一サンプルの呼び出しでは、引き続き 1 つのテンソルが返されます。

```python
import soundfile as sf
from transformers import AutoModelForTextToWaveform, AutoProcessor
import torch

model_id = "Qwen/Qwen3-Omni-30B-A3B-Instruct"
model = AutoModelForTextToWaveform.from_pretrained(model_id, device_map="auto")
processor = AutoProcessor.from_pretrained(model_id)
sampling_rate = 24000  # output sampling rate
max_new_tokens = 128  # maximum number of tokens to generate

system_text = (
    "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of "
    "perceiving auditory and visual inputs, as well as generating text and speech."
)
texts = [
    "Hello, I'm Qwen. How can I help you today? Just let me know!",
    "The weather is nice today.",
]
inputs = processor.apply_chat_template(
    [
        [
            {"role": "system", "content": [{"type": "text", "text": system_text}]},
            {
                "role": "user",
                "content": [
                    {
                        "type": "text",
                        "text": (
                            "Please read the following text aloud exactly as written, with no "
                            f"additional commentary:\n\n{text}"
                        ),
                    }
                ],
            },
        ]
        for text in texts
    ],
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt",
    processor_kwargs={"padding": True},
).to(model.device, dtype=model.dtype)

gen_kwargs = {
    "talker_do_sample": True,
    "speaker": "Ethan",     # Ethan, Chelsie
    "talker_max_new_tokens": max_new_tokens,
}
_, pred_waveform = model.generate(**inputs, **gen_kwargs)

for sample_id, audio in enumerate(pred_waveform):
    sf.write(f"qwen3_omni_output_{sample_id}.wav", audio.detach().to(torch.float32).cpu().numpy(), sampling_rate)
    print(f"Saved audio to qwen3_omni_output_{sample_id}.wav")
```

### 使用のコツ

#### 画像解像度のトレードオフ

このモデルは幅広い解像度の入力をサポートしています。デフォルトでは、入力にネイティブ解像度を使用しますが、より高い解像度を使用することで、計算コストの増加を代償にパフォーマンスを向上させることができます。ユーザーは、最小ピクセル数と最大ピクセル数を設定することで、ニーズに最適な構成を実現できます。

```python
min_pixels = 128*28*28
max_pixels = 768*28*28
processor = AutoProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)
```

#### 音声出力用のプロンプト

If users need audio output, the system prompt must be set as "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.", otherwise the audio output may not work as expected.

```json
{
    "role": "system",
    "content": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.",
}
```

#### 音声出力を使用するかどうか

モデルはテキスト出力と音声出力の両方をサポートしています。音声出力を必要としない場合は、`from_pretrained` 関数で `enable_audio_output` を設定できます。このオプションにより、GPU メモリを約 `~2GB` 節約できますが、`generate` 関数の `return_audio` オプションは `False` にのみ設定可能になります。

```python
model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto",
    enable_audio_output=False,
)
```

柔軟な体験を得るために、`from_pretrained` 関数でモデルを初期化する際に `enable_audio_output` を `True` に設定し、`generate` 関数を呼び出す際にオーディオを返すかどうかを決定することを推奨します。`return_audio` が `False` に設定されている場合、モデルはテキスト出力のみを返すため、テキストレスポンスをより高速に取得できます。

```python
model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto",
    enable_audio_output=True,
)
...
text_ids = model.generate(**inputs, return_audio=False)
```

#### 出力音声のボイスタイプを変更する

Qwen3-Omni-MOEは、出力音声の声を切り替える機能をサポートしています。ユーザーは`generate`関数の`speaker`パラメータを使用して、声の種類を指定できます。`"Qwen/Qwen3-Omni-30B-A3B-Instruct"`チェックポイントは2つの声の種類をサポートしています:`Chelsie`と`Ethan`です。ここで`Chelsie`は女性の声、`Ethan`は男性の声です。デフォルトでは、`speaker`が指定されていない場合、デフォルトの声の種類は`Chelsie`になります。

```python
text_ids, audio = model.generate(**inputs, speaker="Chelsie")
```

```python
text_ids, audio = model.generate(**inputs, speaker="Ethan")
```

#### Flash-Attention 2 を使用して生成を高速化

まず、Flash Attention 2 の最新バージョンをインストールしてください。

```bash
pip install -U flash-attn --no-build-isolation
```

また、FlashAttention 2 に対応するハードウェアが必要です。詳細については、[flash attention リポジトリ](https://github.com/Dao-AILab/flash-attention)の公式ドキュメントを参照してください。FlashAttention-2 は、モデルが `torch.float16` または `torch.bfloat16` で読み込まれている場合のみ使用できます。

FlashAttention-2 を使用してモデルを読み込み、実行するには、モデルの読み込み時に `attn_implementation="flash_attention_2"` を追加します:

```python
from transformers import Qwen3OmniMoeForConditionalGeneration

model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-Omni-30B-A3B-Instruct",
    device_map="auto",
    attn_implementation="flash_attention_2",
)
```

## Qwen3OmniMoeConfig[[transformers.Qwen3OmniMoeConfig]]

#### transformers.Qwen3OmniMoeConfig[[transformers.Qwen3OmniMoeConfig]]

```python
transformers.Qwen3OmniMoeConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, thinker_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, talker_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, code2wav_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, enable_audio_output: bool = True, im_start_token_id: int = 151644, im_end_token_id: int = 151645, tts_pad_token_id: int = 151671, tts_bos_token_id: int = 151672, tts_eos_token_id: int = 151673, system_token_id: int = 8948, user_token_id: int = 872, assistant_token_id: int = 77091, initializer_range: float | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L536)

**パラメータ:**

thinker_config (`dict`, *任意*) : 基盤となるthinkerサブモデルの設定。

talker_config (`dict`, *任意*) : 基盤となる talker サブモデルの設定。

code2wav_config (`dict`, *任意*) : 基盤となる code2wav サブモデルの設定。

enable_audio_output (`bool`、*任意*、デフォルトは`True`) : 音声出力を有効にし、talkerおよびcode2wavモジュールを読み込むかどうか。

im_start_token_id (`int`, *任意*, デフォルトは 151644) : 画像の開始を示すトークン ID

im_end_token_id (`int`, *任意*, デフォルトは 151645) : 画像の終了を示すトークン ID

tts_pad_token_id (`int`, *任意*, デフォルトは 151671) : TTS におけるパディング用のトークン ID

tts_bos_token_id (`int`, *optional*, デフォルトは 151672) : TTS におけるシーケンス開始のトークン ID

tts_eos_token_id (`int`, *optional*, デフォルトは 151673) : 画像の TTS におけるシーケンスの終了を示すトークン ID

system_token_id (`int`、*任意*、デフォルトは 8948) : システムプロンプトのトークン ID

user_token_id (`int`、*任意*、デフォルトは 872) : ユーザープロンプトのトークン ID

assistant_token_id (`int`、*任意*、デフォルトは 77091) : アシスタントプロンプトのトークン ID

initializer_range (`float`, *任意*) : すべての重み行列を初期化するための truncated_normal_initializer の標準偏差。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

例:

```python
>>> from transformers import (
...     Qwen3OmniMoeThinkerConfig,
...     Qwen3OmniMoeTalkerConfig,
...     Qwen3OmniMoeCode2WavConfig,
...     Qwen3OmniMoeForConditionalGeneration,
...     Qwen3OmniMoeConfig,
... )

>>> # Initializing a Qwen3OmniMoe style configuration
>>> configuration = Qwen3OmniMoeConfig()

>>> # Initializing a model from the configuration
>>> model = Qwen3OmniMoeForConditionalGeneration(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```

#### get_text_config[[transformers.Qwen3OmniMoeConfig.get_text_config]]

```python
get_text_config(decoder = False)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L610)

**パラメータ:**

decoder (`Optional[bool]`、*任意*、デフォルトは`False`) : `True`に設定すると、デコーダーの構成ファイル名のみを検索します。

テキスト I/O で使用される設定を返します。ほとんどのモデルでは、元の設定インスタンス自体です。特定の複合モデルでは、有効な名前のセットの下にあります。

## Qwen3OmniMoeThinkerConfig[[transformers.Qwen3OmniMoeThinkerConfig]]

#### transformers.Qwen3OmniMoeThinkerConfig[[transformers.Qwen3OmniMoeThinkerConfig]]

```python
transformers.Qwen3OmniMoeThinkerConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, audio_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, vision_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, text_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, position_id_per_seconds: int = 25, audio_start_token_id: int = 151647, user_token_id: int = 872, initializer_range: float = 0.02, tie_word_embeddings: bool = False, audio_token_id: int = 151646, image_token_id: int = 151655, video_token_id: int = 151656)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L194)

**パラメータ:**

audio_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *任意*) : 音声バックボーンの config オブジェクトまたは辞書。

vision_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *任意*) : ビジョンバックボーンの config オブジェクトまたは辞書。

text_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *任意*) : テキストバックボーンの config オブジェクトまたは辞書。

position_id_per_seconds (`int`、*optional*、デフォルトは 25) : 1 秒あたりの position id の増分。

audio_start_token_id (`int`, *optional*, デフォルトは 151647) : 音声プロンプトをエンコードするための音声開始トークン ID。

user_token_id (`int`, *optional*, デフォルトは 872) : ユーザートークンをエンコードするためのユーザートークンIDです。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

tie_word_embeddings (`bool`, *任意*, デフォルトは `False`) : モデルの `tied_weights_keys` マッピングに従って重み埋め込みを共有するかどうか。

audio_token_id (`int`、*任意*、デフォルトは`151646`) : 入力音声のプレースホルダーとして使用される音声トークンのインデックスです。

image_token_id (`int`, *任意*, デフォルトは `151655`) : 入力画像のプレースホルダーとして使用される画像トークンのインデックスです。

video_token_id (`int`、*任意*、デフォルトは`151656`) : 入力動画のプレースホルダーとして使用される動画トークンのインデックスです。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

例:

```python
>>> from transformers import Qwen3OmniMoeThinkerModel, Qwen3OmniMoeThinkerConfig

>>> # Initializing a default Qwen3OmniMoeThinkerConfig
>>> configuration = Qwen3OmniMoeThinkerConfig()

>>> # Initializing a model (with random weights) from the default configuration
>>> model = Qwen3OmniMoeThinkerModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```

## Qwen3OmniMoeTalkerConfig[[transformers.Qwen3OmniMoeTalkerConfig]]

#### transformers.Qwen3OmniMoeTalkerConfig[[transformers.Qwen3OmniMoeTalkerConfig]]

```python
transformers.Qwen3OmniMoeTalkerConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, code_predictor_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, text_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, num_code_groups: int = 32, thinker_hidden_size: int = 2048, codec_eos_token_id: int = 4198, accept_hidden_layer: int = 18, codec_nothink_id: int = 4203, codec_think_bos_id: int = 4204, codec_think_eos_id: int = 4205, codec_pad_id: int = 4196, codec_bos_id: int = 4197, audio_token_id: int = 151646, image_token_id: int = 151655, video_token_id: int = 151656, vision_start_token_id: int = 151652, position_id_per_seconds: int = 25, audio_start_token_id: int = 151669, speaker_id: dict | None = None, initializer_range: float = 0.02, tie_word_embeddings: bool = False)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L401)

**パラメータ:**

code_predictor_config (`dict`, *任意*) : [Qwen3OmniMoeTalkerCodePredictorConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerCodePredictorConfig)を初期化するために使用される設定パラメータの辞書です。指定しない場合、デフォルト値が使用されます。

text_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *任意*) : テキストバックボーンの config オブジェクトまたは辞書。

num_code_groups (`int`、*optional*、デフォルトは 32) : 予測された音響トークン列で使用されるコードブックグループの数。マルチコードブック VQ 表現に対応します。

thinker_hidden_size (`int`、*optional*、デフォルトは 2048) : 音声生成前の中間推論や潜在計画に使用される thinker モジュールの隠れ次元サイズ。

codec_eos_token_id (`int`, *optional*, デフォルトは 4198) : コーデック生成シーケンスにおける音声終了トークンを表すトークン ID。

accept_hidden_layer (`int`, *optional*, デフォルトは 18) : think-and-speak プロセスにおいて、生成トークンの受け入れまたは改善に使用される隠れ層の出力のインデックス。

codec_nothink_id (`int`、*任意*、デフォルトは 4203) : 生成時に思考ステップが不要であることを示すトークン ID。

codec_think_bos_id (`int`, *optional*, デフォルトは 4204) : 思考シーケンスの開始を示すトークン ID。

codec_think_eos_id (`int`, *任意*, デフォルトは 4205) : 思考シーケンスの終了を示すトークン ID。

codec_pad_id (`int`, *optional*, デフォルトは 4196) : コーデック入力シーケンスで使用するパディングトークンIDです。

codec_bos_id (`int`, *optional*, デフォルトは 4197) : コーデックシーケンスにおける発話開始トークン ID。

audio_token_id (`int`、*任意*、デフォルトは`151646`) : 入力音声のプレースホルダーとして使用される音声トークンのインデックスです。

image_token_id (`int`, *任意*, デフォルトは `151655`) : 入力画像のプレースホルダーとして使用される画像トークンのインデックスです。

video_token_id (`int`、*任意*、デフォルトは`151656`) : 入力動画のプレースホルダーとして使用される動画トークンのインデックスです。

vision_start_token_id (`int`, *任意*, デフォルトは `151652`) : マルチモーダル入力シーケンスにおいて、視覚セグメントの開始を示すトークン ID です。

position_id_per_seconds (`int`, *optional*, デフォルトは 25) : 音声コンテンツ 1 秒あたりに割り当てられる位置 ID の数。生成時の時間軸の整合性のために使用されます。

audio_start_token_id (`int`, *optional*, デフォルトは 151669) : 出力内で音声生成セグメントの開始を示すトークン ID。

speaker_id (`dict`, *任意*) : 話者名から話者 ID への辞書。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

tie_word_embeddings (`bool`, *任意*, デフォルトは `False`) : モデルの `tied_weights_keys` マッピングに従って重み埋め込みを共有するかどうか。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

例:

```python
>>> from transformers import Qwen3OmniMoeTalkerConfig, Qwen3OmniMoeTalker

>>> # Initialize a Qwen3OmniMoeTalkerConfig with default sub-configurations
>>> config = Qwen3OmniMoeTalkerConfig(
...     num_code_groups=32,
...     thinker_hidden_size=2048,
... )

>>> # Initialize the full Qwen3-Omni Talker model
>>> model = Qwen3OmniMoeTalker(config)

>>> # Access the model configuration
>>> config = model.config
>>> print(config.text_config)  # Access text decoder configuration
>>> print(config.code_predictor_config)  # Access code predictor configuration
```

## Qwen3OmniMoeTextConfig[[transformers.Qwen3OmniMoeTextConfig]]

#### transformers.Qwen3OmniMoeTextConfig[[transformers.Qwen3OmniMoeTextConfig]]

```python
transformers.Qwen3OmniMoeTextConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, vocab_size: int = 3584, hidden_size: int = 2048, intermediate_size: int = 18944, num_hidden_layers: int = 28, num_attention_heads: int = 28, num_key_value_heads: int = 4, hidden_act: str = 'silu', max_position_embeddings: int = 32768, initializer_range: float = 0.02, rms_norm_eps: float = 1e-06, use_cache: bool = True, rope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = None, attention_bias: bool = False, sliding_window: int | None = None, attention_dropout: float | int = 0.0, decoder_sparse_step: int = 1, moe_intermediate_size: int = 768, num_experts_per_tok: int = 8, num_experts: int = 128, norm_topk_prob: bool = True, output_router_logits: bool = False, router_aux_loss_coef: float = 0.001, mlp_only_layers: list[int] | None = None, pad_token_id: int | None = None, bos_token_id: int | None = None, eos_token_id: int | list[int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L109)

**パラメータ:**

vocab_size (`int`、*任意*、デフォルトは`3584`) : モデルの語彙サイズ。`input_ids`で表現できるトークンの種類数を定義します。

hidden_size (`int`、*任意*、デフォルトは`2048`) : 隠れ表現の次元数。

intermediate_size (`int`、*任意*、デフォルトは`18944`) : MLP 表現の次元数。

num_hidden_layers (`int`、*任意*、デフォルトは`28`) : Transformerデコーダーの隠れ層の数。

num_attention_heads (`int`、*任意*、デフォルトは`28`) : Transformerデコーダーの各アテンション層におけるアテンションヘッドの数。

num_key_value_heads (`int`, *optional*, デフォルトは `4`) : Grouped Query Attention を実装するために使用する key_value ヘッドの数です。`num_key_value_heads=num_attention_heads` の場合、モデルは Multi Head Attention (MHA) を使用し、`num_key_value_heads=1` の場合は Multi Query Attention (MQA) を使用し、それ以外の場合は GQA が使用されます。マルチヘッドのチェックポイントを GQA チェックポイントに変換する際は、各グループの key ヘッドと value ヘッドは、そのグループ内の元のすべてのヘッドを平均プーリングして構築する必要があります。詳細については、[この論文](https://huggingface.co/papers/2305.13245)を参照してください。指定されない場合、デフォルトで `num_attention_heads` が使用されます。

hidden_act (`str`、*任意*、デフォルトは`silu`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"`など。

max_position_embeddings (`int`、*任意*、デフォルトは`32768`) : このモデルが使用される可能性のある最大シーケンス長です。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

rms_norm_eps (`float`、*任意*、デフォルトは`1e-06`) : rms 正規化レイヤーで使用する epsilon。

use_cache (`bool`、*任意*、デフォルトは `True`) : モデルが最後のキー/バリューアテンションを返すかどうか（すべてのモデルで利用されるわけではありません）。`config.is_decoder=True` の場合、またはモデルがデコーダー専用の生成モデルである場合にのみ関連します。

rope_parameters (`Union[~modeling_rope_utils.RopeParameters, dict]`, *optional*) : RoPE 埋め込みの設定パラメータを含む辞書です。この辞書には `rope_theta` の値が含まれていなければならず、より長い `max_position_embeddings` で RoPE を使用する場合、スケーリングに使用されるパラメータが任意で含まれます。

attention_bias (`bool`、*任意*、デフォルトは`False`) : セルフアテンションにおけるクエリ、キー、バリュー、出力の投影層でバイアスを使用するかどうか。

sliding_window (`int`, *optional*) : スライディングウィンドウアテンションのウィンドウサイズ。`None` の場合、スライディングウィンドウは適用されません。

attention_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 注意確率のドロップアウト率。

decoder_sparse_step (`int`、*optional*、デフォルトは 1) : MoE レイヤーの頻度。

moe_intermediate_size (`int`, *optional*, デフォルトは `768`) : ルーティングされたエキスパートの MLP の中間サイズ。

num_experts_per_tok (`int`、*任意*、デフォルトは`8`) : 各トークンをルーティングするエキスパートの数です。これは、トークン選択ルーティングにおける top-k の値です。

num_experts (`int`、*optional*、デフォルトは`128`) : MoE層におけるルーティング対象のエクスパート数。

norm_topk_prob (`bool`、*任意*、デフォルトは`True`) : ルーティングされたエキスパートの重みを正規化するかどうかを指定します。

output_router_logits (`bool`, *任意*, デフォルトは `False`) : モデルがルーターのロジスティック値を返すかどうかを指定します。これを有効にすると、モデルはロードバランシングロスやルーターのzロスを含む補助ロスの出力も可能になります。

router_aux_loss_coef (`float`、*任意*、デフォルトは `0.001`) : 補助的なロードバランシング損失の係数です。MoE モデルにおける不均一なエキスパートルーティングをペナルティするために使用されます。

mlp_only_layers (`list[int]`、*optional*、デフォルトは`[]`) : Qwen3OmniMoeTextMLPをQwen3OmniMoeTextSparseMoeBlockの代わりに使用するレイヤーを指定します。リストには、レイヤーのインデックスが含まれます。レイヤー数がnum_layersの場合、0からnum_layers-1までの値です。`mlp_only_layers`が空の場合、`decoder_sparse_step`がスパース性の決定に使用されます。

pad_token_id (`int`, *任意*) : 語彙内でパディングに使用されるトークンID。

bos_token_id (`int`, *任意*) : 語彙内でストリームの開始に使用されるトークン ID。

eos_token_id (`Union[int, list[int]]`、*任意*) : 語彙内でストリームの終了に使用されるトークン ID。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

```python
>>> from transformers import Qwen3OmniMoeTextModel, Qwen3OmniMoeTextConfig

>>> # Initializing a Qwen3OmniMoeText style configuration
>>> configuration = Qwen3OmniMoeTextConfig()

>>> # Initializing a model from the Qwen3-15B-A2B" style configuration
>>> model = Qwen3OmniMoeTextModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```

## Qwen3OmniMoeVisionEncoderConfig[[transformers.Qwen3OmniMoeVisionEncoderConfig]]

#### transformers.Qwen3OmniMoeVisionEncoderConfig[[transformers.Qwen3OmniMoeVisionEncoderConfig]]

```python
transformers.Qwen3OmniMoeVisionEncoderConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, depth: int = 27, hidden_size: int = 1152, hidden_act: str = 'gelu_pytorch_tanh', intermediate_size: int = 4304, num_heads: int = 16, in_channels: int = 3, patch_size: int | list[int] | tuple[int, int] = 16, spatial_merge_size: int = 2, temporal_patch_size: int | list[int] | tuple[int, int] = 2, out_hidden_size: int = 3584, num_position_embeddings: int = 2304, deepstack_visual_indexes: list[int] | tuple[int, ...] = (8, 16, 24), initializer_range: float = 0.02, rope_parameters: dict | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L76)

**パラメータ:**

depth (`int`、*任意*、デフォルトは `27`) : ビジョンエンコーダーの Transformer レイヤー数。

hidden_size (`int`、*任意*、デフォルトは`1152`) : 隠れ表現の次元数。

hidden_act (`str`、*任意*、デフォルトは `gelu_pytorch_tanh`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"` など。

intermediate_size (`int`、*任意*、デフォルトは`4304`) : MLP 表現の次元数。

num_heads (`int`、*任意*、デフォルトは`16`) : Transformerデコーダーの各アテンション層におけるアテンションヘッドの数。

in_channels (`int`、*任意*、デフォルトは`3`) : 入力チャネル数。

patch_size (`Union[int, list[int], tuple[int, int]]`、*任意*、デフォルトは`16`) : 各パッチのサイズ（解像度）。

spatial_merge_size (`int`、*optional*、デフォルトは`2`) : 近傍の patch をマージしてビジュアルトークンの数を削減するために使用される、空間マージウィンドウのサイズです。

temporal_patch_size (`Union[int, list[int], tuple[int, int]]`、*任意*、デフォルトは`2`) : 動画入力における3Dパッチ埋め込みで使用する時間方向のパッチサイズ。

out_hidden_size (`int`、*optional*、デフォルトは 3584) : ビジョンモデルの出力隠れ層サイズです。

num_position_embeddings (`int`、*任意*、デフォルトは 2304) : このモデルが使用される可能性のある最大シーケンス長

deepstack_visual_indexes (`list[int]`、*optional*、デフォルトは`[8, 16, 24]`) : deepstack embeddings 用の層のインデックス。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

rope_parameters (`dict`, *任意*) : RoPE 埋め込みの設定パラメータを含む辞書です。この辞書には `rope_theta` の値が含まれており、より長い `max_position_embeddings` で RoPE を使用する場合にスケーリングに使用されるパラメータが任意で含まれます。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

## Qwen3OmniMoeAudioEncoderConfig[[transformers.Qwen3OmniMoeAudioEncoderConfig]]

#### transformers.Qwen3OmniMoeAudioEncoderConfig[[transformers.Qwen3OmniMoeAudioEncoderConfig]]

```python
transformers.Qwen3OmniMoeAudioEncoderConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, num_mel_bins: int = 128, encoder_layers: int = 32, encoder_attention_heads: int = 20, encoder_ffn_dim: int = 5120, d_model: int = 1280, dropout: float | int = 0.0, attention_dropout: float | int = 0.0, activation_function: str = 'gelu', activation_dropout: float | int = 0.0, scale_embedding: bool = False, initializer_range: float = 0.02, max_source_positions: int = 1500, n_window: int = 50, output_dim: int = 3584, n_window_infer: int = 800, conv_chunksize: int = 500, downsample_hidden_size: int = 480)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L30)

**パラメータ:**

num_mel_bins (`int`、*任意*、デフォルトは`128`) : 入力フレームごとに使用されるメル特徴の数を指定します。`AutoFeatureExtractor`クラスで使用される値と一致させる必要があります。

encoder_layers (`int`、*任意*、デフォルトは`32`) : Transformerエンコーダーの隠れ層の数。設定されていない場合は、`num_layers`と同じ値が使用されます。

encoder_attention_heads (`int`、*optional*、デフォルトは`20`) : Transformerエンコーダーの各アテンション層におけるアテンションヘッドの数。

encoder_ffn_dim (`int`、*任意*、デフォルトは`5120`) : エンコーダー内の「intermediate」（feed-forward とも呼ばれる）層の次元数。

d_model (`int`、*任意*、デフォルトは`1280`) : エンコーダ層とプーラー層のサイズ。

dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : すべての dropout レイヤーの比率。

attention_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 注意確率のドロップアウト率。

activation_function (`str`、*任意*、デフォルトは`gelu`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"`など。

activation_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 全結合層内の活性化に対する dropout 率。

scale_embedding (`bool`、*任意*、デフォルトは`False`) : sqrt(d_model) で割って埋め込みをスケーリングするかどうか。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

max_source_positions (`int`、*optional*、デフォルトは 1500) : 入力用の最大シーケンス長

n_window (`int`、*任意*、デフォルトは 50) : ウィンドウの数

output_dim (`int`、*任意*、デフォルトは 3584) : 出力の次元

n_window_infer (`int`、*optional*、デフォルトは`800`) : 推論中のウィンドウ数

conv_chunksize (`int`、*任意*、デフォルトは`500`) : 畳み込み層への各入力のチャンクサイズ

downsample_hidden_size (`int`、*任意*、デフォルトは`480`) : ダウンサンプリング層の隠れサイズ

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

## Qwen3OmniMoeTalkerTextConfig[[transformers.Qwen3OmniMoeTalkerTextConfig]]

#### transformers.Qwen3OmniMoeTalkerTextConfig[[transformers.Qwen3OmniMoeTalkerTextConfig]]

```python
transformers.Qwen3OmniMoeTalkerTextConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, vocab_size: int = 3072, hidden_size: int = 1024, intermediate_size: int = 2048, num_hidden_layers: int = 20, num_attention_heads: int = 16, num_key_value_heads: int = 2, hidden_act: str = 'silu', max_position_embeddings: int = 32768, initializer_range: float = 0.02, rms_norm_eps: float = 1e-06, use_cache: bool = True, tie_word_embeddings: bool = False, rope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = None, attention_bias: bool = False, sliding_window: int | None = None, attention_dropout: float | int = 0.0, decoder_sparse_step: int = 1, moe_intermediate_size: int = 384, num_experts_per_tok: int = 8, num_experts: int = 128, norm_topk_prob: bool = False, output_router_logits: bool = False, router_aux_loss_coef: float = 0.001, mlp_only_layers: list[int] | None = None, pad_token_id: int | None = None, bos_token_id: int | None = None, eos_token_id: int | list[int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L310)

**パラメータ:**

vocab_size (`int`、*任意*、デフォルトは`3072`) : モデルの語彙サイズ。`input_ids`で表現できるトークンの種類数を定義します。

hidden_size (`int`、*任意*、デフォルトは`1024`) : 隠れ表現の次元数。

intermediate_size (`int`、*任意*、デフォルトは`2048`) : MLP 表現の次元数。

num_hidden_layers (`int`、*任意*、デフォルトは`20`) : Transformer デコーダーの隠れ層の数。

num_attention_heads (`int`、*任意*、デフォルトは`16`) : Transformerデコーダーの各アテンション層におけるアテンションヘッドの数。

num_key_value_heads (`int`、*任意*、デフォルトは `2`) : Grouped Query Attention を実装するために使用する key_value ヘッドの数です。`num_key_value_heads=num_attention_heads` の場合、モデルは Multi Head Attention (MHA) を使用し、`num_key_value_heads=1` の場合は Multi Query Attention (MQA) を使用し、それ以外の場合は GQA が使用されます。マルチヘッドのチェックポイントを GQA のチェックポイントに変換する際は、各グループの key ヘッドと value ヘッドは、そのグループ内の元のすべてのヘッドを平均プーリングして構築する必要があります。詳細については、[この論文](https://huggingface.co/papers/2305.13245)を参照してください。指定されない場合、デフォルトで `num_attention_heads` が使用されます。

hidden_act (`str`、*任意*、デフォルトは`silu`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"`など。

max_position_embeddings (`int`、*任意*、デフォルトは`32768`) : このモデルが使用される可能性のある最大シーケンス長です。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

rms_norm_eps (`float`、*任意*、デフォルトは`1e-06`) : rms 正規化レイヤーで使用する epsilon。

use_cache (`bool`、*任意*、デフォルトは `True`) : モデルが最後のキー/バリューアテンションを返すかどうか（すべてのモデルで利用されるわけではありません）。`config.is_decoder=True` の場合、またはモデルがデコーダー専用の生成モデルである場合にのみ関連します。

tie_word_embeddings (`bool`, *任意*, デフォルトは `False`) : モデルの `tied_weights_keys` マッピングに従って重み埋め込みを共有するかどうか。

rope_parameters (`Union[~modeling_rope_utils.RopeParameters, dict]`, *optional*) : RoPE 埋め込みの設定パラメータを含む辞書です。この辞書には `rope_theta` の値が含まれていなければならず、より長い `max_position_embeddings` で RoPE を使用する場合、スケーリングに使用されるパラメータが任意で含まれます。

attention_bias (`bool`、*任意*、デフォルトは`False`) : セルフアテンションにおけるクエリ、キー、バリュー、出力の投影層でバイアスを使用するかどうか。

sliding_window (`int`, *optional*) : スライディングウィンドウアテンションのウィンドウサイズ。`None` の場合、スライディングウィンドウは適用されません。

attention_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 注意確率のドロップアウト率。

decoder_sparse_step (`int`、*optional*、デフォルトは 1) : MoE レイヤーの頻度。

moe_intermediate_size (`int`, *optional*, デフォルトは `384`) : ルーティングされたエキスパートのMLPの中間サイズ。

num_experts_per_tok (`int`、*任意*、デフォルトは`8`) : 各トークンをルーティングするエキスパートの数です。これは、トークン選択ルーティングにおける top-k の値です。

num_experts (`int`、*optional*、デフォルトは`128`) : MoE層におけるルーティング対象のエクスパート数。

norm_topk_prob (`bool`、*任意*、デフォルトは`False`) : ルーティングされたエキスパートの重みを正規化するか否かを指定します。

output_router_logits (`bool`, *任意*, デフォルトは `False`) : モデルがルーターのロジスティック値を返すかどうかを指定します。これを有効にすると、モデルはロードバランシングロスやルーターのzロスを含む補助ロスの出力も可能になります。

router_aux_loss_coef (`float`、*任意*、デフォルトは `0.001`) : 補助的なロードバランシング損失の係数です。MoE モデルにおける不均一なエキスパートルーティングをペナルティするために使用されます。

mlp_only_layers (`list[int]`、*optional*、デフォルトは`[]`) : `decoder_sparse_step`ではなく`mlp_only_layers`が使用されるレイヤーを指定します。リストには、レイヤーのインデックスが含まれます。レイヤー数がnum_layersの場合、0からnum_layers-1までの値です。`mlp_only_layers`が空の場合、スパース性は`decoder_sparse_step`によって決定されます。

pad_token_id (`int`, *任意*) : 語彙内でパディングに使用されるトークンID。

bos_token_id (`int`, *任意*) : 語彙内でストリームの開始に使用されるトークン ID。

eos_token_id (`Union[int, list[int]]`、*任意*) : 語彙内でストリームの終了に使用されるトークン ID。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

```python
>>> from transformers import Qwen3OmniMoeTalkerTextModel, Qwen3OmniMoeTalkerTextConfig

>>> # Initializing a Qwen3OmniMoeTalkerText style configuration
>>> configuration = Qwen3OmniMoeTalkerTextConfig()

>>> # Initializing a model from the Qwen3-15B-A2B" style configuration
>>> model = Qwen3OmniMoeTalkerTextModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```

## Qwen3OmniMoeTalkerCodePredictorConfig[[transformers.Qwen3OmniMoeTalkerCodePredictorConfig]]

#### transformers.Qwen3OmniMoeTalkerCodePredictorConfig[[transformers.Qwen3OmniMoeTalkerCodePredictorConfig]]

```python
transformers.Qwen3OmniMoeTalkerCodePredictorConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, vocab_size: int = 2048, hidden_size: int = 1024, intermediate_size: int = 3072, num_hidden_layers: int = 5, num_attention_heads: int = 16, num_key_value_heads: int = 8, head_dim: int = 128, hidden_act: str = 'silu', max_position_embeddings: int = 32768, initializer_range: float = 0.02, rms_norm_eps: float = 1e-06, use_cache: bool = True, tie_word_embeddings: bool = False, rope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = None, attention_bias: bool = False, sliding_window: int | None = None, max_window_layers: int = 28, layer_types: list[str] | None = None, attention_dropout: float | int = 0.0, pad_token_id: int | None = None, bos_token_id: int | None = None, eos_token_id: int | list[int] | None = None, num_code_groups: int = 32)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py#L243)

**パラメータ:**

vocab_size (`int`、*任意*、デフォルトは`2048`) : モデルの語彙サイズ。`input_ids`で表現できるトークンの種類数を定義します。

hidden_size (`int`、*任意*、デフォルトは`1024`) : 隠れ表現の次元数。

intermediate_size (`int`、*任意*、デフォルトは `3072`) : MLP 表現の次元数。

num_hidden_layers (`int`, *任意*, デフォルトは `5`) : Transformer デコーダーの隠れ層の数。

num_attention_heads (`int`、*任意*、デフォルトは`16`) : Transformerデコーダーの各アテンション層におけるアテンションヘッドの数。

num_key_value_heads (`int`, *optional*, デフォルトは `8`) : Grouped Query Attention を実装するために使用する key_value ヘッドの数です。`num_key_value_heads=num_attention_heads` の場合、モデルは Multi Head Attention (MHA) を使用し、`num_key_value_heads=1` の場合は Multi Query Attention (MQA) を使用し、それ以外の場合は GQA が使用されます。マルチヘッドのチェックポイントを GQA のチェックポイントに変換する際は、各グループの key ヘッドと value ヘッドは、そのグループ内の元のすべてのヘッドを平均プーリングして構築する必要があります。詳細については、[この論文](https://huggingface.co/papers/2305.13245)を参照してください。指定されない場合、デフォルトで `num_attention_heads` が使用されます。

head_dim (`int`、*任意*、デフォルトは`128`) : アテンションヘッドの次元です。None の場合、hidden_size // num_attention_heads がデフォルトとして使用されます。

hidden_act (`str`、*任意*、デフォルトは`silu`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"`など。

max_position_embeddings (`int`、*任意*、デフォルトは`32768`) : このモデルが使用される可能性のある最大シーケンス長です。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

rms_norm_eps (`float`、*任意*、デフォルトは`1e-06`) : rms 正規化レイヤーで使用する epsilon。

use_cache (`bool`、*任意*、デフォルトは `True`) : モデルが最後のキー/バリューアテンションを返すかどうか（すべてのモデルで利用されるわけではありません）。`config.is_decoder=True` の場合、またはモデルがデコーダー専用の生成モデルである場合にのみ関連します。

tie_word_embeddings (`bool`, *任意*, デフォルトは `False`) : モデルの `tied_weights_keys` マッピングに従って重み埋め込みを共有するかどうか。

rope_parameters (`Union[~modeling_rope_utils.RopeParameters, dict]`, *optional*) : RoPE 埋め込みの設定パラメータを含む辞書です。この辞書には `rope_theta` の値が含まれていなければならず、より長い `max_position_embeddings` で RoPE を使用する場合、スケーリングに使用されるパラメータが任意で含まれます。

attention_bias (`bool`、*任意*、デフォルトは`False`) : セルフアテンションにおけるクエリ、キー、バリュー、出力の投影層でバイアスを使用するかどうか。

sliding_window (`int`, *optional*) : スライディングウィンドウアテンションのウィンドウサイズ。`None` の場合、スライディングウィンドウは適用されません。

max_window_layers (`int`、*optional*、デフォルトは`28`) : フルアテンションを使用するレイヤーの数です。最初の`max_window_layers`個のレイヤーはフルアテンションを使用し、それ以降の追加レイヤーはSWA（Sliding Window Attention）を使用します。

layer_types (`list[str]`、*任意*) : 各レイヤーのインデックスとそのレイヤータイプを明示的にマッピングするリストです。指定しない場合、config の値に基づいて自動的に生成されます。

attention_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 注意確率のドロップアウト率。

pad_token_id (`int`, *任意*) : 語彙内でパディングに使用されるトークンID。

bos_token_id (`int`, *任意*) : 語彙内でストリームの開始に使用されるトークン ID。

eos_token_id (`Union[int, list[int]]`、*任意*) : 語彙内でストリームの終了に使用されるトークン ID。

num_code_groups (`int`、*optional*、デフォルトは 32) : 予測された音響トークン列で使用されるコードブックグループの数。マルチコードブック VQ 表現に対応します。

これは、Qwen3 Omni MoeModel の設定を保存するための設定クラスです。指定された引数に基づいて Qwen3 Omni Moe モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[Qwen/Qwen3-Omni-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

## Qwen3OmniMoeForConditionalGeneration[[transformers.Qwen3OmniMoeForConditionalGeneration]]

#### transformers.Qwen3OmniMoeForConditionalGeneration[[transformers.Qwen3OmniMoeForConditionalGeneration]]

```python
transformers.Qwen3OmniMoeForConditionalGeneration(config: Qwen3OmniMoeConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3959)

## Qwen3OmniMoeThinkerTextModel[[transformers.Qwen3OmniMoeThinkerTextModel]]

#### transformers.Qwen3OmniMoeThinkerTextModel[[transformers.Qwen3OmniMoeThinkerTextModel]]

```python
transformers.Qwen3OmniMoeThinkerTextModel(config: Qwen3OmniMoeTextConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L1622)

**パラメータ:**

config ([Qwen3OmniMoeTextConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTextConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

Qwen3OmniMoeThinkerのテキスト部分であり、純粋なテキスト専用モデルではありません。DeepStackは、視覚特徴を初期の隠れ状態に統合するためです。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeThinkerTextModel.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, cache: transformers.cache_utils.Cache | None = None, inputs_embeds: typing.Optional[torch.Tensor] = None, use_cache: bool | None = None, visual_pos_masks: typing.Optional[torch.Tensor] = None, deepstack_visual_embeds: list[torch.Tensor] | None = None, **kwargs: *<class 'transformers.modeling_flash_attention_utils.FlashAttentionKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L1647)

**パラメータ:**

input_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 語彙における入力シーケンスのトークンインデックスです。デフォルトでは、パディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細については、[PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`torch.Tensor`、shape `(batch_size, sequence_length)`、*任意*) : padding トークンのインデックスに対する attention を回避するためのマスクです。マスクの値は `[0, 1]` から選択されます:  - **マスクされない**トークンは 1、- **マスクされる**トークンは 0。  [attention マスクとは?](../glossary#attention-mask)

position_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 各入力シーケンスのトークンが位置埋め込み内で占める位置のインデックスです。`[0, config.n_positions - 1]` の範囲から選択されます。 [位置 ID とは何か？](../glossary#position-ids)

cache (`~cache_utils.Cache`, *任意*) : 逐次的なデコーディングを高速化するために使用できる、事前計算された隠れ状態（自己注意ブロックおよび相互注意ブロック内のキーとバリュー）です。通常、`use_cache=True` または `config.use_cache=True` の場合、デコーディングの以前の段階でモデルが返した `cache` になります。入力として許可されるのは [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) インスタンスのみです。[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache) を参照してください。`cache` が渡されない場合、デフォルトで [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) が初期化されます。モデルは、入力として与えられたのと同じキャッシュ形式を出力します。`cache` を使用する場合、ユーザーは、このモデルに過去のキーバリュー状態が与えられていない未処理の `input_ids` のみを、`(batch_size, sequence_length)` の形状を持つすべての `input_ids` の代わりに、`(batch_size, unprocessed_length)` の形状で入力することが期待されます。

inputs_embeds (`torch.Tensor`、shape `(batch_size, sequence_length, hidden_size)`、*任意*) : `input_ids` を渡す代わりに、埋め込み表現を直接渡すこともできます。これは、モデル内部の埋め込み参照行列よりも、`input_ids` のインデックスを対応するベクトルに変換する方法をより細かく制御したい場合に有用です。

use_cache (`bool`, *任意*) : `True`に設定すると、`cache`のキーとバリューの状態が返され、デコーディングの高速化に使用できます（`cache`を参照）。

visual_pos_masks (`torch.Tensor`、shape `(batch_size, seqlen)`、*optional*) : 視覚位置のマスク。

deepstack_visual_embeds (`list[torch.Tensor]`、*optional*) : deepstack 視覚埋め込みです。形状は (num_layers, visual_seqlen, embed_dim) です。この特徴量は、異なる視覚エンコーダー層から抽出され、デコーダーの隠れ状態に与えられます。論文 DeepStack(https://arxiv.org/abs/2406.04334) に基づいています。

**戻り値:** `MoeModelOutputWithPast` または `tuple(torch.Tensor)`

`MoeModelOutputWithPast`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（`None`）や入力に応じて、さまざまな要素で構成されます。

[Qwen3OmniMoeThinkerTextModel](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeThinkerTextModel)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  自己注意ブロックおよび（`config.is_encoder_decoder=True` の場合、任意で）相互注意ブロックの事前計算済み隠れ状態（キーとバリュー）が含まれており、シーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **router_logits** (`tuple(torch.Tensor)`、*optional*、`output_router_probs=True` と `config.add_router_probs=True` が渡された場合、または `config.output_router_probs=True` の場合に返されます) -- 各層に対応する `torch.Tensor` のタプルで、形状は `(batch_size, sequence_length, num_experts)` です。

  MoE ルーターによって計算される生（raw）のルーター logits（softmax 後）であり、Mixture of Experts モデルの補助損失を計算するためにこれらの用語が使用されます。

## Qwen3OmniMoeThinkerModel[[transformers.Qwen3OmniMoeThinkerModel]]

#### transformers.Qwen3OmniMoeThinkerModel[[transformers.Qwen3OmniMoeThinkerModel]]

```python
transformers.Qwen3OmniMoeThinkerModel(config: Qwen3OmniMoeThinkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L1752)

**パラメータ:**

config ([Qwen3OmniMoeThinkerConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeThinkerConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

音声バックボーンと言語モデルで構成されるQwen2.5OmniThinkerモデル。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeThinkerModel.forward]]

```python
forward(input_ids = None, input_features = None, pixel_values = None, pixel_values_videos = None, image_grid_thw = None, video_grid_thw = None, attention_mask = None, feature_attention_mask = None, audio_feature_lengths = None, position_ids = None, cache = None, inputs_embeds = None, use_cache = None, output_router_logits: bool | None = None, use_audio_in_video = None, video_second_per_grid = None, mm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L1936)

**パラメータ:**

input_ids (`` of shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックス。デフォルトではパディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細は [PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

input_features (`` of shape `(batch_size, sequence_length, feature_dim)`) : The tensors corresponding to the input audio features. Audio features can be obtained using `feature_extractor_class`. See `feature_extractor_class.__call__` for details (`processor_class` uses `feature_extractor_class` for processing audios).

pixel_values (`` of shape `(batch_size, num_channels, image_size, image_size)`) : The tensors corresponding to the input images. Pixel values can be obtained using `image_processor_class`. See `image_processor_class.__call__` for details (`processor_class` uses `image_processor_class` for processing images).

pixel_values_videos (`` of shape `(batch_size, num_frames, num_channels, frame_size, frame_size)`) : The tensors corresponding to the input video. Pixel values for videos can be obtained using `video_processor_class`. See `video_processor_class.__call__` for details (`processor_class` uses `video_processor_class` for processing videos).

image_grid_thw (`` of shape `(num_images, 3)`) : LLM 内の各画像のフィーチャー形状の時間軸、高さ、幅。

video_grid_thw (`` of shape `(num_videos, 3)`) : LLM における各動画のフィーチャー形状の時間軸、高さ、幅。

attention_mask (`` of shape `(batch_size, sequence_length)`) : Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:  - 1 for tokens that are **not masked**, - 0 for tokens that are **masked**.  [What are attention masks?](../glossary#attention-mask)

feature_attention_mask (`torch.Tensor`、形状 `(batch_size, feature_sequence_length)`、*任意*) : パディングのフィーチャーインデックスに対するアテンションの計算を回避するためのマスク。`[0, 1]` から選択されるマスクの値:  - **マスクされていない** トークンは 1、 - **マスクされている** トークンは 0。

audio_feature_lengths (`torch.LongTensor`、形状 `(num_audios)`、*任意*) : LLMにおける各オーディオのフィーチャー形状の長さ。

position_ids ```
(` of shape `(batch_size, sequence_length)`) : Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0, config.n_positions - 1]`.  [What are position IDs?](../glossary#position-ids)
```

cache (``) : Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used to speed up sequential decoding. This typically consists in the `cache` returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.  Only [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) instance is allowed as input, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). If no `cache` are passed, [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) will be initialized by default.  The model will output the same cache format that is fed as input.  If `cache` are used, the user is expected to input only unprocessed `input_ids` (those that don't have their past key value states given to this model) of shape `(batch_size, unprocessed_length)` instead of all `input_ids` of shape `(batch_size, sequence_length)`.

inputs_embeds (`` of shape `(batch_size, sequence_length, hidden_size)`) : Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This is useful if you want more control over how to convert `input_ids` indices into associated vectors than the model's internal embedding lookup matrix.

use_cache (``) : If set to `True`, `cache` key value states are returned and can be used to speed up decoding (see `cache`).

output_router_logits (`bool`, *任意*) : すべてのルーターの logits を返すかどうか。ルーター損失の計算に有用であり、推論時には返すべきではありません。

use_audio_in_video (`bool`, *任意*) : 動画内のオーディオトラックを使用するかどうか。`process_audio_info` のパラメータと同じである必要があります。

video_second_per_grid (`torch.LongTensor`、形状 `(num_videos)`、*任意*) : 各動画のグリッドあたりの秒数。時間的な特徴のマッピングに使用されます。

mm_encoder_outputs (`dict[str, ~modeling_outputs.BaseModelOutputWithPooling]`, *任意*) : キーがサポートされているモダリティ、値がそのモダリティのエンコード済み出力である辞書。各エンコード済み出力は、(`pooler_output`、*任意*: `last_hidden_states`、*任意*: `hidden_states`、*任意*: `attentions`) という形式のタプルで、`pooler_output` の形状は `(batch_size, sequence_length, hidden_size)`、*任意*) であり、エンコーダーのマルチモーダル特徴量をテキスト埋め込みにマージしたシーケンスです。

**戻り値:** `MultimodalMoeBaseModelOutputWithPast` または `tuple(torch.Tensor)`

`MultimodalMoeBaseModelOutputWithPast`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（`None`）や入力に応じて、さまざまな要素で構成されます。

[Qwen3OmniMoeThinkerModel](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeThinkerModel)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **last_hidden_state** (`torch.FloatTensor`、shape `(batch_size, sequence_length, hidden_size)`) -- 言語モデルのバックボーンの最終層の出力における、隠れ状態のシーケンスです。`cache` が使用されている場合、shape `(batch_size, 1, hidden_size)` のシーケンスの最後の隠れ状態のみが出力されます。
- **cache** (`Cache`、*optional*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。自己注意ブロック（および `config.is_encoder_decoder=True` の場合、クロスカレンス注意ブロック）の事前計算済み隠れ状態（キーとバリュー）を保持しており、これらはシーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.FloatTensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.FloatTensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。言語モデルのバックボーンにおける各層の出力時の隠れ状態と、任意の初期埋め込み出力です。
- **attentions** (`tuple(torch.FloatTensor)`、*optional*、`output_attentions=True` が渡された場合、または `config.output_attentions=True` の場合に返されます) -- `torch.FloatTensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。アテンションの softmax 適用後の、言語モデルのバックボーンのアテンション重みです。
- **router_logits** (`tuple(torch.Tensor)`、*optional*、`output_router_logits=True` が渡された場合、または `config.output_router_logits=True` の場合に返されます) -- `torch.Tensor` のタプル（スパース層ごとに1つ）、形状は `(batch_size * sequence_length, num_experts)` です。MoE ルーターによって計算された生のルーターロジットです。ロードバランシング損失の計算や、トークンがエキスパートにどのようにディスパッチされるかの確認に使用できます。
- **image_outputs** (`BaseModelOutputWithPooling`、*任意*) -- 画像エンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。画像が処理されなかった場合は `None`。
- **video_outputs** (`BaseModelOutputWithPooling`、*任意*) -- ビデオエンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。ビデオが処理されなかった場合は `None`。
- **audio_outputs** (`BaseModelOutputWithPooling`、*任意*) -- 音声エンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。音声が処理されなかった場合は `None`。

## Qwen3OmniMoeThinkerForConditionalGeneration[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration]]

#### transformers.Qwen3OmniMoeThinkerForConditionalGeneration[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration]]

```python
transformers.Qwen3OmniMoeThinkerForConditionalGeneration(config: Qwen3OmniMoeThinkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2157)

#### forward[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration.forward]]

```python
forward(input_ids = None, input_features = None, pixel_values = None, pixel_values_videos = None, image_grid_thw = None, video_grid_thw = None, attention_mask = None, feature_attention_mask = None, audio_feature_lengths = None, position_ids = None, cache = None, inputs_embeds = None, labels = None, use_cache = None, output_router_logits: bool | None = None, use_audio_in_video = None, video_second_per_grid = None, mm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2220)

**パラメータ:**

input_ids (`` of shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックス。デフォルトではパディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細は [PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

input_features (`` of shape `(batch_size, sequence_length, feature_dim)`) : The tensors corresponding to the input audio features. Audio features can be obtained using `feature_extractor_class`. See `feature_extractor_class.__call__` for details (`processor_class` uses `feature_extractor_class` for processing audios).

pixel_values (`` of shape `(batch_size, num_channels, image_size, image_size)`) : The tensors corresponding to the input images. Pixel values can be obtained using `image_processor_class`. See `image_processor_class.__call__` for details (`processor_class` uses `image_processor_class` for processing images).

pixel_values_videos (`` of shape `(batch_size, num_frames, num_channels, frame_size, frame_size)`) : The tensors corresponding to the input video. Pixel values for videos can be obtained using `video_processor_class`. See `video_processor_class.__call__` for details (`processor_class` uses `video_processor_class` for processing videos).

image_grid_thw (`` of shape `(num_images, 3)`) : LLM 内の各画像のフィーチャー形状の時間軸、高さ、幅。

video_grid_thw (`` of shape `(num_videos, 3)`) : LLM における各動画のフィーチャー形状の時間軸、高さ、幅。

attention_mask (`` of shape `(batch_size, sequence_length)`) : Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:  - 1 for tokens that are **not masked**, - 0 for tokens that are **masked**.  [What are attention masks?](../glossary#attention-mask)

feature_attention_mask (`torch.Tensor`、形状 `(batch_size, feature_sequence_length)`、*任意*) : パディングのフィーチャーインデックスに対するアテンションの計算を回避するためのマスク。`[0, 1]` から選択されるマスクの値:  - **マスクされていない** トークンは 1、 - **マスクされている** トークンは 0。

audio_feature_lengths (`torch.LongTensor`、形状 `(num_audios)`、*任意*) : LLMにおける各オーディオのフィーチャー形状の長さ。

position_ids ```
(` of shape `(batch_size, sequence_length)`) : Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0, config.n_positions - 1]`.  [What are position IDs?](../glossary#position-ids)
```

cache (``) : Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used to speed up sequential decoding. This typically consists in the `cache` returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.  Only [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) instance is allowed as input, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). If no `cache` are passed, [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) will be initialized by default.  The model will output the same cache format that is fed as input.  If `cache` are used, the user is expected to input only unprocessed `input_ids` (those that don't have their past key value states given to this model) of shape `(batch_size, unprocessed_length)` instead of all `input_ids` of shape `(batch_size, sequence_length)`.

inputs_embeds (`` of shape `(batch_size, sequence_length, hidden_size)`) : Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This is useful if you want more control over how to convert `input_ids` indices into associated vectors than the model's internal embedding lookup matrix.

labels (`` of shape `(batch_size, sequence_length)`) : Labels for computing the masked language modeling loss. Indices should either be in `[0, ..., config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]

use_cache (``) : If set to `True`, `cache` key value states are returned and can be used to speed up decoding (see `cache`).

output_router_logits (`bool`, *任意*) : すべてのルーターの logits を返すかどうか。ルーター損失の計算に有用であり、推論時には返すべきではありません。

use_audio_in_video (`bool`, *任意*) : 動画内のオーディオトラックを使用するかどうか。`process_audio_info` のパラメータと同じである必要があります。

video_second_per_grid (`torch.LongTensor`、形状 `(num_videos)`、*任意*) : 各動画のグリッドあたりの秒数。時間的な特徴のマッピングに使用されます。

mm_encoder_outputs (`dict[str, ~modeling_outputs.BaseModelOutputWithPooling]`, *任意*) : キーがサポートされているモダリティ、値がそのモダリティのエンコード済み出力である辞書。各エンコード済み出力は、(`pooler_output`、*任意*: `last_hidden_states`、*任意*: `hidden_states`、*任意*: `attentions`) という形式のタプルで、`pooler_output` の形状は `(batch_size, sequence_length, hidden_size)`、*任意*) であり、エンコーダーのマルチモーダル特徴量をテキスト埋め込みにマージしたシーケンスです。

**戻り値:** `MultimodalMoeCausalLMOutputWithPast` または `tuple(torch.Tensor)`

`MultimodalMoeCausalLMOutputWithPast`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（`None`）や入力に応じて、さまざまな要素で構成されます。

[Qwen3OmniMoeThinkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeThinkerForConditionalGeneration)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **loss** (`torch.FloatTensor`、shape `(1,)`、*optional*、`labels` が指定された場合に返されます) -- 言語モデリングの損失(次のトークンの予測用)。
- **aux_loss** (`torch.Tensor`、*optional*、`output_router_logits=True` が渡された場合、または `config.output_router_logits=True` かつモデルがロードバランス損失でルーターを学習する場合に返されます) -- スパースモジュールのロードバランス補助損失。ルーターバイアスでエキスパートをバランスさせるモデル（DeepSeek-V3 とそこから派生したアーキテクチャ）は、`router_logits` を返しながらも、ここでは `None` を返します。
- **logits** (`torch.FloatTensor`、shape `(batch_size, sequence_length, config.vocab_size)`) -- 言語モデリングヘッドの予測スコア（SoftMax 適用前の各語彙トークンのスコア）。
- **cache** (`Cache`、*optional*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。自己注意ブロック（および `config.is_encoder_decoder=True` の場合、クロスカレンス注意ブロック）の事前計算済み隠れ状態（キーとバリュー）を保持しており、これらはシーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.FloatTensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.FloatTensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。言語モデルのバックボーンにおける各層の出力時の隠れ状態と、任意の初期埋め込み出力です。
- **attentions** (`tuple(torch.FloatTensor)`、*optional*、`output_attentions=True` が渡された場合、または `config.output_attentions=True` の場合に返されます) -- `torch.FloatTensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。アテンションの softmax 適用後の、言語モデルのバックボーンのアテンション重みです。
- **router_logits** (`tuple(torch.Tensor)`、*optional*、`output_router_logits=True` が渡された場合、または `config.output_router_logits=True` の場合に返されます) -- `torch.Tensor` のタプル（スパース層ごとに1つ）、形状は `(batch_size * sequence_length, num_experts)` です。MoE ルーターによって計算された生のルーターロジットです。ロードバランシング損失の計算や、トークンがエキスパートにどのようにディスパッチされるかの確認に使用できます。
- **image_outputs** (`BaseModelOutputWithPooling`、*任意*) -- 画像エンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。画像が処理されなかった場合は `None`。
- **video_outputs** (`BaseModelOutputWithPooling`、*任意*) -- ビデオエンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。ビデオが処理されなかった場合は `None`。
- **audio_outputs** (`BaseModelOutputWithPooling`、*任意*) -- 音声エンコーダーの出力: `last_hidden_state`、`pooler_output`、`hidden_states` および `attentions`。音声が処理されなかった場合は `None`。

例:

```python
>>> from transformers import Qwen3OmniMoeProcessor, Qwen3OmniMoeThinkerForConditionalGeneration

>>> thinker = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B")
>>> processor = Qwen3OmniMoeProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

>>> conversations = [
>>>         {'role': 'system', 'content': 'You are a helpful voice chat bot, and please respond to me in a casual conversation manner using random voice.'},
>>>         {"role": "user", "content": [
>>>             {"type": "image", "image": "https://www.ilankelman.org/stopsigns/australia.jpg"},
>>>             {"type": "audio", "audio": "https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/audio/glass_breaking.mp3"},
>>>         ]},
>>> ]

>>> inputs = processor.apply_chat_template(
    conversations,
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt"
)

>>> # Generate
>>> generation = thinker.generate(**inputs, max_new_tokens=2048)
>>> generate_ids = generation[:, inputs.input_ids.size(1):]

>>> response = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
```

#### get_audio_features[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration.get_audio_features]]

```python
get_audio_features(input_features: Tensor, feature_attention_mask: typing.Optional[torch.LongTensor] = None, audio_feature_lengths: typing.Optional[torch.LongTensor] = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2202)

**パラメータ:**

input_features (`torch.Tensor`) : 入力オーディオに対応するテンソル。

feature_attention_mask (`torch.LongTensor`, *任意*) : パディングの機能インデックスに対するアテンションの実行を回避するためのマスク。`[0, 1]`から選択されるマスクの値:

audio_feature_lengths (`torch.LongTensor`、形状 `(num_audios)`、*任意*) : LLMにおける各オーディオのフィーチャー形状の長さ。

**戻り値:** [BaseModelOutputWithPooling](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling) または `tuple(torch.Tensor)`

`torch.Tensor` のタプル（`return_dict=False` が渡された場合、または `config.return_dict=False` の場合）または [BaseModelOutputWithPooling](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling)。設定（[Qwen3OmniMoeConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeConfig)）と入力に応じて、さまざまな要素で構成されます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.Tensor`、形状 `(batch_size, hidden_size)`) -- 補助的な事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT系のモデルでは、線形層とtanh活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次の文予測（分類）目的から学習されます。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。

例:

```python
>>> from PIL import Image
>>> from transformers import AutoProcessor, Qwen3OmniMoeThinkerForConditionalGeneration

>>> model = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

>>> messages = [
...     {
...         "role": "user", "content": [
...             {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"},
...             {"type": "text", "text": "Where is the cat standing?"},
...         ]
...     },
... ]

>>> inputs = processor.apply_chat_template(
...     messages,
...     tokenize=True,
...     return_dict=True,
...     return_tensors="pt",
...     add_generation_prompt=True
... )
>>> # Generate
>>> generate_ids = model.generate(**inputs)
>>> processor.batch_decode(generate_ids, skip_special_tokens=True)[0]
```

#### get_image_features[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration.get_image_features]]

```python
get_image_features(pixel_values: Tensor, image_grid_thw: typing.Optional[torch.LongTensor] = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2189)

**パラメータ:**

pixel_values (`torch.Tensor`、形状 `(batch_size, num_channels, image_size, image_size)`) : 入力画像に対応するテンソル。

image_grid_thw (`torch.LongTensor`、形状 `(num_images, 3)`、*任意*) : LLM における各画像のフィーチャー形状の時間軸、高さ、幅。

**戻り値:** `BaseModelOutputWithDeepstackFeatures` または `tuple(torch.Tensor)`

`BaseModelOutputWithDeepstackFeatures`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（[Qwen3OmniMoeConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeConfig)）や入力に応じて、さまざまな要素で構成されます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.Tensor`、形状 `(batch_size, hidden_size)`) -- 補助的な事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT系のモデルでは、線形層とtanh活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次の文予測（分類）目的から学習されます。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **deepstack_features** (`List[torch.Tensor]`, *オプション*) -- deepstack層からの隠れ状態（特徴マップ）のリスト。

例:

```python
>>> from PIL import Image
>>> from transformers import AutoProcessor, Qwen3OmniMoeThinkerForConditionalGeneration

>>> model = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

>>> messages = [
...     {
...         "role": "user", "content": [
...             {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"},
...             {"type": "text", "text": "Where is the cat standing?"},
...         ]
...     },
... ]

>>> inputs = processor.apply_chat_template(
...     messages,
...     tokenize=True,
...     return_dict=True,
...     return_tensors="pt",
...     add_generation_prompt=True
... )
>>> # Generate
>>> generate_ids = model.generate(**inputs)
>>> processor.batch_decode(generate_ids, skip_special_tokens=True)[0]
```

#### get_video_features[[transformers.Qwen3OmniMoeThinkerForConditionalGeneration.get_video_features]]

```python
get_video_features(pixel_values_videos: Tensor, video_grid_thw: typing.Optional[torch.LongTensor] = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2176)

**パラメータ:**

pixel_values_videos (`torch.Tensor`、形状 `(batch_size, num_channels, image_size, image_size)`) : 入力動画に対応するテンソル。

video_grid_thw (`torch.LongTensor`、形状 `(num_videos, 3)`、*任意*) : LLM における各動画のフィーチャー形状の時間軸、高さ、幅。

**戻り値:** `BaseModelOutputWithDeepstackFeatures` または `tuple(torch.Tensor)`

`BaseModelOutputWithDeepstackFeatures`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（[Qwen3OmniMoeConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeConfig)）や入力に応じて、さまざまな要素で構成されます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.Tensor`、形状 `(batch_size, hidden_size)`) -- 補助的な事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT系のモデルでは、線形層とtanh活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次の文予測（分類）目的から学習されます。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **deepstack_features** (`List[torch.Tensor]`, *オプション*) -- deepstack層からの隠れ状態（特徴マップ）のリスト。

例:

```python
>>> from PIL import Image
>>> from transformers import AutoProcessor, Qwen3OmniMoeThinkerForConditionalGeneration

>>> model = Qwen3OmniMoeThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen3-Omni-30B-A3B-Instruct")

>>> messages = [
...     {
...         "role": "user", "content": [
...             {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"},
...             {"type": "text", "text": "Where is the cat standing?"},
...         ]
...     },
... ]

>>> inputs = processor.apply_chat_template(
...     messages,
...     tokenize=True,
...     return_dict=True,
...     return_tensors="pt",
...     add_generation_prompt=True
... )
>>> # Generate
>>> generate_ids = model.generate(**inputs)
>>> processor.batch_decode(generate_ids, skip_special_tokens=True)[0]
```

## Qwen3OmniMoeTalkerForConditionalGeneration[[transformers.Qwen3OmniMoeTalkerForConditionalGeneration]]

#### transformers.Qwen3OmniMoeTalkerForConditionalGeneration[[transformers.Qwen3OmniMoeTalkerForConditionalGeneration]]

```python
transformers.Qwen3OmniMoeTalkerForConditionalGeneration(config: Qwen3OmniMoeTalkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3089)

**パラメータ:**

config ([Qwen3OmniMoeTalkerConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

他のモダリティ（例：画像とテキストからテキストへの生成）を条件としてトークンを生成するためのQwen3 Omni Moeモデル。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeTalkerForConditionalGeneration.forward]]

```python
forward(input_ids = None, attention_mask = None, use_audio_in_video = None, audio_feature_lengths = None, video_second_per_grid = None, image_grid_thw = None, video_grid_thw = None, position_ids = None, cache = None, inputs_embeds = None, labels = None, use_cache = None, output_router_logits = None, residual_codes = None, trailing_text_hidden = None, tts_pad_embed = None, generation_step = None, talker_input_ids = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3121)

**パラメータ:**

input_ids (`` of shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックス。デフォルトではパディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細は [PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`` of shape `(batch_size, sequence_length)`) : Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:  - 1 for tokens that are **not masked**, - 0 for tokens that are **masked**.  [What are attention masks?](../glossary#attention-mask)

use_audio_in_video (`bool`, *任意*) : `True`に設定すると、動画内のオーディオを使用します。

audio_feature_lengths (`torch.LongTensor`、形状 `(num_audios)`、*任意*) : LLMにおける各オーディオのフィーチャー形状の長さ。

video_second_per_grid (`torch.LongTensor`、形状 `(num_videos)`、*任意*) : 各動画のグリッドあたりの秒数。時間的な特徴のマッピングに使用されます。

image_grid_thw (`` of shape `(num_images, 3)`) : LLM 内の各画像のフィーチャー形状の時間軸、高さ、幅。

video_grid_thw (`` of shape `(num_videos, 3)`) : LLM における各動画のフィーチャー形状の時間軸、高さ、幅。

position_ids ```
(` of shape `(batch_size, sequence_length)`) : Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0, config.n_positions - 1]`.  [What are position IDs?](../glossary#position-ids)
```

cache (``) : Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used to speed up sequential decoding. This typically consists in the `cache` returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.  Only [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) instance is allowed as input, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). If no `cache` are passed, [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) will be initialized by default.  The model will output the same cache format that is fed as input.  If `cache` are used, the user is expected to input only unprocessed `input_ids` (those that don't have their past key value states given to this model) of shape `(batch_size, unprocessed_length)` instead of all `input_ids` of shape `(batch_size, sequence_length)`.

inputs_embeds (`` of shape `(batch_size, sequence_length, hidden_size)`) : Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This is useful if you want more control over how to convert `input_ids` indices into associated vectors than the model's internal embedding lookup matrix.

labels (`` of shape `(batch_size, sequence_length)`) : Labels for computing the masked language modeling loss. Indices should either be in `[0, ..., config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]

use_cache (``) : If set to `True`, `cache` key value states are returned and can be used to speed up decoding (see `cache`).

output_router_logits (``) : すべてのルーターのlogitsを返すかどうか。ルーター損失の計算に有用であり、推論時には返すべきではありません。

residual_codes (`torch.Tensor`) : 前ステップの予測された残差コード。

trailing_text_hidden (`torch.Tensor`) : 最初のトークン以降のthinkerからのテキストの隠れ状態。

tts_pad_embed (`torch.Tensor`) : `tts_pad_token_id`の埋め込みテンソル。

generation_step (`int`) : prefill からの生成ステップ数。`trailing_text_hidden` と同期するために使用されます。

talker_input_ids (`torch.Tensor`) : thinkerからの入力ID。3次元RoPEの計算に使用されます。

**戻り値:** `MoeCausalLMOutputWithPast` または `tuple(torch.Tensor)`

`MoeCausalLMOutputWithPast`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（`None`）や入力に応じて、さまざまな要素で構成されます。

[Qwen3OmniMoeTalkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerForConditionalGeneration)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **loss** (`torch.Tensor`、形状 `(1,)`、*任意*、`labels` が指定された場合に返されます) -- 言語モデリングの損失(次のトークンの予測用)。
- **logits** (`torch.Tensor`、形状 `(batch_size, sequence_length, config.vocab_size)`) -- 言語モデリングヘッドの予測スコア（SoftMax 適用前の各語彙トークンのスコア）。
- **aux_loss** (`torch.Tensor`、*optional*、`output_router_logits=True` が渡された場合、または `config.output_router_logits=True` かつモデルがロードバランス損失でルーターを学習する場合に返されます) -- スパースモジュールのロードバランス補助損失。ルーターバイアスでエキスパートをバランスさせるモデル（DeepSeek-V3 とそこから派生したアーキテクチャ）は、`router_logits` を返しながらも、ここでは `None` を返します。
- **router_logits** (`tuple(torch.Tensor)`、*optional*、`output_router_logits=True` が渡された場合または `config.output_router_logits=True` の場合に返されます) -- `torch.Tensor` のタプル（スパース層ごとに1つ）、形状は `(batch_size * sequence_length, num_experts)`。

  MoE ルーターによって計算される生のルーター logits です。ロードバランシング損失の計算や、トークンがどのようにエキスパートにディスパッチされるかの確認に使用できます。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  シーケンシャルなデコーディングを高速化するために使用できる（`cache` 入力参照）、事前計算済みの隠れ状態（自己注意ブロックのキーとバリュー）が含まれています。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。

## Qwen3OmniMoePreTrainedModel[[transformers.Qwen3OmniMoePreTrainedModel]]

#### transformers.Qwen3OmniMoePreTrainedModel[[transformers.Qwen3OmniMoePreTrainedModel]]

```python
transformers.Qwen3OmniMoePreTrainedModel(config: PreTrainedConfig, *inputs, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L116)

**パラメータ:**

config ([PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

## Qwen3OmniMoePreTrainedModelForConditionalGeneration[[transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration]]

#### transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration[[transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration]]

```python
transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration(config: PreTrainedConfig, *inputs, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L160)

#### get_chunked_index[[transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration.get_chunked_index]]

```python
get_chunked_index(token_indices: Tensor, tokens_per_chunk: int, remove_index: int)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L183)

**パラメータ:**

token_indices (`torch.Tensor`、形状 `(seq_len, )`) : トークンインデックス値の単調増加リスト。

t_ntoken_per_chunk (`int`) : チャンクあたりのトークン数（チャンクサイズのしきい値として使用されます）。

remove_index `int` チャンク化の前に`token_indices`から減算するインデックスID --

**戻り値:** `list[tuple[int, int]]`

`token_indices`内のチャンクについて、開始インデックス（含む）と終了インデックス（含まない）を表すタプルのリスト。

トークン値の範囲に基づいて、トークンインデックスのリストをチャンクに分割します。

トークンインデックスのリストが与えられた場合、トークン値が`t_ntoken_per_chunk`の連続する範囲内に収まるリストのスライスを表す(start, end)インデックスのタプルのリストを返します。

例えば、`t_ntoken_per_chunk`が1000の場合、この関数は以下の条件を満たすようにチャンクを作成します。
- 最初のチャンクには、トークン値が 1000 未満のものが含まれます。
- 2番目のチャンクには1000以上かつ2000未満の値が含まれ、以下同様に続きます。

#### get_rope_index[[transformers.Qwen3OmniMoePreTrainedModelForConditionalGeneration.get_rope_index]]

```python
get_rope_index(input_ids: typing.Optional[torch.LongTensor] = None, image_grid_thw: typing.Optional[torch.LongTensor] = None, video_grid_thw: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, use_audio_in_video: bool = False, audio_seqlens: typing.Optional[torch.LongTensor] = None, second_per_grids: typing.Optional[torch.Tensor] = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L220)

**パラメータ:**

input_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックスです。パディングを指定した場合、デフォルトでは無視されます。

image_grid_thw (`torch.LongTensor`、形状 `(num_images, 3)`、*任意*) : LLM における各画像のフィーチャー形状の時間軸、高さ、幅。

video_grid_thw (`torch.LongTensor`、形状 `(num_videos, 3)`、*任意*) : LLM における各動画のフィーチャー形状の時間軸、高さ、幅。

attention_mask (`torch.Tensor`、shape `(batch_size, sequence_length)`、*任意*) : padding トークンのインデックスに対する attention を回避するためのマスク。`[0, 1]` から選択されるマスクの値:  - **マスクされない**トークンは 1、- **マスクされる**トークンは 0。

use_audio_in_video (`bool`, *任意*) : `True`に設定すると、動画内のオーディオを使用します。

audio_seqlens (`torch.LongTensor`、形状 `(num_audios)`、*任意*) : LLMにおける各オーディオのフィーチャー形状の長さ。

second_per_grids (`torch.LongTensor`、形状 `(num_videos)`、*任意*) : 3D 位置 ID の時間軸方向の各グリッドの時間間隔（秒）。

**戻り値:**

position_ids (`torch.LongTensor`、形状 `(3, batch_size, sequence_length)`) mrope_position_deltas (`torch.Tensor`、形状 `(batch_size)`)

LLMにおいて、画像と動画の時間軸、高さ、幅に基づいて3D ropeインデックスを計算します。

説明: 各埋め込みシーケンスには、ビジョン埋め込みとテキスト埋め込みの両方が含まれる場合と、テキスト埋め込みのみが含まれる場合があります。

純粋なテキスト埋め込みシーケンスの場合、回転位置埋め込みは最新のLLMと違いはありません。例: input_ids: [T T T T T]、ここでTはテキストを表します。temporal position_ids: [0, 1, 2, 3, 4] height position_ids: [0, 1, 2, 3, 4] width position_ids: [0, 1, 2, 3, 4]

ビジョンとテキストの埋め込みシーケンスでは、ビジョン部分には3次元の回転位置埋め込みを、テキスト部分には1次元の回転位置埋め込みを計算します。例: Temporal (Time): 3つのパッチで、動画の時間的な異なるセグメントを表します。Height: 2つのパッチで、各フレームを垂直に分割します。Width: 2つのパッチで、各フレームを水平に分割します。また、いくつかの重要なパラメータがあります: fps (Frames Per Second): 動画のフレームレートで、1に設定されています。これは、1秒ごとに1フレームが処理されることを意味します。tokens_per_second: これは重要なパラメータです。動画の1秒間隔に概念的に詰め込まれる「タイムステップ」または「時間的トークン」の数を決定します。この場合、1秒あたり25トークンです。したがって、動画の1秒は25個の独立した時間点で表されます。本質的には、時間的な粒度を定義しています。temporal_patch_size: 1つの時間的パッチを構成するフレーム数です。ここでは、2フレームです。interval: 時間的位置IDのステップサイズで、tokens_per_second * temporal_patch_size / fps として計算されます。この場合、25 * 2 / 1 = 50 です。これは、各時間的パッチの時間的位置IDの差が50であることを意味します。input_ids: [V V V V V V V V V V V V T T T T T]、ここでVはビジョンを表します。vision temporal position_ids: [0, 0, 0, 0, 50, 50, 50, 50, 100, 100, 100, 100] vision height position_ids: [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1] vision width position_ids: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1] text temporal position_ids: [101, 102, 103, 104, 105] text height position_ids: [101, 102, 103, 104, 105] text width position_ids: [101, 102, 103, 104, 105] ここで、テキストの開始位置のposition_idsは、ビジョンのposition_idsの最大値に1を加えたものとして計算されます。

## Qwen3OmniMoeTalkerModel[[transformers.Qwen3OmniMoeTalkerModel]]

#### transformers.Qwen3OmniMoeTalkerModel[[transformers.Qwen3OmniMoeTalkerModel]]

```python
transformers.Qwen3OmniMoeTalkerModel(config: Qwen3OmniMoeTalkerTextConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2960)

**パラメータ:**

config ([Qwen3OmniMoeTalkerTextConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerTextConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

Qwen3OmniMoeのテキスト部分であり、純粋なテキスト専用モデルではありません。DeepStackは視覚特徴を初期の隠れ状態に統合するためです。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeTalkerModel.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, cache: transformers.cache_utils.Cache | None = None, inputs_embeds: typing.Optional[torch.Tensor] = None, use_cache: bool | None = None, visual_pos_masks: typing.Optional[torch.Tensor] = None, deepstack_visual_embeds: list[torch.Tensor] | None = None, **kwargs: *<class 'transformers.modeling_flash_attention_utils.FlashAttentionKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2985)

**パラメータ:**

input_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 語彙における入力シーケンスのトークンインデックスです。デフォルトでは、パディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細については、[PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`torch.Tensor`、shape `(batch_size, sequence_length)`、*任意*) : padding トークンのインデックスに対する attention を回避するためのマスクです。マスクの値は `[0, 1]` から選択されます:  - **マスクされない**トークンは 1、- **マスクされる**トークンは 0。  [attention マスクとは?](../glossary#attention-mask)

position_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 各入力シーケンスのトークンが位置埋め込み内で占める位置のインデックスです。`[0, config.n_positions - 1]` の範囲から選択されます。 [位置 ID とは何か？](../glossary#position-ids)

cache (`~cache_utils.Cache`, *任意*) : 逐次的なデコーディングを高速化するために使用できる、事前計算された隠れ状態（自己注意ブロックおよび相互注意ブロック内のキーとバリュー）です。通常、`use_cache=True` または `config.use_cache=True` の場合、デコーディングの以前の段階でモデルが返した `cache` になります。入力として許可されるのは [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) インスタンスのみです。[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache) を参照してください。`cache` が渡されない場合、デフォルトで [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) が初期化されます。モデルは、入力として与えられたのと同じキャッシュ形式を出力します。`cache` を使用する場合、ユーザーは、このモデルに過去のキーバリュー状態が与えられていない未処理の `input_ids` のみを、`(batch_size, sequence_length)` の形状を持つすべての `input_ids` の代わりに、`(batch_size, unprocessed_length)` の形状で入力することが期待されます。

inputs_embeds (`torch.Tensor`、shape `(batch_size, sequence_length, hidden_size)`、*任意*) : `input_ids` を渡す代わりに、埋め込み表現を直接渡すこともできます。これは、モデル内部の埋め込み参照行列よりも、`input_ids` のインデックスを対応するベクトルに変換する方法をより細かく制御したい場合に有用です。

use_cache (`bool`, *任意*) : `True`に設定すると、`cache`のキーとバリューの状態が返され、デコーディングの高速化に使用できます（`cache`を参照）。

visual_pos_masks (`torch.Tensor`、shape `(batch_size, seqlen)`、*optional*) : 視覚位置のマスク。

deepstack_visual_embeds (`list[torch.Tensor]`、*optional*) : deepstack 視覚埋め込みです。形状は (num_layers, visual_seqlen, embed_dim) です。この特徴量は、異なる視覚エンコーダー層から抽出され、デコーダーの隠れ状態に与えられます。論文 DeepStack(https://arxiv.org/abs/2406.04334) に基づいています。

**戻り値:** `MoeModelOutputWithPast` または `tuple(torch.Tensor)`

`MoeModelOutputWithPast`、または`torch.Tensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（`None`）や入力に応じて、さまざまな要素で構成されます。

[Qwen3OmniMoeTalkerModel](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerModel) の forward メソッドは、`__call__` という特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  自己注意ブロックおよび（`config.is_encoder_decoder=True` の場合、任意で）相互注意ブロックの事前計算済み隠れ状態（キーとバリュー）が含まれており、シーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **router_logits** (`tuple(torch.Tensor)`、*optional*、`output_router_probs=True` と `config.add_router_probs=True` が渡された場合、または `config.output_router_probs=True` の場合に返されます) -- 各層に対応する `torch.Tensor` のタプルで、形状は `(batch_size, sequence_length, num_experts)` です。

  MoE ルーターによって計算される生（raw）のルーター logits（softmax 後）であり、Mixture of Experts モデルの補助損失を計算するためにこれらの用語が使用されます。

## Qwen3OmniMoeThinkerTextPreTrainedModel[[transformers.Qwen3OmniMoeThinkerTextPreTrainedModel]]

#### transformers.Qwen3OmniMoeThinkerTextPreTrainedModel[[transformers.Qwen3OmniMoeThinkerTextPreTrainedModel]]

```python
transformers.Qwen3OmniMoeThinkerTextPreTrainedModel(config: PreTrainedConfig, *inputs, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L1568)

**パラメータ:**

config ([PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

## Qwen3OmniMoeProcessor[[transformers.Qwen3OmniMoeProcessor]]

#### transformers.Qwen3OmniMoeProcessor[[transformers.Qwen3OmniMoeProcessor]]

```python
transformers.Qwen3OmniMoeProcessor(image_processor = None, video_processor = None, feature_extractor = None, tokenizer = None, chat_template = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/processing_qwen3_omni_moe.py#L128)

**パラメータ:**

image_processor (`Qwen2VLImageProcessor`) : 画像プロセッサは必須の入力です。

video_processor (`Qwen2VLVideoProcessor`) : 動画プロセッサは必須の入力です。

feature_extractor (`WhisperFeatureExtractor`) : 特徴量抽出器は必須の入力です。

tokenizer (`Qwen2Tokenizer`) : トークナイザーは必須の入力です。

chat_template (`str`) : チャット内のメッセージのリストをトークン化可能な文字列に変換するための Jinja テンプレート。

画像プロセッサ、動画プロセッサ、特徴量抽出器、トークナイザーを単一のプロセッサにラップするQwen3OmniMoeProcessorを構築します。

[Qwen3OmniMoeProcessor](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeProcessor) は、[Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor)、[Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor)、[WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)、[Qwen2Tokenizer](/docs/transformers/main/ja/model_doc/qwen2#transformers.Qwen2Tokenizer) のすべての機能を提供します。詳細については、[~Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor)、[~Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor)、[~WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)、[~Qwen2Tokenizer](/docs/transformers/main/ja/model_doc/qwen2#transformers.Qwen2Tokenizer) を参照してください。

#### __call__[[transformers.Qwen3OmniMoeProcessor.__call__]]

```python
__call__(text: str | list[str] | list[list[str]] = None, images: typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor'], NoneType] = None, videos: typing.Union[list['PIL.Image.Image'], numpy.ndarray, ForwardRef('torch.Tensor'), list[numpy.ndarray], list['torch.Tensor'], list[list['PIL.Image.Image']], list[list[numpy.ndarray]], list[list['torch.Tensor']], transformers.video_utils.URL, list[transformers.video_utils.URL], list[list[transformers.video_utils.URL]], transformers.video_utils.Path, list[transformers.video_utils.Path], list[list[transformers.video_utils.Path]], NoneType] = None, audio: typing.Union[numpy.ndarray, ForwardRef('torch.Tensor'), collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence['torch.Tensor'], NoneType] = None, **kwargs: *<class 'transformers.models.qwen3_omni_moe.processing_qwen3_omni_moe.Qwen3OmniMoeProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/processing_qwen3_omni_moe.py#L164)

**パラメータ:**

text (`Union[str, list[str], list[list[str]]]`、*任意*) : エンコード対象のシーケンスまたはシーケンスのバッチです。各シーケンスは文字列、または文字列のリスト（プレトークナイズ済み文字列）であることができます。プレトークナイズ済み入力を渡す場合は、バッチ入力との曖昧さを避けるために `is_split_into_words=True` を設定してください。

images (`Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]`, *任意*) : 前処理を行う画像。ピクセル値が 0 から 255 の範囲にある単一の画像またはバッチの画像を想定しています。ピクセル値が 0 から 1 の範囲にある画像を渡す場合は、`do_rescale=False` を設定してください。

videos (`Union[list[PIL.Image.Image], numpy.ndarray, torch.Tensor, list[numpy.ndarray], list[torch.Tensor], list[list[PIL.Image.Image]], list[list[numpy.ndarray]], list[list[torch.Tensor]], ~video_utils.URL, list[~video_utils.URL], list[list[~video_utils.URL]], ~video_utils.Path, list[~video_utils.Path], list[list[~video_utils.Path]]]`, *任意*) : 前処理対象の動画。ピクセル値が 0 から 255 の範囲にある単一の動画またはバッチを想定しています。ピクセル値が 0 から 1 の範囲にある動画を渡す場合は、`do_rescale=False` を設定してください。

audio (`Union[numpy.ndarray, torch.Tensor, collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence[torch.Tensor]]`, *任意*) : 準備対象のオーディオまたはオーディオのバッチです。各オーディオは NumPy 配列または PyTorch テンソルであることができます。NumPy 配列/PyTorch テンソルの場合、各オーディオの形状は (C, T) である必要があります。ここで C はチャネル数、T はオーディオのサンプル長を表します。

min_pixels (`int`, *kwargs*, *optional*) : リサイズ後の動画フレームの最小ピクセル数（高さ × 幅）。この閾値より小さいフレームは、最小要件を満たすようにアップスケールされます。

max_pixels (`int`, *kwargs*, *optional*) : リサイズ後の動画フレームの最大ピクセル数（高さ × 幅）。この閾値を超えるフレームは、制限内に収まるようダウンスケールされます。

patch_size (`int`, *kwargs*, *optional*) : ビジョンエンコーダーが使用する空間パッチサイズです。動画フレームは、高さおよび幅の両方の次元で、このサイズのパッチに分割されます。

temporal_patch_size (`int`, *kwargs*, *optional*) : ビジョンエンコーダーで使用される時間パッチサイズです。これは、何フレーム連続のフレームが1つの時間パッチとしてグループ化されるかを決定します。

merge_size (`int`, *kwargs*, *optional*) : 空間パッチを結合するために使用されるマージサイズです。複数のパッチをマージすることで、空間情報を保持したままシーケンス長を短縮します。

min_frames (`int`, *kwargs*, *optional*) : 動画から抽出するフレームの最小数。フレーム数がこれより少ない動画は、この要件を満たすためにパディングまたは繰り返し処理が適用されます。

max_frames (`int`, *kwargs*, *optional*) : 動画から抽出するフレームの最大数。より長い動画は、この制限内に収まるように切り詰めまたはサンプリングされます。

use_audio_in_video (`bool`, *kwargs*, *optional*, デフォルトは `False`) : 非推奨です。`Qwen3OmniMoeProcessorKwargs.load_audio_from_video` を使用してください。動画の処理時に音声情報を取り込むかどうかを指定します。有効にすると、時間的な整合性に基づいて音声トークンが動画トークンと交互に配置され、統合されたマルチモーダル表現が作成されます。

load_audio_from_video (`bool`, *kwargs*, *optional*, デフォルトは `False`) : 非推奨です。`Qwen3OmniMoeProcessorKwargs.load_audio_from_video` を使用してください。動画の処理時に音声情報を取り込むかどうかを指定します。有効にすると、時間的な整合性に基づいて音声トークンが動画トークンと交互に配置され、統合されたマルチモーダル表現が作成されます。

seconds_per_chunk (`float`, *kwargs*, *optional*, デフォルトは `2.0`) : 非推奨です。`Qwen3OmniMoeProcessorKwargs.seconds_per_chunk` を使用してください。長い動画を分割する際の、各動画チャンクの長さ（秒）です。このパラメータは、処理のために動画を時間的なセグメントにどのように分割するかを制御します。

position_id_per_seconds (`int`、*kwargs*または`float`、*optional*、デフォルト値は`25`) : 非推奨です。`Qwen3OmniMoeProcessorKwargs.position_id_per_seconds`を使用してください。1秒の動画あたりに割り当てられる位置IDの数です。このパラメータは位置埋め込みの時間分解能を制御し、`use_audio_in_video=True`の場合に動画トークンを音声トークンと整合させるために使用されます。

return_mm_token_type_ids (`bool`, *kwargs*) : マルチモーダルプレースホルダトークンの位置を示すマルチモーダルトークンタイプIDを返すかどうか。

return_text_replacement_offsets (`bool`, *kwargs*) : 各マルチモーダルプレースホルダーとその置換文字列の文字オフセットを返すかどうか。

load_audio_from_video (`bool`, *kwargs*) : 入力動画のオーディオトラックを読み込むかどうか。モデルがサポートしている場合、オーディオトークンはビデオトークンと交互に配置されます。

seconds_per_chunk (`float`, *kwargs*, *optional*, デフォルトは `2.0`) : 長い動画を分割する際の、各動画チャンクの長さ（秒）。このパラメータは、処理のために動画を時間的なセグメントにどのように分割するかを制御します。

position_id_per_seconds (`int`、*kwargs*または`float`、*optional*、デフォルトは`13.0`) : 動画1秒あたりに割り当てられる位置IDの数。このパラメータは位置埋め込みの時間分解能を制御し、`load_audio_from_video=True`の場合に動画トークンを音声トークンと整合させるために使用されます。

n_window (`int`, *kwargs*, *optional*, デフォルトは`50`) : 音声エンコーダーのウィンドウサイズです。これはモデル設定の`n_window`と一致させる必要があります。

return_tensors (`str` または [TensorType](/docs/transformers/main/ja/internal/file_utils#transformers.TensorType)、*optional*) : 設定されている場合、特定のフレームワークのテンソルを返します。受け入れ可能な値は以下の通りです:  - `'pt'`: PyTorch の `torch.Tensor` オブジェクトを返します。 - `'np'`: NumPy の `np.ndarray` オブジェクトを返します。

- ****kwargs** ([ProcessingKwargs](/docs/transformers/main/ja/main_classes/processors#transformers.ProcessingKwargs), *optional*) : 各モダリティ（テキスト、画像、動画、音声）の追加処理オプション。モデル固有のパラメータは上記にリストされています。サポートされている引数の完全なリストについては、TypedDict クラスを参照してください。

**戻り値:** `~feature_extraction_utils.BatchFeature`

- **data** (`dict`, *任意*) -- __call__/pad メソッドによって返されるリスト/配列/テンソルの辞書（'input_values'、'attention_mask' など）。
- **tensor_type** (`Union[None, str, TensorType]`、*省略可*) -- 初期化時に PyTorch/Numpy の Tensor 内の整数リストを変換するために、ここで tensor_type を指定できます。
- **skip_tensor_conversion** (`list[str]` または `set[str]`、*任意*) -- `tensor_type` が指定されている場合でも、テンソルに変換すべきでないキーのリストまたはセット。

## Qwen3OmniMoeCode2Wav[[transformers.Qwen3OmniMoeCode2Wav]]

#### transformers.Qwen3OmniMoeCode2Wav[[transformers.Qwen3OmniMoeCode2Wav]]

```python
transformers.Qwen3OmniMoeCode2Wav(config: Qwen3OmniMoeCode2WavConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3895)

## Qwen3OmniMoeCode2WavDecoderBlock[[transformers.Qwen3OmniMoeCode2WavDecoderBlock]]

#### transformers.Qwen3OmniMoeCode2WavDecoderBlock[[transformers.Qwen3OmniMoeCode2WavDecoderBlock]]

```python
transformers.Qwen3OmniMoeCode2WavDecoderBlock(config: Qwen3OmniMoeCode2WavConfig, layer_idx)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3868)

## Qwen3OmniMoeCode2WavTransformerModel[[transformers.Qwen3OmniMoeCode2WavTransformerModel]]

#### transformers.Qwen3OmniMoeCode2WavTransformerModel[[transformers.Qwen3OmniMoeCode2WavTransformerModel]]

```python
transformers.Qwen3OmniMoeCode2WavTransformerModel(config: Qwen3OmniMoeCode2WavConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3709)

**パラメータ:**

config (`Qwen3OmniMoeCode2WavConfig`) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

Qwen3 Omni Moeの生モデルで、特定のヘッドを上に載せず、生のhidden-statesを出力します。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeCode2WavTransformerModel.forward]]

```python
forward(input_ids = None, attention_mask = None, position_ids = None, cache = None, inputs_embeds = None, use_cache = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L3730)

**パラメータ:**

input_ids (`` of shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックス。デフォルトではパディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細は [PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`` of shape `(batch_size, sequence_length)`) : Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:  - 1 for tokens that are **not masked**, - 0 for tokens that are **masked**.  [What are attention masks?](../glossary#attention-mask)

position_ids ```
(` of shape `(batch_size, sequence_length)`) : Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0, config.n_positions - 1]`.  [What are position IDs?](../glossary#position-ids)
```

cache (``) : Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used to speed up sequential decoding. This typically consists in the `cache` returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.  Only [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) instance is allowed as input, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). If no `cache` are passed, [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) will be initialized by default.  The model will output the same cache format that is fed as input.  If `cache` are used, the user is expected to input only unprocessed `input_ids` (those that don't have their past key value states given to this model) of shape `(batch_size, unprocessed_length)` instead of all `input_ids` of shape `(batch_size, sequence_length)`.

inputs_embeds (`` of shape `(batch_size, sequence_length, hidden_size)`) : Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This is useful if you want more control over how to convert `input_ids` indices into associated vectors than the model's internal embedding lookup matrix.

use_cache (``) : If set to `True`, `cache` key value states are returned and can be used to speed up decoding (see `cache`).

**戻り値:** [BaseModelOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast) または `tuple(torch.Tensor)`

`None` や入力に応じて、さまざまな要素で構成される [BaseModelOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast) または `torch.Tensor` のタプル（`return_dict=False` が渡された場合、または `config.return_dict=False` の場合）。

[Qwen3OmniMoeCode2WavTransformerModel](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeCode2WavTransformerModel)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。

  `cache`が使用されている場合、出力されるのは形状`(batch_size, 1, hidden_size)`のシーケンスの最後の隠れ状態のみです。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  自己注意ブロックおよび（`config.is_encoder_decoder=True` の場合、任意で）相互注意ブロックの事前計算済み隠れ状態（キーとバリュー）が含まれており、シーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。

## Qwen3OmniMoeTalkerCodePredictorModel[[transformers.Qwen3OmniMoeTalkerCodePredictorModel]]

#### transformers.Qwen3OmniMoeTalkerCodePredictorModel[[transformers.Qwen3OmniMoeTalkerCodePredictorModel]]

```python
transformers.Qwen3OmniMoeTalkerCodePredictorModel(config: Qwen3OmniMoeTalkerCodePredictorConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2613)

**パラメータ:**

config ([Qwen3OmniMoeTalkerCodePredictorConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerCodePredictorConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

Qwen3 Omni Moeの生モデルで、特定のヘッドを上に載せず、生のhidden-statesを出力します。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeTalkerCodePredictorModel.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, cache: transformers.cache_utils.Cache | None = None, inputs_embeds: typing.Optional[torch.Tensor] = None, use_cache: bool | None = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2642)

**パラメータ:**

input_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 語彙における入力シーケンスのトークンインデックスです。デフォルトでは、パディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細については、[PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`torch.Tensor`、shape `(batch_size, sequence_length)`、*任意*) : padding トークンのインデックスに対する attention を回避するためのマスクです。マスクの値は `[0, 1]` から選択されます:  - **マスクされない**トークンは 1、- **マスクされる**トークンは 0。  [attention マスクとは?](../glossary#attention-mask)

position_ids (`torch.LongTensor`、shape `(batch_size, sequence_length)`、*任意*) : 各入力シーケンスのトークンが位置埋め込み内で占める位置のインデックスです。`[0, config.n_positions - 1]` の範囲から選択されます。 [位置 ID とは何か？](../glossary#position-ids)

cache (`~cache_utils.Cache`, *任意*) : 逐次的なデコーディングを高速化するために使用できる、事前計算された隠れ状態（自己注意ブロックおよび相互注意ブロック内のキーとバリュー）です。通常、`use_cache=True` または `config.use_cache=True` の場合、デコーディングの以前の段階でモデルが返した `cache` になります。入力として許可されるのは [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) インスタンスのみです。[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache) を参照してください。`cache` が渡されない場合、デフォルトで [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) が初期化されます。モデルは、入力として与えられたのと同じキャッシュ形式を出力します。`cache` を使用する場合、ユーザーは、このモデルに過去のキーバリュー状態が与えられていない未処理の `input_ids` のみを、`(batch_size, sequence_length)` の形状を持つすべての `input_ids` の代わりに、`(batch_size, unprocessed_length)` の形状で入力することが期待されます。

inputs_embeds (`torch.Tensor`、shape `(batch_size, sequence_length, hidden_size)`、*任意*) : `input_ids` を渡す代わりに、埋め込み表現を直接渡すこともできます。これは、モデル内部の埋め込み参照行列よりも、`input_ids` のインデックスを対応するベクトルに変換する方法をより細かく制御したい場合に有用です。

use_cache (`bool`, *任意*) : `True`に設定すると、`cache`のキーとバリューの状態が返され、デコーディングの高速化に使用できます（`cache`を参照）。

**戻り値:** [BaseModelOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast) または `tuple(torch.Tensor)`

`None` や入力に応じて、さまざまな要素で構成される [BaseModelOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast) または `torch.Tensor` のタプル（`return_dict=False` が渡された場合、または `config.return_dict=False` の場合）。

[Qwen3OmniMoeTalkerCodePredictorModel](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerCodePredictorModel) の forward メソッドは、`__call__` という特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **last_hidden_state** (`torch.Tensor`、形状 `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。

  `cache`が使用されている場合、出力されるのは形状`(batch_size, 1, hidden_size)`のシーケンスの最後の隠れ状態のみです。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  自己注意ブロックおよび（`config.is_encoder_decoder=True` の場合、任意で）相互注意ブロックの事前計算済み隠れ状態（キーとバリュー）が含まれており、シーケンシャルデコーディングを高速化するために使用できます（`cache` 入力参照）。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。

## Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration[[transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration]]

#### transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration[[transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration]]

```python
transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration(config: Qwen3OmniMoeTalkerCodePredictorConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2703)

**パラメータ:**

config ([Qwen3OmniMoeTalkerCodePredictorConfig](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerCodePredictorConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを確認してください。

他のモダリティ（例：画像とテキストからテキストへの生成）を条件としてトークンを生成するためのQwen3 Omni Moeモデル。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration.forward]]

```python
forward(input_ids = None, attention_mask = None, position_ids = None, cache = None, inputs_embeds = None, labels = None, use_cache = None, generation_steps = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py#L2726)

**パラメータ:**

input_ids (`` of shape `(batch_size, sequence_length)`) : 語彙における入力シーケンスのトークンインデックス。デフォルトではパディングは無視されます。インデックスは [AutoTokenizer](/docs/transformers/main/ja/model_doc/auto#transformers.AutoTokenizer) を使用して取得できます。詳細は [PreTrainedTokenizer.encode()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) および [PreTrainedTokenizer.__call__()](/docs/transformers/main/ja/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__) を参照してください。 [入力IDとは何ですか？](../glossary#input-ids)

attention_mask (`` of shape `(batch_size, sequence_length)`) : Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:  - 1 for tokens that are **not masked**, - 0 for tokens that are **masked**.  [What are attention masks?](../glossary#attention-mask)

position_ids ```
(` of shape `(batch_size, sequence_length)`) : Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0, config.n_positions - 1]`.  [What are position IDs?](../glossary#position-ids)
```

cache (``) : Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used to speed up sequential decoding. This typically consists in the `cache` returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.  Only [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) instance is allowed as input, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). If no `cache` are passed, [DynamicCache](/docs/transformers/main/ja/internal/generation_utils#transformers.DynamicCache) will be initialized by default.  The model will output the same cache format that is fed as input.  If `cache` are used, the user is expected to input only unprocessed `input_ids` (those that don't have their past key value states given to this model) of shape `(batch_size, unprocessed_length)` instead of all `input_ids` of shape `(batch_size, sequence_length)`.

inputs_embeds (`` of shape `(batch_size, sequence_length, hidden_size)`) : Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This is useful if you want more control over how to convert `input_ids` indices into associated vectors than the model's internal embedding lookup matrix.

labels (`` of shape `(batch_size, sequence_length)`) : Labels for computing the masked language modeling loss. Indices should either be in `[0, ..., config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]

use_cache (``) : If set to `True`, `cache` key value states are returned and can be used to speed up decoding (see `cache`).

generation_steps (`int`) : コード予測子の生成ステップ、0..num_code_groups-1

**戻り値:** [CausalLMOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast) または `tuple(torch.Tensor)`

`None` や入力に応じて、さまざまな要素で構成される [CausalLMOutputWithPast](/docs/transformers/main/ja/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast) または `torch.Tensor` のタプル（`return_dict=False` が渡された場合、または `config.return_dict=False` の場合）。

[Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen3_omni_moe#transformers.Qwen3OmniMoeTalkerCodePredictorModelForConditionalGeneration)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **loss** (`torch.Tensor`、形状 `(1,)`、*任意*、`labels` が指定された場合に返されます) -- 言語モデリングの損失(次のトークンの予測用)。
- **logits** (`torch.Tensor`、形状 `(batch_size, sequence_length, config.vocab_size)`) -- 言語モデリングヘッドの予測スコア（SoftMax 適用前の各語彙トークンのスコア）。
- **cache** (`Cache`、*任意*、`use_cache=True` が渡された場合または `config.use_cache=True` の場合に返されます) -- [Cache](/docs/transformers/main/ja/internal/generation_utils#transformers.Cache) のインスタンスです。詳細については、[kv cache ガイド](https://huggingface.co/docs/transformers/en/kv_cache)を参照してください。

  シーケンシャルなデコーディングを高速化するために使用できる（`cache` 入力参照）、事前計算済みの隠れ状態（自己注意ブロックのキーとバリュー）が含まれています。
- **hidden_states** (`tuple(torch.Tensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.Tensor` のタプル（モデルに埋め込み層がある場合はその出力用 1 つ、各層の出力用 1 つずつ）で、形状は `(batch_size, sequence_length, hidden_size)` です。

  各層の出力におけるモデルのHidden-states、および任意の初期埋め込み出力。
- **attentions** (`tuple(torch.Tensor)`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `torch.Tensor` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。

