# Qwen2.5-Omni

## 概要

[Qwen2.5-Omni](https://qwenlm.github.io/blog/qwen2.5-omni/)モデルは、Alibaba GroupのQwenチームが[Qwen2.5-Omni Technical Report](https://huggingface.co/papers/2503.20215)で提案した、統合型マルチモーダルモデルです。

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

*Qwen2.5-Omni は、テキスト、画像、音声、動画といった多様なモダリティを認識し、同時にテキストと自然な音声応答をストリーミング形式で生成するように設計されたエンドツーエンドのマルチモーダルモデルです。マルチモーダル情報入力のストリーミングを可能にするため、音声エンコーダーと視覚エンコーダーの両方がブロック単位の処理アプローチを採用しています。この戦略により、マルチモーダルデータの長いシーケンスの処理が効果的に分離され、知覚の責任はマルチモーダルエンコーダーに、拡張されたシーケンスのモデリングは大型言語モデルに委ねられます。このような役割分担により、共有アテンション機構を介した異なるモダリティの融合が強化されます。動画入力のタイムスタンプを音声と同期させるため、音声を動画と交互に順序立てて配置し、TMRoPE（Time-aligned Multimodal RoPE）と呼ばれる新しい位置埋め込みアプローチを提案しました。テキストと音声を同時に生成しつつ、2つのモダリティ間の干渉を回避するために、Thinker-Talker アーキテクチャを提案します。このフレームワークにおいて、Thinker はテキスト生成を担う大型言語モデルとして機能し、Talker は Thinker からの隠れ表現を直接利用して音声トークンを出力として生成するデュアルトラックの自己回帰モデルです。Thinker と Talker の両方のモデルは、エンドツーエンドで学習および推論されるように設計されています。音声トークンをストリーミング形式でデコードするために、感受野を制限して初期パッケージの遅延を削減することを目的としたスライディングウィンドウ DiT を導入しました。Qwen2.5-Omni は、画像および音声の機能の両面で、同サイズの Qwen2-VL および Qwen2-Audio を上回っています。さらに、Qwen2.5-Omni は Omni-Bench などのマルチモーダルベンチマークで最先端の性能を達成しています。特に、MMLU や GSM8K などのベンチマークが示すように、Qwen2.5-Omni は、テキスト入力時の能力と同等のレベルのエンドツーエンドの音声指示追従性能を達成した最初のオープンソースモデルです。音声生成については、Qwen2.5-Omni のストリーミング Talker は、堅牢性と自然さにおいて、既存のほとんどのストリーミングおよび非ストリーミングの代替方案を上回っています。*

> [!TIP]
> `use_kernels=True` を [from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) に設定すると、対応するレイヤーが Hub からの最適化されたカーネルに置き換えられます。詳細は [カーネルの読み込み](../kernel_doc/loading_kernels) を参照してください。

## 注記

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

## 使用例

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

### 単一メディア推論

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

```python
import soundfile as sf

from transformers import Qwen2_5OmniForConditionalGeneration, Qwen2_5OmniProcessor

model = Qwen2_5OmniForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto",
)
processor = Qwen2_5OmniProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

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 `Qwen2-5-OmniProcessor`
    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)
```

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

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

```python
from transformers import Qwen2_5OmniProcessor, Qwen2_5OmniThinkerForConditionalGeneration

model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto",
)
processor = Qwen2_5OmniProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

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 `Qwen2-5-OmniProcessor`
    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)
```

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

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

```python
from transformers import Qwen2_5OmniForConditionalGeneration, Qwen2_5OmniProcessor

model = Qwen2_5OmniForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto"
)
processor = Qwen2_5OmniProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

# 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 `Qwen2-5-OmniProcessor`
    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)
```

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

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

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

model_id = "Qwen/Qwen2.5-Omni-7B"
model = AutoModelForTextToWaveform.from_pretrained(model_id, device_map="auto")
processor = AutoProcessor.from_pretrained(model_id)
sampling_rate = 24000  # output sampling rate
max_new_tokens = 200  # 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?",
    "The weather is nice today. Let's go for a walk.",
]
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"qwen2_5_omni_output_{sample_id}.wav",
        audio.detach().to(torch.float32).cpu().numpy(),
        sampling_rate,
    )
    print(f"Saved audio to qwen2_5_omni_output_{sample_id}.wav")
```

### 使用のコツ

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

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

```python
min_pixels = 128*28*28
max_pixels = 768*28*28
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B", 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.

```python
{
    "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 = Qwen2_5OmniForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto",
    enable_audio_output=False,
)
```

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

```python
model = Qwen2_5OmniForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto",
    enable_audio_output=True,
)
...
text_ids = model.generate(**inputs, return_audio=False)
```

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

Qwen2.5-Omni supports the ability to change the voice of the output audio. Users can use the `speaker` parameter of `generate` function to specify the voice type. The `"Qwen/Qwen2.5-Omni-7B"` checkpoint support two voice types: `Chelsie` and `Ethan`, while `Chelsie` is a female voice and `Ethan` is a male voice. By default, if `speaker` is not specified, the default voice type is `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 Qwen2_5OmniForConditionalGeneration

model = Qwen2_5OmniForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-Omni-7B",
    device_map="auto",
    attn_implementation="flash_attention_2",
)
```

## Qwen2_5OmniConfig[[transformers.Qwen2_5OmniConfig]]

#### transformers.Qwen2_5OmniConfig[[transformers.Qwen2_5OmniConfig]]

```python
transformers.Qwen2_5OmniConfig(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, token2wav_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, enable_audio_output: bool = True)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L533)

**パラメータ:**

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

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

token2wav_config (`dict`, *任意*) : 基盤となるコーデックサブモデルの設定。

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

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

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

例:

```python
>>> from transformers import (
...     Qwen2_5OmniThinkerConfig,
...     Qwen2_5OmniTalkerConfig,
...     Qwen2_5OmniToken2WavConfig,
...     Qwen2_5OmniForConditionalGeneration,
...     Qwen2_5OmniConfig,
... )

>>> # Initializing sub-modules configurations.
>>> thinker_config = Qwen2_5OmniThinkerConfig()
>>> talker_config = Qwen2_5OmniTalkerConfig()
>>> token2wav_config = Qwen2_5OmniToken2WavConfig()

>>> # Initializing a module style configuration
>>> configuration = Qwen2_5OmniConfig(
...     thinker_config, talker_config, token2wav_config
... )

>>> # Initializing a model (with random weights)
>>> model = Qwen2_5OmniForConditionalGeneration(configuration)

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

#### get_text_config[[transformers.Qwen2_5OmniConfig.get_text_config]]

```python
get_text_config(*args, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L586)

**パラメータ:**

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

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

## Qwen2_5OmniVisionEncoderConfig[[transformers.Qwen2_5OmniVisionEncoderConfig]]

#### transformers.Qwen2_5OmniVisionEncoderConfig[[transformers.Qwen2_5OmniVisionEncoderConfig]]

```python
transformers.Qwen2_5OmniVisionEncoderConfig(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 = 32, hidden_size: int = 3584, hidden_act: str = 'silu', intermediate_size: int = 3420, num_heads: int = 16, in_channels: int = 3, patch_size: int | list[int] | tuple[int, int] = 14, spatial_merge_size: int = 2, temporal_patch_size: int | list[int] | tuple[int, int] = 2, window_size: int = 112, out_hidden_size: int = 3584, fullatt_block_indexes: list[int] | tuple[int, ...] = (7, 15, 23, 31), initializer_range: float = 0.02, rope_parameters: dict | None = None)
```

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

**パラメータ:**

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

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

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

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

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

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

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

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

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

window_size (`int`、*任意*、デフォルトは 11) : ウィンドウのサイズ。

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

fullatt_block_indexes (`int`, *任意*, デフォルトは `[7, 15, 23, 31]`) : 完全なアテンションを持つレイヤーのインデックス

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

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

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

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

例:

```python
>>> from transformers import Qwen2_5OmniVisionEncoderConfig, Qwen2_5OmniVisionEncoder

>>> # Initializing a Qwen2_5OmniVisionEncoderConfig
>>> configuration = Qwen2_5OmniVisionEncoderConfig()

>>> # Initializing a Qwen2_5OmniVisionEncoder (with random weights)
>>> model = Qwen2_5OmniVisionEncoder(configuration)

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

## Qwen2_5OmniTextConfig[[transformers.Qwen2_5OmniTextConfig]]

#### transformers.Qwen2_5OmniTextConfig[[transformers.Qwen2_5OmniTextConfig]]

```python
transformers.Qwen2_5OmniTextConfig(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 = 152064, hidden_size: int = 3584, intermediate_size: int = 18944, num_hidden_layers: int = 28, num_attention_heads: int = 28, num_key_value_heads: int | None = 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, use_sliding_window: bool = False, sliding_window: int | None = 32768, 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, tie_word_embeddings: bool = True)
```

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

**パラメータ:**

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

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

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 を使用する場合、スケーリングに使用されるパラメータが任意で含まれます。

use_sliding_window (`bool`、*任意*、デフォルトは`False`) : スライディングウィンドウアテンションを使用するかどうか。

sliding_window (`int`、*任意*、デフォルトは`32768`) : スライディングウィンドウアテンションのウィンドウサイズ。`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。

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

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

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

例:

```python
>>> from transformers import Qwen2_5OmniThinkerForConditionalGeneration, Qwen2_5OmniThinkerConfig, Qwen2_5OmniAudioEncoderConfig, Qwen2_5OmniVisionEncoderConfig

>>> # Initializing a Qwen2_5OmniAudioEncoder config
>>> audio_config = Qwen2_5OmniAudioEncoderConfig()

>>> # Initializing a Qwen2_5OmniVisionEncoder config
>>> vision_config = Qwen2_5OmniVisionEncoderConfig()

>>> # Initializing a Qwen2.5OmniThinker configuration
>>> configuration = Qwen2_5OmniThinkerConfig(audio_config, vision_config)

>>> # Initializing a model from the Qwen-Omni style configuration
>>> model = Qwen2_5OmniThinkerForConditionalGeneration(configuration)

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

## Qwen2_5OmniDiTConfig[[transformers.Qwen2_5OmniDiTConfig]]

#### transformers.Qwen2_5OmniDiTConfig[[transformers.Qwen2_5OmniDiTConfig]]

```python
transformers.Qwen2_5OmniDiTConfig(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, hidden_size: int = 1024, num_hidden_layers: int = 22, num_attention_heads: int = 16, ff_mult: int = 2, emb_dim: int = 512, head_dim: int = 64, rope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = None, max_position_embeddings: int = 32768, block_size: int = 24, look_ahead_layers: list[int] | tuple[int, ...] = (10,), look_backward_layers: list[int] | tuple[int, ...] = (0, 20), repeats: int = 2, num_embeds: int = 8193, mel_dim: int = 80, dropout: float | int = 0.1, enc_emb_dim: int = 192, enc_dim: int = 128, enc_channels: list[int] | tuple[int, ...] = (256, 256, 256, 256, 768), enc_kernel_sizes: list[int] | tuple[int, ...] = (5, 3, 3, 3, 1), enc_dilations: list[int] | tuple[int, ...] = (1, 2, 3, 4, 1), enc_attention_channels: int = 64, enc_res2net_scale: int = 2, enc_se_channels: int = 64)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L391)

**パラメータ:**

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

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

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

ff_mult (`int`、*optional*、デフォルトは 2) : 各 Transformer ブロック内のフィードフォワード層の倍率です。

emb_dim (`int`、*任意*、デフォルトは 512) : 埋め込み層の次元数。

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

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

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

block_size (`int`、*optional*、デフォルトは 64) : 各処理ブロックに含まれるトークン（フレーム）の数。

look_ahead_layers (`list[int]`、*optional*、デフォルトは`[10]`) : 将来のブロックへの注意を許可されるtransformer層の数

look_backward_layers (`list[int]`、*optional*、デフォルトは`[0, 20]`) : 現在のブロック境界を超えて過去のブロックに注意を払うtransformer層の数

repeats (`int`、*optional*、デフォルトは 2) : コーデック埋め込みが繰り返される回数。

num_embeds (`int`、*optional*、デフォルトは 8193) : コーデックにおけるユニークな埋め込みの数。

mel_dim (`int`, *任意*, デフォルトは 80) : メルスペクトログラムの次元数。

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

enc_emb_dim (`int`, *optional*, デフォルトは 192) : 事前学習された話者埋め込みの次元数。

enc_dim (`int`、*optional*、デフォルトは 128) : エンコーダー出力の次元数。

enc_channels (`list[int]`, *optional*, デフォルトは `[256, 256, 256, 256, 768]`) : エンコーダーの各 TDNN/SERes2Net レイヤーの出力チャネル数を表すリストです。

enc_kernel_sizes (`list[int]`、*optional*、デフォルトは`[5, 3, 3, 3, 1]`) : エンコーダーの各層におけるカーネルサイズのリストです。

enc_dilations (`list[int]`、*optional*、デフォルトは`[1, 2, 3, 4, 1]`) : エンコーダーの各層のディレーションのリストです。

enc_attention_channels (`int`, *任意*, デフォルトは 64) : SqueezeExcitationBlock 内のアテンションチャネル数。

enc_res2net_scale (`int`、*optional*、デフォルトは 2) : エンコーダーの Res2Net ブロックのスケール。

enc_se_channels (`int`, *optional*, デフォルトは 64) : SqueezeExcitationBlock における squeeze 後の出力チャネル数。

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

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

## Qwen2_5OmniBigVGANConfig[[transformers.Qwen2_5OmniBigVGANConfig]]

#### transformers.Qwen2_5OmniBigVGANConfig[[transformers.Qwen2_5OmniBigVGANConfig]]

```python
transformers.Qwen2_5OmniBigVGANConfig(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, mel_dim: int = 80, upsample_initial_channel: int = 1536, resblock_kernel_sizes: list[int] | tuple[int, ...] = (3, 7, 11), resblock_dilation_sizes: list | tuple = ((1, 3, 5), (1, 3, 5), (1, 3, 5)), upsample_rates: list[int] | tuple[int, ...] = (5, 3, 2, 2, 2, 2), upsample_kernel_sizes: list[int] | tuple[int, ...] = (11, 7, 4, 4, 4, 4))
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L456)

**パラメータ:**

mel_dim (`int`, *任意*, デフォルトは 80) : メルスペクトログラムの次元数。

upsample_initial_channel (`int`、*optional*、デフォルトは 1536) : 最初のアップサンプリング層のチャネル数。

resblock_kernel_sizes (`list[int]`、*optional*、デフォルトは`[3, 7, 11]`) : 各残差ブロックのカーネルサイズを指定するリストです。

resblock_dilation_sizes (`list[list[int]]`、*任意*、デフォルトは`[[1, 3, 5], [1, 3, 5], [1, 3, 5]]`) : 各残差ブロックのディレーションサイズの一覧。

upsample_rates (`list[int]`, *任意*、デフォルトは`[5, 3, 2, 2, 2, 2]`) : 各アップサンプリング層のアップサンプリング率のリスト。

upsample_kernel_sizes (`list[int]`、*optional*、デフォルトは`[11, 7, 4, 4, 4, 4]`) : 各アップサンプリング層のカーネルサイズを指定するリスト。

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

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

## Qwen2_5OmniAudioEncoderConfig[[transformers.Qwen2_5OmniAudioEncoderConfig]]

#### transformers.Qwen2_5OmniAudioEncoderConfig[[transformers.Qwen2_5OmniAudioEncoderConfig]]

```python
transformers.Qwen2_5OmniAudioEncoderConfig(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 = 100, output_dim: int = 3584)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L77)

**パラメータ:**

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`、*任意*、デフォルトは 1500) : このモデルが使用される可能性がある log-mel フィルターバンク特徴量の最大シーケンス長です。

n_window (`int`、*optional*、デフォルトは 100) : AudioEncoder における conv と flash attn のチャンクサイズ。

output_dim (`int`、*optional*、デフォルトは 3584) : AudioEncoder の出力次元です。

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

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

例:

```python
>>> from transformers import Qwen2_5OmniAudioEncoderConfig, Qwen2_5OmniAudioEncoder

>>> # Initializing a Qwen2_5OmniAudioEncoderConfig
>>> configuration = Qwen2_5OmniAudioEncoderConfig()

>>> # Initializing a Qwen2_5OmniAudioEncoder (with random weights)
>>> model = Qwen2_5OmniAudioEncoder(configuration)

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

## Qwen2_5OmniProcessor[[transformers.Qwen2_5OmniProcessor]]

#### transformers.Qwen2_5OmniProcessor[[transformers.Qwen2_5OmniProcessor]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/processing_qwen2_5_omni.py#L111)

**パラメータ:**

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

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

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

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

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

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

[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor) は、[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.Qwen2_5OmniProcessor.__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'), list[numpy.ndarray], list['torch.Tensor'], NoneType] = None, **kwargs: *<class 'transformers.models.qwen2_5_omni.processing_qwen2_5_omni.Qwen2_5OmniProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/processing_qwen2_5_omni.py#L126)

**パラメータ:**

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, list[numpy.ndarray], list[torch.Tensor]]`, *optional*) : 準備対象のオーディオまたはオーディオのバッチです。各オーディオは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`) : 非推奨の引数です。代わりに`load_audio_from_video`を使用してください。

load_audio_from_video (`bool`, *kwargs*, *optional*, デフォルトは `False`) : ビデオを処理する際にオーディオ情報を取り込むかどうかを指定します。有効にすると、時間的な整合性に基づいてオーディオトークンがビデオトークンと交互に配置され、統合されたマルチモーダル表現が作成されます。

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

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

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` が指定されている場合でも、テンソルに変換すべきでないキーのリストまたはセット。

## Qwen2_5OmniForConditionalGeneration[[transformers.Qwen2_5OmniForConditionalGeneration]]

#### transformers.Qwen2_5OmniForConditionalGeneration[[transformers.Qwen2_5OmniForConditionalGeneration]]

```python
transformers.Qwen2_5OmniForConditionalGeneration(config: Qwen2_5OmniConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L3735)

**パラメータ:**

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

3つのサブモデルで構成されるマルチモーダルモデルである、Qwen2.5Omniのフルモデル:
- [Qwen2_5OmniThinkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniThinkerForConditionalGeneration)：
causal auto-regressive transformerは、テキスト、音声、画像、動画をインプットとして受け取り、テキストトークンを予測します。
- [Qwen2_5OmniTalkerForConditionalGeneration](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniTalkerForConditionalGeneration)：
因果的オートレグレッシブ・トランスフォーマーは、thinkerの隠れ状態と応答を入力として受け取り、音声トークンを予測します。
- [Qwen2_5OmniToken2WavModel](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniToken2WavModel)：
DiTモデルは音声トークンを入力として受け取り、メルスペクトログラムを予測し、BigVGANボコーダーはメルスペクトログラムを入力として受け取り、波形を予測します。

このモデルは [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.Qwen2_5OmniForConditionalGeneration.forward]]

```python
forward(*args, **kwargs)
```

ドット区切りパス（例: `torch.float32`）に対するモック値: 属性アクセスのチェーン、呼び出しはパススルーデコレータとして動作し、`repr` はドット区切りパスを返し、ベースクラスとして使用するとプレーンな `type` ベースに置き換えられます（PEP 560 の `__mro_entries__`）。これにより、実際のサブクラスは通常のメタクラスを保持し、`inspect.signature` はモックのものではなく実際の `__init__` を読み取ります。

## Qwen2_5OmniPreTrainedModelForConditionalGeneration[[transformers.Qwen2_5OmniPreTrainedModelForConditionalGeneration]]

#### transformers.Qwen2_5OmniPreTrainedModelForConditionalGeneration[[transformers.Qwen2_5OmniPreTrainedModelForConditionalGeneration]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L155)

#### get_chunked_index[[transformers.Qwen2_5OmniPreTrainedModelForConditionalGeneration.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/qwen2_5_omni/modeling_qwen2_5_omni.py#L178)

**パラメータ:**

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.Qwen2_5OmniPreTrainedModelForConditionalGeneration.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/qwen2_5_omni/modeling_qwen2_5_omni.py#L215)

**パラメータ:**

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を加えたものとして計算されます。

## Qwen2_5OmniThinkerConfig[[transformers.Qwen2_5OmniThinkerConfig]]

#### transformers.Qwen2_5OmniThinkerConfig[[transformers.Qwen2_5OmniThinkerConfig]]

```python
transformers.Qwen2_5OmniThinkerConfig(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, audio_token_index: int = 151646, image_token_index: int = 151655, video_token_index: int = 151656, position_id_per_seconds: int = 25, seconds_per_chunk: int = 2, audio_start_token_id: int = 151647, audio_end_token_id: int = 151648, user_token_id: int = 872, initializer_range: float = 0.02, tie_word_embeddings: bool = False)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L212)

**パラメータ:**

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

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

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

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

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

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

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

seconds_per_chunk (`int`、*optional*、デフォルトは 2) : 音声および動画データのチャンクの長さ（秒）。

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

audio_end_token_id (`int`, *optional*, デフォルトは 151648) : 音声プロンプトをエンコードするための音声終了トークンのインデックス。

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

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

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

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

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

例:

```python
>>> from transformers import Qwen2_5OmniThinkerForConditionalGeneration, Qwen2_5OmniThinkerConfig, Qwen2_5OmniAudioEncoderConfig, Qwen2_5OmniVisionEncoderConfig

>>> # Initializing a Qwen2_5OmniAudioEncoder config
>>> audio_config = Qwen2_5OmniAudioEncoderConfig()

>>> # Initializing a Qwen2_5OmniVisionEncoder config
>>> vision_config = Qwen2_5OmniVisionEncoderConfig()

>>> # Initializing a Qwen2_5OmniTextConfig config
>>> text_config = Qwen2_5OmniTextConfig()

>>> # Initializing a Qwen2.5OmniThinker configuration
>>> configuration = Qwen2_5OmniThinkerConfig(audio_config, vision_config, text_config)

>>> # Initializing a model from the Qwen-Omni style configuration
>>> model = Qwen2_5OmniThinkerForConditionalGeneration(configuration)

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

## Qwen2_5OmniThinkerModel[[transformers.Qwen2_5OmniThinkerModel]]

#### transformers.Qwen2_5OmniThinkerModel[[transformers.Qwen2_5OmniThinkerModel]]

```python
transformers.Qwen2_5OmniThinkerModel(config: Qwen2_5OmniThinkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1680)

**パラメータ:**

config ([Qwen2_5OmniThinkerConfig](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniThinkerConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連する重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[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.Qwen2_5OmniThinkerModel.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, input_features: typing.Optional[torch.FloatTensor] = None, pixel_values: typing.Optional[torch.FloatTensor] = None, pixel_values_videos: typing.Optional[torch.FloatTensor] = None, image_grid_thw: typing.Optional[torch.LongTensor] = None, video_grid_thw: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, feature_attention_mask: typing.Optional[torch.Tensor] = None, audio_feature_lengths: typing.Optional[torch.LongTensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, past_key_values: transformers.cache_utils.Cache | None = None, inputs_embeds: typing.Optional[torch.FloatTensor] = None, use_cache: bool | None = None, use_audio_in_video: bool | None = None, video_second_per_grid: typing.Optional[torch.LongTensor] = None, mm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1855)

**パラメータ:**

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)

input_features (`torch.FloatTensor`、shape `(batch_size, sequence_length, feature_dim)`、*任意*) : 入力音声特徴に対応するテンソルです。音声特徴は[WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)を使用して取得できます。詳細は[WhisperFeatureExtractor.__call__()](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor.__call__)を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor)は音声の処理に[WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)を使用します）。

pixel_values (`torch.FloatTensor`、形状 `(batch_size, num_channels, image_size, image_size)`、*任意*) : 入力画像に対応するテンソルです。ピクセル値は [Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor) を使用して取得できます。詳細は [Qwen2VLImageProcessor.__call__()](/docs/transformers/main/ja/model_doc/molmo2#transformers.Molmo2ImageProcessor.__call__) を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor) は画像の処理に [Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor) を使用します）。

pixel_values_videos (`torch.FloatTensor`、形状 `(batch_size, num_frames, num_channels, frame_size, frame_size)`、*任意*) : 入力動画に対応するテンソルです。動画のピクセル値は [Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor) を使用して取得できます。詳細は [Qwen2VLVideoProcessor.__call__()](/docs/transformers/main/ja/model_doc/molmo2#transformers.Molmo2VideoProcessor.__call__) を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor) は動画の処理に [Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor) を使用します）。

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

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

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

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

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)`、*任意*) であり、エンコーダーのマルチモーダル特徴量をテキスト埋め込みにマージしたシーケンスです。

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

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

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

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

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

  `past_key_values`が使用されている場合、出力されるのは、形状`(batch_size, 1, hidden_size)`のシーケンスの最後の隠れ状態のみです。
- **past_key_values** (`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` の場合、クロスカレンションブロック）の事前計算済みヒドゥンステート（キーとバリュー）を保持します。これらは逐次デコーディングを高速化するために使用できます（`past_key_values` 入力参照）。
- **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)` です。

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

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

## Qwen2_5OmniThinkerForConditionalGeneration[[transformers.Qwen2_5OmniThinkerForConditionalGeneration]]

#### transformers.Qwen2_5OmniThinkerForConditionalGeneration[[transformers.Qwen2_5OmniThinkerForConditionalGeneration]]

```python
transformers.Qwen2_5OmniThinkerForConditionalGeneration(config: Qwen2_5OmniThinkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1971)

#### forward[[transformers.Qwen2_5OmniThinkerForConditionalGeneration.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, input_features: typing.Optional[torch.FloatTensor] = None, pixel_values: typing.Optional[torch.FloatTensor] = None, pixel_values_videos: typing.Optional[torch.FloatTensor] = None, image_grid_thw: typing.Optional[torch.LongTensor] = None, video_grid_thw: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, feature_attention_mask: typing.Optional[torch.Tensor] = None, audio_feature_lengths: typing.Optional[torch.LongTensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, past_key_values: transformers.cache_utils.Cache | None = None, inputs_embeds: typing.Optional[torch.FloatTensor] = None, labels: typing.Optional[torch.LongTensor] = None, use_cache: bool | None = None, use_audio_in_video: bool | None = None, video_second_per_grid: typing.Optional[torch.LongTensor] = None, mm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L2029)

**パラメータ:**

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)

input_features (`torch.FloatTensor`、shape `(batch_size, sequence_length, feature_dim)`、*任意*) : 入力音声特徴に対応するテンソルです。音声特徴は[WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)を使用して取得できます。詳細は[WhisperFeatureExtractor.__call__()](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor.__call__)を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor)は音声の処理に[WhisperFeatureExtractor](/docs/transformers/main/ja/model_doc/whisper#transformers.WhisperFeatureExtractor)を使用します）。

pixel_values (`torch.FloatTensor`、形状 `(batch_size, num_channels, image_size, image_size)`、*任意*) : 入力画像に対応するテンソルです。ピクセル値は [Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor) を使用して取得できます。詳細は [Qwen2VLImageProcessor.__call__()](/docs/transformers/main/ja/model_doc/molmo2#transformers.Molmo2ImageProcessor.__call__) を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor) は画像の処理に [Qwen2VLImageProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor) を使用します）。

pixel_values_videos (`torch.FloatTensor`、形状 `(batch_size, num_frames, num_channels, frame_size, frame_size)`、*任意*) : 入力動画に対応するテンソルです。動画のピクセル値は [Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor) を使用して取得できます。詳細は [Qwen2VLVideoProcessor.__call__()](/docs/transformers/main/ja/model_doc/molmo2#transformers.Molmo2VideoProcessor.__call__) を参照してください（[Qwen2_5OmniProcessor](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniProcessor) は動画の処理に [Qwen2VLVideoProcessor](/docs/transformers/main/ja/model_doc/qwen2_vl#transformers.Qwen2VLVideoProcessor) を使用します）。

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

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

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

labels (`torch.LongTensor`、形状 `(batch_size, sequence_length)`、*任意*) : マスク言語モデリング損失を計算するためのラベル。インデックスは `[0, ..., config.vocab_size]` の範囲内であるか、-100 である必要があります（`input_ids` のドキュメント文字列を参照）。インデックスが `-100` に設定されたトークンは無視（マスク）され、損失は `[0, ..., config.vocab_size]` の範囲内のラベルを持つトークンに対してのみ計算されます。

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

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)`、*任意*) であり、エンコーダーのマルチモーダル特徴量をテキスト埋め込みにマージしたシーケンスです。

**戻り値:** `Qwen2_5OmniThinkerCausalLMOutputWithPast` または `tuple(torch.FloatTensor)`

`Qwen2_5OmniThinkerCausalLMOutputWithPast`、または`torch.FloatTensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。構成要素は、設定（[Qwen2_5OmniConfig](/docs/transformers/main/ja/model_doc/qwen2_5_omni#transformers.Qwen2_5OmniConfig)）と入力に応じて異なります。

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

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

- **loss** (`torch.FloatTensor`、shape `(1,)`、*optional*、`labels` が指定された場合に返されます) -- 言語モデリングの損失(次のトークンの予測用)。
- **logits** (`torch.FloatTensor`、shape `(batch_size, sequence_length, config.vocab_size)`) -- 言語モデリングヘッドの予測スコア（SoftMax 適用前の各語彙トークンのスコア）。
- **past_key_values** (`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)を参照してください。

  逐次デコーディングを高速化するために使用できる（`past_key_values` 入力参照）、事前計算済みの隠れ状態（自己注意ブロックのキーとバリュー）が含まれます。
- **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)` です。

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

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **rope_deltas** (`torch.LongTensor`、形状 `(batch_size, )`、*任意*) -- シーケンス長とマルチモーダル rope の間の rope インデックスの差です。この属性は非推奨であり、v5.20 で削除される予定です。代わりに `model.base_model.rope_deltas` を使用してください。

例:

```python
>>> from transformers import Qwen2_5OmniProcessor, Qwen2_5OmniThinkerForConditionalGeneration

>>> thinker = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B")
>>> processor = Qwen2_5OmniProcessor.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.Qwen2_5OmniThinkerForConditionalGeneration.get_audio_features]]

```python
get_audio_features(input_features: FloatTensor, 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/qwen2_5_omni/modeling_qwen2_5_omni.py#L2011)

**パラメータ:**

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

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.FloatTensor)`

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

- **last_hidden_state** (`torch.FloatTensor`、shape `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.FloatTensor`、shape `(batch_size, hidden_size)`) -- 補助事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT 系のモデルでは、線形層と tanh 活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次文予測（分類）目的から学習されます。
- **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)` です。

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

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

例:

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

>>> model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

>>> 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.Qwen2_5OmniThinkerForConditionalGeneration.get_image_features]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1998)

**パラメータ:**

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

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

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

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

- **last_hidden_state** (`torch.FloatTensor`、shape `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.FloatTensor`、shape `(batch_size, hidden_size)`) -- 補助事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT 系のモデルでは、線形層と tanh 活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次文予測（分類）目的から学習されます。
- **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)` です。

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

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

例:

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

>>> model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

>>> 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.Qwen2_5OmniThinkerForConditionalGeneration.get_video_features]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1985)

**パラメータ:**

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

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

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

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

- **last_hidden_state** (`torch.FloatTensor`、shape `(batch_size, sequence_length, hidden_size)`) -- モデルの最終層の出力における隠れ状態のシーケンス。
- **pooler_output** (`torch.FloatTensor`、shape `(batch_size, hidden_size)`) -- 補助事前学習タスクに使用される層をさらに通して処理された後、シーケンスの最初のトークン（分類トークン）の最終層の隠れ状態です。例えば、BERT 系のモデルでは、線形層と tanh 活性化関数を経て処理された後の分類トークンを返します。この線形層の重みは、事前学習中の次文予測（分類）目的から学習されます。
- **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)` です。

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

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

例:

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

>>> model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-Omni-7B")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")

>>> 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]
```

## Qwen2_5OmniThinkerTextModel[[transformers.Qwen2_5OmniThinkerTextModel]]

#### transformers.Qwen2_5OmniThinkerTextModel[[transformers.Qwen2_5OmniThinkerTextModel]]

```python
transformers.Qwen2_5OmniThinkerTextModel(config: Qwen2_5OmniTextConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1560)

**パラメータ:**

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

Qwen2 5 Omni Text Modelの生モデルで、特定のヘッドを上に載せず、生の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.Qwen2_5OmniThinkerTextModel.forward]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L1587)

**パラメータ:**

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)

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

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

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

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

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

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

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

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

  `past_key_values`が使用されている場合、出力されるのは、形状`(batch_size, 1, hidden_size)`のシーケンスの最後の隠れ状態のみです。
- **past_key_values** (`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` の場合、クロスカレンションブロック）の事前計算済みヒドゥンステート（キーとバリュー）を保持します。これらは逐次デコーディングを高速化するために使用できます（`past_key_values` 入力参照）。
- **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)` です。

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

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

## Qwen2_5OmniTalkerConfig[[transformers.Qwen2_5OmniTalkerConfig]]

#### transformers.Qwen2_5OmniTalkerConfig[[transformers.Qwen2_5OmniTalkerConfig]]

```python
transformers.Qwen2_5OmniTalkerConfig(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_token_index: int = 151646, image_token_index: int = 151655, video_token_index: int = 151656, vocab_size: int = 8448, tts_text_start_token_id: int = 151860, tts_text_end_token_id: int = 151861, tts_text_pad_token_id: int = 151859, tts_codec_start_token_id: int = 8293, tts_codec_end_token_id: int = 8294, tts_codec_pad_token_id: int = 8292, tts_codec_mask_token_id: int = 8296, vision_start_token_id: int = 151652, vision_end_token_id: int = 151653, embedding_size: int = 3584, hidden_size: int = 3584, 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, rms_norm_eps: float = 1e-06, head_dim: int = 128, use_cache: bool = True, tie_word_embeddings: bool = False, use_sliding_window: bool = False, sliding_window: int | None = 32768, max_window_layers: int = 28, attention_dropout: float | int = 0.0, rope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = None, position_id_per_seconds: int = 25, seconds_per_chunk: int = 2, audio_start_token_id: int = 151647, audio_end_token_id: int = 151648, initializer_range: float = 0.02, spatial_merge_size: int = 2, layer_types: list[str] | None = None, pad_token_id: int | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L278)

**パラメータ:**

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

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

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

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

tts_text_start_token_id (`int`, *optional*, デフォルトは 151860) : tts テキストの開始をエンコードするための tts テキスト開始トークンのインデックス。

tts_text_end_token_id (`int`, *optional*, デフォルトは 151861) : tts テキストの終わりをエンコードするための tts テキスト終了トークンインデックス。

tts_text_pad_token_id (`int`, *optional*, デフォルトは 151859) : tts テキストの pad をエンコードするための tts テキストの pad トークンインデックスです。

tts_codec_start_token_id (`int`, *optional*, デフォルトは 8293) : tts コーデックの開始をエンコードするための tts コーデック開始トークンインデックスです。

tts_codec_end_token_id (`int`, *optional*, デフォルトは 8294) : tts コーデックの終了をエンコードするための tts コーデックの終了トークンインデックスです。

tts_codec_pad_token_id (`int`, *optional*, デフォルトは 8292) : tts コーデックの pad をエンコードするための tts コーデックの pad トークンインデックスです。

tts_codec_mask_token_id (`int`, *optional*, デフォルトは 8296) : tts codec のマスクをエンコードするための tts codec マスクトークンインデックスです。

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

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

embedding_size (`int`、*任意*、デフォルトは`3584`) : 埋め込みおよび隠れ状態の次元数。

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

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`) : このモデルが使用される可能性のある最大シーケンス長です。

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

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

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

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

use_sliding_window (`bool`、*任意*、デフォルトは`False`) : スライディングウィンドウアテンションを使用するかどうか。

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

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

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

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

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

seconds_per_chunk (`int`、*optional*、デフォルトは 2) : 音声および動画データのチャンクの長さ（秒）。

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

audio_end_token_id (`int`, *optional*, デフォルトは 151648) : 音声プロンプトをエンコードするための音声終了トークンのインデックス。

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

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

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

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

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

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

例:

```python
>>> from transformers import Qwen2_5OmniTalkerForConditionalGeneration, Qwen2_5OmniThinkerConfig, Qwen2_5OmniAudioEncoderConfig, Qwen2_5OmniVisionEncoderConfig

>>> # Initializing a Qwen2_5OmniAudioEncoder config
>>> audio_config = Qwen2_5OmniAudioEncoderConfig()

>>> # Initializing a Qwen2 config
>>> text_config = Qwen2Config()

>>> # Initializing a Qwen2_5Omni configuration
>>> configuration = Qwen2_5OmniThinkerConfig(audio_config, text_config)

>>> # Initializing a model from the qwen2-audio style configuration
>>> model = Qwen2_5OmniTalkerForConditionalGeneration(configuration)

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

## Qwen2_5OmniTalkerForConditionalGeneration[[transformers.Qwen2_5OmniTalkerForConditionalGeneration]]

#### transformers.Qwen2_5OmniTalkerForConditionalGeneration[[transformers.Qwen2_5OmniTalkerForConditionalGeneration]]

```python
transformers.Qwen2_5OmniTalkerForConditionalGeneration(config: Qwen2_5OmniTalkerConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L2317)

#### forward[[transformers.Qwen2_5OmniTalkerForConditionalGeneration.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, position_ids: typing.Optional[torch.LongTensor] = None, past_key_values: transformers.cache_utils.Cache | None = None, thinker_reply_part: typing.Optional[torch.FloatTensor] = None, inputs_embeds: typing.Optional[torch.FloatTensor] = None, use_cache: bool | None = None, input_text_ids: typing.Optional[torch.LongTensor] = None, image_grid_thw: typing.Optional[torch.LongTensor] = None, video_grid_thw: typing.Optional[torch.LongTensor] = None, use_audio_in_video: bool | None = None, audio_feature_lengths: typing.Optional[torch.LongTensor] = None, video_second_per_grid: typing.Optional[torch.LongTensor] = None, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L2351)

**パラメータ:**

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)

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

thinker_reply_part (`torch.FloatTensor`、形状 `(batch_size, sequence_length, hidden_size)`、*任意*) : 処理対象となるテキスト返信部分を表す、thinker モデルの出力からの隠れ状態。

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

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

input_text_ids (`torch.LongTensor`、形状 `(batch_size, sequence_length)`、*任意*) : テキストのみを含むコンテンツのインプットトークンID。マルチモーダル環境での位置計算に使用されます。

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

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

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

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

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

**戻り値:** `Qwen2_5OmniTalkerCausalLMOutputWithPast` または `tuple(torch.FloatTensor)`

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

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

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

- **loss** (`torch.FloatTensor`、shape `(1,)`、*optional*、`labels` が指定された場合に返されます) -- 言語モデリングの損失(次のトークンの予測用)。
- **logits** (`torch.FloatTensor`、shape `(batch_size, sequence_length, config.vocab_size)`) -- 言語モデリングヘッドの予測スコア（SoftMax 適用前の各語彙トークンのスコア）。
- **past_key_values** (`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)を参照してください。

  逐次デコーディングを高速化するために使用できる（`past_key_values` 入力参照）、事前計算済みの隠れ状態（自己注意ブロックのキーとバリュー）が含まれます。
- **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)` です。

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

  アテンションのsoftmax後のアテンション重み。自己アテンションヘッド内で加重平均を計算するために使用されます。
- **rope_deltas** (`torch.LongTensor`、形状 `(batch_size, )`、*任意*) -- シーケンス長とマルチモーダル rope の間の rope インデックスの差です。この属性は非推奨であり、v5.20 で削除される予定です。代わりに `model.base_model.rope_deltas` を使用してください。
- **thinker_reply_part** (`torch.FloatTensor`、shape `(batch_size, sequence_length, hidden_size)`) -- thinkerモデルからの隠れ状態。talkerモデルの入力として使用されます。これは、talkerモデルが音声トークンを生成するために使用するエンコードされた応答を表します。

例:

```python
>>> from io import BytesIO
>>> from urllib.request import urlopen
>>> import librosa
>>> from transformers import AutoProcessor, Qwen2_5OmniTalkerForConditionalGeneration

>>> model = Qwen2_5OmniTalkerForConditionalGeneration.from_pretrained("Qwen/Qwen2-Audio-7B")
>>> processor = AutoProcessor.from_pretrained("Qwen/Qwen2-Audio-7B")

>>> prompt = "<|audio_bos|><|AUDIO|><|audio_eos|>Generate the caption in English:"
>>> url = "https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/audio/glass_breaking.mp3"
>>> audio, _ = librosa.load(BytesIO(urlopen(url).read()), sr=self.processor.feature_extractor.sampling_rate)

>>> inputs = processor(text=prompt, audio=audio, return_tensors="pt")

>>> # Generate
>>> generate_ids = model.generate(**inputs, max_length=30)
>>> processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
"Generate the caption in English: Glass is breaking."
```

## Qwen2_5OmniTalkerModel[[transformers.Qwen2_5OmniTalkerModel]]

#### transformers.Qwen2_5OmniTalkerModel[[transformers.Qwen2_5OmniTalkerModel]]

```python
transformers.Qwen2_5OmniTalkerModel(config: Qwen2_5OmniTalkerConfig)
```

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

**パラメータ:**

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

Qwen2 5 Omniの素のモデルは、上部に特定のヘッドを付加せずに生の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.Qwen2_5OmniTalkerModel.forward]]

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

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L2229)

**パラメータ:**

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)

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

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

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

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

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

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

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

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

  `past_key_values`が使用されている場合、出力されるのは、形状`(batch_size, 1, hidden_size)`のシーケンスの最後の隠れ状態のみです。
- **past_key_values** (`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` の場合、クロスカレンションブロック）の事前計算済みヒドゥンステート（キーとバリュー）を保持します。これらは逐次デコーディングを高速化するために使用できます（`past_key_values` 入力参照）。
- **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)` です。

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

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

## Qwen2_5OmniToken2WavConfig[[transformers.Qwen2_5OmniToken2WavConfig]]

#### transformers.Qwen2_5OmniToken2WavConfig[[transformers.Qwen2_5OmniToken2WavConfig]]

```python
transformers.Qwen2_5OmniToken2WavConfig(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, dit_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, bigvgan_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py#L484)

**パラメータ:**

dit_config (`DiT_Args`, *任意*) : メルスペクトログラムの生成を担当する Diffusion Transformer (DiT) モジュールの設定クラスです。

bigvgan_config (`BigVGAN_Args`, *任意*) : メルスペクトログラムを波形に変換する BigVGAN モジュール用の設定クラス。

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

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

例:

```python
>>> from transformers import Qwen2_5OmniToken2WavModel, DiT_Args, BigVGAN_Args

>>> # Initialize DiT configuration
>>> dit_config = DiT_Args(
...     dim=1024,
...     depth=22,
...     heads=16,
...     ff_mult=2
... )

>>> # Initialize BigVGAN configuration
>>> bigvgan_config = BigVGAN_Args(
...     mel_dim=80,
...     upsample_rates=[5,3,2,2,2,2]
... )

>>> # Initialize main configuration
>>> config = Qwen2_5OmniToken2WavConfig(dit_config, bigvgan_config)

>>> # Initialize model with config
>>> model = Qwen2_5OmniToken2Wav(config)

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

## Qwen2_5OmniToken2WavModel[[transformers.Qwen2_5OmniToken2WavModel]]

#### transformers.Qwen2_5OmniToken2WavModel[[transformers.Qwen2_5OmniToken2WavModel]]

```python
transformers.Qwen2_5OmniToken2WavModel(config: Qwen2_5OmniToken2WavConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L3664)

**パラメータ:**

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

完全な Qwen2.5Omni Token2Wav モデルです。音声トークンを入力として受け取り、メルスペクトログラムを予測する DiT モデルと、メルスペクトログラムを入力として受け取り、波形を予測する BigVGAN ボコーダーで構成されています。

このモデルは [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.Qwen2_5OmniToken2WavModel.forward]]

```python
forward(code, conditioning, reference_mel, num_steps = 10, guidance_scale = 0.5, sway_coefficient = -1.0, **kwargs)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L3693)

入力コードと条件付けパラメータから波形を生成します。

## Qwen2_5OmniToken2WavDiTModel[[transformers.Qwen2_5OmniToken2WavDiTModel]]

#### transformers.Qwen2_5OmniToken2WavDiTModel[[transformers.Qwen2_5OmniToken2WavDiTModel]]

```python
transformers.Qwen2_5OmniToken2WavDiTModel(config: Qwen2_5OmniDiTConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L3493)

**パラメータ:**

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

Qwen2.5Omni Token2WavDiT の完全なモデルです。音声トークンを入力として受け取り、メロスペクトログラムを予測します。

このモデルは [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のドキュメントを参照してください。

## Qwen2_5OmniToken2WavBigVGANModel[[transformers.Qwen2_5OmniToken2WavBigVGANModel]]

#### transformers.Qwen2_5OmniToken2WavBigVGANModel[[transformers.Qwen2_5OmniToken2WavBigVGANModel]]

```python
transformers.Qwen2_5OmniToken2WavBigVGANModel(config: Qwen2_5OmniBigVGANConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py#L3355)

**パラメータ:**

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

完全なQwen2.5Omni Token2WavBigVGANモデルです。メロスペクトログラムを入力として受け取り、波形を予測します。

このモデルは [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のドキュメントを参照してください。

