# Nemotron 3.5 Transcribe

## 개요

Nemotron 3.5 Transcribe는 다국어 전사, 화자 귀속 전사, 음성 번역, 오디오 질의응답을 위한 오디오 언어 모델입니다. 음성 인식 인코더와 [Nemotron 3 Diarization](./nemotron3_diarization) 모델은 동일한 스펙트로그램을 읽으며, 이들의 출력은 [Nemotron-H](./nemotron_h) 언어 모델로 투영됩니다. 인코더 출력에 있는 단어 타임스탬프 헤드는 단어 수준의 시간을 출력합니다.

## 사용

### 전사

```python
from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = "nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B"
samples = "https://huggingface.co/datasets/hf-internal-testing/dummy-audio-samples/resolve/main/"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id, device_map="auto")

inputs = processor.apply_transcription_request(samples + "en-Alice_woman.wav").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(outputs[:, inputs.input_ids.shape[1] :], skip_special_tokens=True))
```

### 배치된 전사

```python
from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = "nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B"
samples = "https://huggingface.co/datasets/hf-internal-testing/dummy-audio-samples/resolve/main/"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id, device_map="auto")

audio = [samples + "en-Alice_woman.wav", samples + "diarization_example.mp3"]
speaker_attributed_prompt = (
    "Transcribe this audio with punctuation and capitalization. Include all spoken words and verbal fillers. Write "
    "numbers in their standard written form. Put speaker tags <spk:0> <spk:1> <spk:2> <spk:3> on the transcription."
)
prompt = [None, speaker_attributed_prompt]

inputs = processor.apply_transcription_request(audio, prompt=prompt).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
texts = processor.decode(outputs[:, inputs.input_ids.shape[1] :], skip_special_tokens=False)
print([text.replace(processor.tokenizer.pad_token, "") for text in texts])
```

### 화자별 전사

```python
from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = "nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B"
samples = "https://huggingface.co/datasets/hf-internal-testing/dummy-audio-samples/resolve/main/"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id, device_map="auto")

prompt = (
    "Transcribe this audio with punctuation and capitalization. Include all spoken words and verbal fillers. Write "
    "numbers in their standard written form. Put speaker tags <spk:0> <spk:1> <spk:2> <spk:3> on the transcription."
)
conversation = [
    {
        "role": "user",
        "content": [
            {"type": "text", "text": prompt},
            {"type": "audio", "path": samples + "diarization_example.mp3"},
        ],
    }
]

inputs = processor.apply_chat_template(
    conversation,
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    enable_thinking=False,
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
text = processor.decode(outputs[0, inputs.input_ids.shape[1] :], skip_special_tokens=False)
print(text)
```

[extract_speaker_dict()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeProcessor.extract_speaker_dict)는 출력을 화자 턴별로 하나의 딕셔너리로 분리합니다:

```python
for turn in processor.extract_speaker_dict(text):
    print(turn)
```

```text
{'Speaker': 0, 'Content': "To celebrate the release of Nematron three Dierization, we invited ... from NVIDIA."}
{'Speaker': 1, 'Content': "Hi everybody, thanks for having me. I'm Jane, a pocket voice from QTie."}
{'Speaker': 2, 'Content': "Nice to meet you Chris and Jane. I'm Serena, the Queen three Voice."}
...
```

### 단어 타임스탬프

`torchaudio`와 `scipy`가 필요합니다.

```python
from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = "nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B"
samples = "https://huggingface.co/datasets/hf-internal-testing/dummy-audio-samples/resolve/main/"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id, device_map="auto")

prompt = (
    "Transcribe this audio with punctuation and capitalization. Include all spoken words and verbal fillers. Write "
    "numbers in their standard written form. Put speaker tags <spk:0> <spk:1> <spk:2> <spk:3> on the transcription."
)

inputs = processor.apply_transcription_request(samples + "diarization_example.mp3", prompt=prompt).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, return_word_timestamp_logits=True)
texts = processor.decode(outputs.sequences[:, inputs.input_ids.shape[1] :], skip_special_tokens=False)
timestamps = processor.align_word_timestamps(
    texts,
    outputs.word_timestamp_logits,
    inputs.input_features_mask,
    outputs.speaker_logits,
)
print(timestamps[0]["chunks"][:3])
```

생성되지 않은 전사본을 정렬하려면:

```python
input_features_mask = inputs.input_features_mask
audio_outputs = model.get_audio_features(inputs.input_features, input_features_mask)
word_timestamp_logits = model.get_word_timestamp_logits(audio_outputs.asr_last_hidden_state, input_features_mask)
timestamps = processor.align_word_timestamps(
    ["<spk:0> To celebrate the ..."],
    word_timestamp_logits,
    input_features_mask,
    audio_outputs.speaker_logits,
)
```

## Nemotron3_5TranscribeConfig[[transformers.Nemotron3_5TranscribeConfig]]

#### transformers.Nemotron3_5TranscribeConfig[[transformers.Nemotron3_5TranscribeConfig]]

```python
transformers.Nemotron3_5TranscribeConfig(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, text_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, audio_token_id: int = 131072, word_timestamp_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/configuration_nemotron3_5_transcribe.py#L223)

**매개변수:**

audio_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *선택*) : 오디오 백본의 config 객체 또는 사전입니다.

text_config (`Union[dict, ~configuration_utils.PreTrainedConfig]`, *선택*) : 텍스트 백본의 config 객체 또는 사전입니다.

audio_token_id (`int`, *선택 사항*, 기본값 131072) : 오디오 임베딩의 플레이스홀더로 사용되는 오디오 토큰 인덱스입니다. 원래 체크포인트에서는 언어 모델의 어휘 뒤에 이 토큰을 추가하지만 임베딩 행은 없습니다: 토큰 0으로 임베딩된 후 오디오로 대체됩니다.

word_timestamp_config (`Union[dict, Nemotron3_5TranscribeWordTimestampConfig]`, *선택*) : 음성 인식 인코더 상태로부터 정렬 토크나이저 조각을 예측하는 워드 타임스탬프 인코더 및 헤드 구성입니다.

이것은 Nemotron3 5 TranscribeModel의 구성을 저장하기 위한 구성 클래스입니다. 지정된 인자에 따라 Nemotron3 5 Transcribe 모델을 초기화하고 모델 아키텍처를 정의하는 데 사용됩니다. 기본값으로 구성을 초기화하면 [nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B)와 유사한 구성이 생성됩니다.

Configuration 객체는 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)를 상속하며, 모델 출력을 제어하는 데 사용할 수 있습니다. 자세한 내용은 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)의 문서를 참고하세요.

예:

```python
>>> from transformers import Nemotron3_5TranscribeForConditionalGeneration, Nemotron3_5TranscribeConfig

>>> # Initializing a Nemotron3_5Transcribe configuration
>>> configuration = Nemotron3_5TranscribeConfig()

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

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

## Nemotron3_5TranscribeAsrAudioConfig[[transformers.Nemotron3_5TranscribeAsrAudioConfig]]

#### transformers.Nemotron3_5TranscribeAsrAudioConfig[[transformers.Nemotron3_5TranscribeAsrAudioConfig]]

```python
transformers.Nemotron3_5TranscribeAsrAudioConfig(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 = 1280, intermediate_size: int = 5120, num_hidden_layers: int = 32, num_attention_heads: int = 10, num_key_value_heads: int | None = None, hidden_act: str = 'gelu', max_position_embeddings: int = 5000, initializer_range: float = 0.02, rope_parameters: dict | None = None, attention_dropout: float | int = 0.0, num_mel_bins: int = 128, subsampling_factor: int = 8)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/configuration_nemotron3_5_transcribe.py#L31)

**매개변수:**

hidden_size (`int`, *선택 사항*, 기본값 `1280`) : 숨겨진 표현의 차원.

intermediate_size (`int`, *선택 사항*, 기본값 `5120`) : MLP 표현의 차원.

num_hidden_layers (`int`, *선택 사항*, 기본값 `32`) : Transformer decoder의 숨겨진 레이어 수.

num_attention_heads (`int`, *선택 사항*, 기본값 `10`) : Transformer 디코더의 각 어텐션 레이어에 사용할 어텐션 헤드 수입니다.

num_key_value_heads (`int`, *선택 사항*) : 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 헤드는 해당 그룹 내 모든 원래 헤드를 meanpooling하여 구성해야 합니다. 자세한 내용은 [이 논문](https://huggingface.co/papers/2305.13245)을 참고하세요. 지정되지 않으면 기본값으로 `num_attention_heads`가 사용됩니다.

hidden_act (`str`, *선택 사항*, 기본값 `gelu`) : 디코더에서 사용되는 비선형 활성화 함수(함수 또는 문자열). 예를 들어, `"gelu"`, `"relu"`, `"silu"` 등이 있습니다.

max_position_embeddings (`int`, *선택 사항*, 기본값 `5000`) : 이 모델이 사용될 수 있는 최대 시퀀스 길이입니다.

initializer_range (`float`, *선택 사항*, 기본값 `0.02`) : 모든 가중치 행렬을 초기화하는 truncated_normal_initializer의 표준 편차입니다.

rope_parameters (`dict`, *선택*) : RoPE 임베딩의 구성 매개변수를 포함하는 사전입니다. 사전에는 `rope_theta` 값이 포함되어야 하며, 더 긴 `max_position_embeddings`로 RoPE를 사용하려는 경우 스케일링에 사용되는 매개변수를 선택적으로 포함할 수 있습니다.

attention_dropout (`Union[float, int]`, *선택 사항*, 기본값 `0.0`) : attention 확률에 적용할 dropout 비율입니다.

num_mel_bins (`int`, *선택 사항*, 기본값 `128`) : 입력 프레임당 사용되는 mel 특징의 수입니다. `AutoFeatureExtractor` 클래스에서 사용된 값과 일치해야 합니다.

subsampling_factor (`int`, *선택 사항*, 기본값 8) : 하나의 인코더 프레임으로 스택되는 연속 스펙트로그램 프레임 수.

이것은 Nemotron3 5 TranscribeModel의 구성을 저장하기 위한 구성 클래스입니다. 지정된 인자에 따라 Nemotron3 5 Transcribe 모델을 초기화하고 모델 아키텍처를 정의하는 데 사용됩니다. 기본값으로 구성을 초기화하면 [nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B)와 유사한 구성이 생성됩니다.

Configuration 객체는 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)를 상속하며, 모델 출력을 제어하는 데 사용할 수 있습니다. 자세한 내용은 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)의 문서를 참고하세요.

예:

```python
>>> from transformers import Nemotron3_5TranscribeAsrAudioModel, Nemotron3_5TranscribeAsrAudioConfig

>>> # Initializing a Nemotron3_5TranscribeAsrAudioModel configuration
>>> configuration = Nemotron3_5TranscribeAsrAudioConfig()

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

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

## Nemotron3_5TranscribeAudioConfig[[transformers.Nemotron3_5TranscribeAudioConfig]]

#### transformers.Nemotron3_5TranscribeAudioConfig[[transformers.Nemotron3_5TranscribeAudioConfig]]

```python
transformers.Nemotron3_5TranscribeAudioConfig(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, asr_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, diarization_config: dict | transformers.configuration_utils.PreTrainedConfig | None = None, speaker_activity_threshold: float = 0.5)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/configuration_nemotron3_5_transcribe.py#L152)

**매개변수:**

asr_config (`Union[dict, Nemotron3_5TranscribeAsrAudioConfig]`, *선택*) : 음성 인식 인코더의 설정입니다.

diarization_config (`Union[dict, Nemotron3DiarizationConfig]`, *선택 사항*) : 화자 분리 모델의 설정입니다. 이 모델의 화자 활동이 음성 인식 인코더 출력에 추가됩니다.

speaker_activity_threshold (`float`, *선택 사항*, 기본값 0.5) : 화자의 확률이 이 임계값보다 높을 때 인코더 프레임에서 해당 화자가 활성 상태입니다.

이것은 Nemotron3 5 TranscribeModel의 구성을 저장하기 위한 구성 클래스입니다. 지정된 인자에 따라 Nemotron3 5 Transcribe 모델을 초기화하고 모델 아키텍처를 정의하는 데 사용됩니다. 기본값으로 구성을 초기화하면 [nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B)와 유사한 구성이 생성됩니다.

Configuration 객체는 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)를 상속하며, 모델 출력을 제어하는 데 사용할 수 있습니다. 자세한 내용은 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)의 문서를 참고하세요.

예:

```python
>>> from transformers import Nemotron3_5TranscribeAudioModel, Nemotron3_5TranscribeAudioConfig

>>> # Initializing a Nemotron3_5TranscribeAudioModel configuration
>>> configuration = Nemotron3_5TranscribeAudioConfig()

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

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

## Nemotron3_5TranscribeWordTimestampConfig[[transformers.Nemotron3_5TranscribeWordTimestampConfig]]

#### transformers.Nemotron3_5TranscribeWordTimestampConfig[[transformers.Nemotron3_5TranscribeWordTimestampConfig]]

```python
transformers.Nemotron3_5TranscribeWordTimestampConfig(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 = 1280, intermediate_size: int = 640, num_hidden_layers: int = 2, num_attention_heads: int = 16, num_key_value_heads: int | None = None, hidden_act: str = 'gelu', max_position_embeddings: int = 5000, initializer_range: float = 0.02, rope_parameters: dict | None = None, attention_dropout: float | int = 0.0, vocab_size: int = 23863, blank_token_id: int = 23862, residual_scale: float = 0.1, upsampling_factor: int = 2)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/configuration_nemotron3_5_transcribe.py#L88)

**매개변수:**

hidden_size (`int`, *선택 사항*, 기본값 `1280`) : 숨겨진 표현의 차원.

intermediate_size (`int`, *선택 사항*, 기본값 `640`) : MLP 표현의 차원.

num_hidden_layers (`int`, *선택 사항*, 기본값 `2`) : Transformer 디코더의 숨겨진 레이어 수.

num_attention_heads (`int`, *선택 사항*, 기본값 `16`) : Transformer decoder의 각 attention layer에 사용할 attention head의 수입니다.

num_key_value_heads (`int`, *선택 사항*) : 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 헤드는 해당 그룹 내 모든 원래 헤드를 meanpooling하여 구성해야 합니다. 자세한 내용은 [이 논문](https://huggingface.co/papers/2305.13245)을 참고하세요. 지정되지 않으면 기본값으로 `num_attention_heads`가 사용됩니다.

hidden_act (`str`, *선택 사항*, 기본값 `gelu`) : 디코더에서 사용되는 비선형 활성화 함수(함수 또는 문자열). 예를 들어, `"gelu"`, `"relu"`, `"silu"` 등이 있습니다.

max_position_embeddings (`int`, *선택 사항*, 기본값 `5000`) : 이 모델이 사용될 수 있는 최대 시퀀스 길이입니다.

initializer_range (`float`, *선택 사항*, 기본값 `0.02`) : 모든 가중치 행렬을 초기화하는 truncated_normal_initializer의 표준 편차입니다.

rope_parameters (`dict`, *선택*) : RoPE 임베딩의 구성 매개변수를 포함하는 사전입니다. 사전에는 `rope_theta` 값이 포함되어야 하며, 더 긴 `max_position_embeddings`로 RoPE를 사용하려는 경우 스케일링에 사용되는 매개변수를 선택적으로 포함할 수 있습니다.

attention_dropout (`Union[float, int]`, *선택 사항*, 기본값 `0.0`) : attention 확률에 적용할 dropout 비율입니다.

vocab_size (`int`, *선택 사항*, 기본값 23863) : 워드 타임스탬프 헤드의 클래스 수: 정렬 토크나이저의 조각, 그리고 blank.

blank_token_id (`int`, *선택 사항*, 기본값 23862) : 정렬 토크나이저의 조각들 이후의 빈 클래스 인덱스입니다.

residual_scale (`float`, *선택 사항*, 기본값 0.1) : 분류기에 전달되기 전에 음성 인식 인코더 상태에 추가되는 transformer 출력의 스케일입니다.

upsampling_factor (`int`, *선택 사항*, 기본값 2) : Transformer 이전의 전치 합성곱(transposed convolution)을 통해 생성되는 인코더 프레임당 헤드 프레임 수입니다. 2를 사용하면 80ms 인코더 프레임에서 40ms 프레임이 생성됩니다.

이것은 Nemotron3 5 TranscribeModel의 구성을 저장하기 위한 구성 클래스입니다. 지정된 인자에 따라 Nemotron3 5 Transcribe 모델을 초기화하고 모델 아키텍처를 정의하는 데 사용됩니다. 기본값으로 구성을 초기화하면 [nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B)와 유사한 구성이 생성됩니다.

Configuration 객체는 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)를 상속하며, 모델 출력을 제어하는 데 사용할 수 있습니다. 자세한 내용은 [PreTrainedConfig](/docs/transformers/v5.23.0/ko/main_classes/configuration#transformers.PreTrainedConfig)의 문서를 참고하세요.

예:

```python
>>> from transformers import Nemotron3_5TranscribeConfig, Nemotron3_5TranscribeWordTimestampConfig

>>> # Initializing a Nemotron3_5TranscribeWordTimestamp configuration
>>> configuration = Nemotron3_5TranscribeWordTimestampConfig()

>>> # Using it as the word timestamp head of the model
>>> model_configuration = Nemotron3_5TranscribeConfig(word_timestamp_config=configuration)
```

## Nemotron3_5TranscribeProcessor[[transformers.Nemotron3_5TranscribeProcessor]]

#### transformers.Nemotron3_5TranscribeProcessor[[transformers.Nemotron3_5TranscribeProcessor]]

```python
transformers.Nemotron3_5TranscribeProcessor(feature_extractor, tokenizer, alignment_tokenizer, chat_template = None, audio_token = '<|audio|>', default_transcription_prompt = 'Audio transcription. Language: as spoken. Wording: verbatim, including fillers and repetitions. Formatting: punctuation and capitalization. Output: transcript only.', subsampling_factor = 8)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/processing_nemotron3_5_transcribe.py#L230)

**매개변수:**

feature_extractor (`feature_extractor_class`) : feature extractor는 필수 입력입니다.

tokenizer (`tokenizer_class`) : 토크나이저는 필수 입력값입니다.

alignment_tokenizer (`PreTrainedTokenizerFast`) : 워드 타임스탬프 헤드의 어휘: 23,862개의 SentencePiece BPE 조각, 헤드의 클래스 23,862는 CTC blank입니다. [align_word_timestamps()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeProcessor.align_word_timestamps)에서만 사용되며 `alignment_tokenizer/` 하위 폴더에 저장됩니다. 태그로 시작하는 텍스트를 포함한 모든 텍스트의 원래 SentencePiece id를 재현하려면 앞에 공백을 추가하세요: `alignment_tokenizer.encode(" " + text, add_special_tokens=False)`.

chat_template (`str`) : 채팅의 메시지 목록을 토큰화 가능한 문자열로 변환하는 Jinja 템플릿입니다.

audio_token (`str`, *선택 사항*, 기본값 `"<|audio|>"`) : 채팅 템플릿에서 오디오 입력을 나타내는 데 사용되는 특수 토큰입니다.

default_transcription_prompt (`str`, *선택 사항*) : [apply_transcription_request()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeProcessor.apply_transcription_request)에서 기본적으로 사용되는 프롬프트입니다.

subsampling_factor (`int`, *선택 사항*, 기본값 8) : 오디오 토큰당 스펙트로그램 프레임 수로, `Nemotron3_5TranscribeAsrAudioConfig.subsampling_factor`를 따릅니다. 스펙트로그램은 이 값의 배수로 패딩됩니다.

Nemotron3_5TranscribeProcessor를 생성하며, feature extractor, tokenizer, alignment tokenizer를 단일 processor로 래핑합니다.

[Nemotron3_5TranscribeProcessor](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeProcessor)는 `feature_extractor_class`, `tokenizer_class`, `{alignment_tokenizer_class}`의 모든 기능을 제공합니다. 자세한 내용은 `~feature_extractor_class`, `~tokenizer_class`, `~{alignment_tokenizer_class}`를 참고하세요.

#### __call__[[transformers.Nemotron3_5TranscribeProcessor.__call__]]

```python
__call__(text: str | list[str], audio: typing.Union[numpy.ndarray, ForwardRef('torch.Tensor'), collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence['torch.Tensor'], NoneType] = None, output_labels: bool | None = False, **kwargs: *<class 'transformers.processing_utils.ProcessingKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/processing_nemotron3_5_transcribe.py#L261)

**매개변수:**

text (`Union[str, list[str]]`) : 인코딩할 시퀀스 또는 시퀀스 배치입니다. 각 시퀀스는 문자열 또는 문자열 목록(사전 토큰화된 문자열)일 수 있습니다. 사전 토큰화된 입력을 전달하는 경우, 배치 입력과의 혼동을 피하기 위해 `is_split_into_words=True`를 설정하세요.

audio (`Union[numpy.ndarray, torch.Tensor, collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence[torch.Tensor]]`, *선택 사항*) : 준비할 오디오 또는 오디오 배치입니다. 각 오디오는 NumPy 배열 또는 PyTorch 텐서일 수 있습니다. NumPy 배열/PyTorch 텐서의 경우, 각 오디오의 shape은 (C, T)여야 하며, 여기서 C는 채널 수, T는 오디오의 샘플 길이입니다.

output_labels (`bool`, *선택*, 기본값=False) : 학습용 라벨을 반환할지 여부.

return_mm_token_type_ids (`bool`, *kwargs*) : 멀티모달 플레이스홀더 토큰의 위치를 나타내는 멀티모달 토큰 타입 ID를 반환할지 여부.

return_text_replacement_offsets (`bool`, *kwargs*) : 각 멀티모달 플레이스홀더 및 그 대체 문자열의 문자 오프셋을 반환할지 여부.

return_tensors (`str` 또는 [TensorType](/docs/transformers/v5.23.0/ko/internal/file_utils#transformers.TensorType), *optional*) : 설정된 경우, 특정 프레임워크의 텐서를 반환합니다. 허용되는 값은 다음과 같습니다:  - `'pt'`: PyTorch `torch.Tensor` 객체를 반환합니다. - `'np'`: NumPy `np.ndarray` 객체를 반환합니다.

- ****kwargs** ([ProcessingKwargs](/docs/transformers/v5.23.0/ko/main_classes/processors#transformers.ProcessingKwargs), *optional*) : 각 모달리티(텍스트, 이미지, 비디오, 오디오)에 대한 추가 처리 옵션입니다. 모델별 매개변수는 위에 나열되어 있으며, 지원되는 인수의 전체 목록은 TypedDict 클래스를 참조하세요.

**반환값:** [BatchFeature](/docs/transformers/v5.23.0/ko/main_classes/feature_extractor#transformers.BatchFeature)

토큰화된 텍스트(`input_ids`, `attention_mask`)와 오디오 특징(`input_features`, `input_features_mask`)을 포함하는 사전입니다.

#### apply_transcription_request[[transformers.Nemotron3_5TranscribeProcessor.apply_transcription_request]]

```python
apply_transcription_request(audio: typing.Union[str, list[str], numpy.ndarray, ForwardRef('torch.Tensor'), collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence['torch.Tensor']], prompt: str | list[str] | None = None, **kwargs: *<class 'transformers.processing_utils.ProcessingKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/processing_nemotron3_5_transcribe.py#L334)

**매개변수:**

audio (`str`, `list[str]`, `np.ndarray`, `torch.Tensor`, `list[np.ndarray]`, `list[torch.Tensor]`) : 전사할 오디오입니다. 문자열은 로컬 경로 또는 URL로 해석되며 chat template loader에 의해 자동으로 로드됩니다. NumPy 배열과 PyTorch 텐서는 그대로 전달됩니다.

prompt (`str` 또는 `list[str]`, *선택 사항*) : 사용자 턴에 포함할 사용자 지정 프롬프트입니다. 리스트의 길이는 배치와 동일해야 합니다. `None`인 경우 각 샘플은 `default_transcription_prompt`를 사용합니다.

- ****kwargs** : [apply_chat_template()](/docs/transformers/v5.23.0/ko/main_classes/processors#transformers.ProcessorMixin.apply_chat_template)로 전달되는 추가 키워드 인자(예: `text_kwargs`, `audio_kwargs`, ...). `enable_thinking=True`가 전달되지 않는 한 Thinking은 비활성화됩니다(채팅 템플릿은 기본적으로 활성화합니다).

**반환값:** [BatchFeature](/docs/transformers/v5.23.0/ko/main_classes/feature_extractor#transformers.BatchFeature)

`Nemotron3_5TranscribeForConditionalGeneration.generate()`에 전달할 준비가 된 Processor 출력입니다.

…

#### apply_chat_template[[transformers.Nemotron3_5TranscribeProcessor.apply_chat_template]]

```python
apply_chat_template(conversation: list[dict[str, str]] | list[list[dict[str, str]]], chat_template: str | None = None, tools: list[dict] | None = None, documents: list[dict[str, str]] | None = None, add_generation_prompt: bool = False, continue_final_message: bool | str = False, return_assistant_tokens_mask: bool = False, tokenize: bool = False, return_tensors: str | transformers.utils.generic.TensorType | None = 'auto', return_dict: bool = False, load_audio_from_video: bool = False, processor_kwargs: dict | None = None, sanitize_control_tokens: bool = False, **kwargs)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/processing_utils.py#L2310)

**매개변수:**

conversation (`Union[list[Dict, [str, str]], list[list[dict[str, str]]]]`) : 포맷할 대화.

chat_template (`Optional[str]`, *선택*) : 대화를 포맷팅하는 데 사용할 Jinja 템플릿입니다. 제공되지 않으면 토크나이저의 chat template이 사용됩니다.

sanitize_control_tokens (`bool`, 기본값 `False`) : 대화, 도구, 문서 및 `**kwargs`로 전달된 템플릿 변수에서 발견된 제어 토큰을 일반 텍스트로 인코딩할지 여부입니다. 이를 통해 사용자 입력이 제어 토큰이나 mm 플레이스홀더를 작성할 수 없도록 합니다. 토크나이저의 `apply_chat_template`를 참조하세요. `tokenize=True`가 필요합니다.

토크나이저의 `apply_chat_template` 메서드와 유사하게, 이 메서드는 입력 대화에 Jinja 템플릿을 적용하여 이를 단일 토큰화 가능한 문자열로 변환합니다.

입력은 다음 형식으로 제공되어야 하며, 각 메시지 콘텐츠는 텍스트와 선택적으로 이미지 또는 비디오 입력으로 구성된 리스트입니다. `return_dict=True`인 경우, `pixel_values`를 형성하는 데 사용되는 이미지, 비디오, URL 또는 로컬 경로를 제공할 수도 있습니다. 제공하지 않으면 포맷된 텍스트만, 선택적으로 토큰화된 텍스트만 반환됩니다.

conversation = [ { "role": "user", "content": [ {"type": "image", "url": "https://www.ilankelman.org/stopsigns/australia.jpg"}, {"type": "text", "text": "Please describe this image in detail."}, ], }, ]

#### extract_speaker_dict[[transformers.Nemotron3_5TranscribeProcessor.extract_speaker_dict]]

```python
extract_speaker_dict(text: str | list[str])
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/processing_nemotron3_5_transcribe.py#L408)

**매개변수:**

text (`str` 또는 `list[str]`) : `skip_special_tokens=False`로 디코딩된 단일 텍스트 또는 텍스트 배치입니다. `<spk:N>` 스피커 태그는 특수 토큰입니다. 텍스트 종료 토큰 이후의 모든 내용은 제거됩니다.

**반환값:** 단일 텍스트의 경우 `list[dict]`, 배치의 경우 `list[list[dict]]`

각 화자 턴마다 하나의 dict를 가지며, `<spk:N>` 태그의 `N` 인덱스가 `"Speaker"` 값이 되고, `"Content"`를 포함합니다. 태그가 없는 텍스트는 `"Speaker": None`인 단일 턴이며, 첫 태그 앞의 텍스트도 마찬가지입니다.

`VibeVoiceAsrProcessor.extract_speaker_dict()` 형식의 화자별 전사본을 화자 턴으로 분리합니다. 이 모델은 타임스탬프를 예측하지 않으므로 타임스탬프는 제외됩니다.

예:

```python
>>> processor.extract_speaker_dict("<spk:0> Hi, how are you? <spk:1> Fine, thanks.<|im_end|>")
[{'Speaker': 0, 'Content': 'Hi, how are you?'}, {'Speaker': 1, 'Content': 'Fine, thanks.'}]
```

#### align_word_timestamps[[transformers.Nemotron3_5TranscribeProcessor.align_word_timestamps]]

```python
align_word_timestamps(transcriptions: str | list[str], word_timestamp_logits: torch.Tensor, input_features_mask: torch.Tensor, speaker_logits: torch.Tensor | None = None, language: str | list[str | None] | None = None, speaker_activity_threshold: float = 0.5, max_word_duration: float = 1.0, max_word_frames: int = 12)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/processing_nemotron3_5_transcribe.py#L449)

**매개변수:**

transcriptions (`str` 또는 `list[str]`) : `<spk:N>` 태그를 유지하기 위해 `skip_special_tokens=False`로 디코딩된 각 녹음의 생성된 텍스트.

word_timestamp_logits (`torch.Tensor`, shape `(batch_size, num_frames * upsampling_factor, vocab_size)`) : word timestamp head의 logits(`generate(..., return_word_timestamp_logits=True)` 또는 `model.get_word_timestamp_logits(...)`의 `word_timestamp_logits`)입니다. 마지막 클래스는 CTC blank입니다. 인코더 프레임당 프레임 수, 즉 해당 head의 `upsampling_factor`는 shape에서 읽힙니다.

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : 프로세서가 반환한 각 녹음의 유효한 스펙트로그램 프레임 마스크입니다. 이 프레임의 수는 녹음의 길이를 결정하므로, 헤드 프레임의 시간 단계를 설정합니다.

speaker_logits (`torch.Tensor`, shape `(batch_size, num_frames * subsampling_factor, num_speakers)`, *선택 사항*) : 화자 분리 모델의 logits(`generate(..., return_word_timestamp_logits=True)` 또는 `get_audio_features`의 `speaker_logits`). 이 값이 없으면 각 전사본은 단일 화자로 정렬되며 화자 분리 결과가 반환되지 않습니다.

language (`str` 또는 `list[str | None]`, *선택 사항*) : 전사본의 언어입니다. 전체 전사본에 하나씩 또는 전사본별로 하나씩 지정하며, `None`인 경우 스크립트에서 감지됩니다. `"zh"`와 `"ja"`는 문자 단위로 정렬되며, `"th"`는 지원되지 않습니다.

speaker_activity_threshold (`float`, *선택 사항*, 기본값 0.5) : 화자 분리에서 화자가 활성 상태인 것으로 판단되는 확률 임계값.

max_word_duration (`float`, *선택 사항*, 기본값 1.0) : 정렬된 단어의 최대 지속 시간(초).

max_word_frames (`int`, *선택 사항*, 기본값 12) : 화자 분리(diarization) 세그먼트에 스냅된 단어의 최대 시프트와 지속 시간입니다. 최대 80ms인 인코더 프레임 단위로 측정됩니다.

**반환값:** `dict` 또는 `list[dict]`

녹음(또는 전사 목록의 각 녹음)에 대해, 음성 인식 파이프라인의 단어 타임스탬프를 `"chunks"`(단어마다 `{"text", "timestamp", "speaker"}`, `timestamp` = `(start, end)` 초 단위, 시간순 정렬; `speaker`는 해당 단어 태그의 `N`, 첫 태그 이전에는 `None`, 태그가 없는 전사에는 0), `"diarization"`(각 화자 분리 스피커의 `{"speaker", "timestamp"}` 활동 세그먼트), `"speaker_tag_to_diarization_speaker"`(일치하지 않는 태그의 경우 `None`) 및 `"failed_speakers"`(단어가 정렬되지 못해 `"chunks"`에 없는 태그)

생성된 전사 텍스트의 각 단어를 시간으로 표시하고 화자에게 할당합니다. 각 `<spk:N>` 태그의 단어는 화자 분리에서 해당 태그와 일치하는 화자가 활성 상태인 워드 타임스탬프 헤드의 프레임에 대해 강제 정렬(`torchaudio.functional.forced_align`)된 후, 해당 화자의 화자 분리 세그먼트에 스냅됩니다. NeMo의 `MultiSpeakerSOTWordTimestampAligner`를 이식한 것으로, 긴 녹음 파일을 근사 처리하는 부분에서 정확한 탐색을 수행합니다.

예:

```python
>>> inputs = processor.apply_transcription_request(audio, prompt=speaker_attributed_prompt).to(model.device)
>>> outputs = model.generate(**inputs, return_word_timestamp_logits=True, max_new_tokens=500)
>>> transcriptions = processor.decode(
...     outputs.sequences[:, inputs.input_ids.shape[1] :], skip_special_tokens=False
... )
>>> timestamps = processor.align_word_timestamps(
...     transcriptions, outputs.word_timestamp_logits, inputs.input_features_mask, outputs.speaker_logits
... )
>>> timestamps[0]["chunks"][0]  # {'text': ..., 'timestamp': (..., ...), 'speaker': 0}
```

## Nemotron3_5TranscribeAsrAudioModel[[transformers.Nemotron3_5TranscribeAsrAudioModel]]

#### transformers.Nemotron3_5TranscribeAsrAudioModel[[transformers.Nemotron3_5TranscribeAsrAudioModel]]

```python
transformers.Nemotron3_5TranscribeAsrAudioModel(config: Nemotron3_5TranscribeAsrAudioConfig)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L379)

**매개변수:**

config ([Nemotron3_5TranscribeAsrAudioConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeAsrAudioConfig)) : 모델의 모든 매개변수를 포함하는 모델 구성 클래스입니다. 구성 파일로 초기화하면 모델과 관련된 가중치가 로드되지 않고 구성 정보만 로드됩니다. 모델 가중치를 로드하려면 [from_pretrained()](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained) 메서드를 확인하세요.

Nemotron 3.5 Transcribe 음성 인식 인코더: 각 어텐션 헤드의 쿼리와 키를 정규화하고, 각 헤드의 일부에 회전 위치 임베딩을 적용한 Nemotron 3 Diarization 오디오 인코더입니다.

이 모델은 [PreTrainedModel](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel)에서 상속됩니다. 라이브러리가 모든 모델에 대해 구현하는 일반적 메서드(다운로드 또는 저장, 입력 임베딩 크기 조정, 헤드 프루닝 등)에 대해서는 상위 클래스 문서를 확인하세요.

이 모델은 또한 PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)의 하위 클래스입니다. 일반적인 PyTorch Module처럼 사용하며, 일반적인 사용법과 동작에 관한 모든 사항은 PyTorch 문서를 참조하세요.

#### forward[[transformers.Nemotron3_5TranscribeAsrAudioModel.forward]]

```python
forward(input_features: typing.Optional[torch.Tensor] = None, attention_mask: typing.Optional[torch.Tensor] = None, inputs_embeds: typing.Optional[torch.Tensor] = None, position_ids: typing.Optional[torch.Tensor] = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L400)

**매개변수:**

input_features (`torch.Tensor`, shape `(batch_size, sequence_length, feature_dim)`, *선택 사항*) : 입력 오디오 특징에 해당하는 텐서입니다. 오디오 특징은 `feature_extractor_class`를 사용하여 얻을 수 있습니다. 자세한 내용은 `feature_extractor_class.__call__`를 참조하세요 (`processor_class`는 오디오 처리에 `feature_extractor_class`를 사용합니다).

attention_mask (`torch.Tensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 패딩 토큰 인덱스에 대한 attention을 수행하지 않도록 방지하는 마스크입니다. `[0, 1]`에서 선택된 마스크 값: - **마스크되지 않은** 토큰은 1, - **마스크된** 토큰은 0. [attention 마스크란?](../glossary#attention-mask)

inputs_embeds (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`, *선택 사항*) : `input_ids`를 전달하는 대신 임베디드 표현을 직접 전달할 수 있습니다. 이는 모델의 내부 임베딩 조회 행렬보다 `input_ids` 인덱스를 관련 벡터로 변환하는 방식에 대해 더 많은 제어가 필요한 경우 유용합니다.

position_ids (`torch.Tensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 각 입력 시퀀스의 토큰 위치 인덱스입니다. `[0, config.n_positions - 1]` 범위에서 선택됩니다.  [위치 ID란 무엇인가요?](../glossary#position-ids)

**반환값:** [BaseModelOutput](/docs/transformers/v5.23.0/ko/main_classes/output#transformers.modeling_outputs.BaseModelOutput) 또는 `tuple(torch.Tensor)`

구성([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig))과 입력에 따라 다양한 요소를 포함하는 [BaseModelOutput](/docs/transformers/v5.23.0/ko/main_classes/output#transformers.modeling_outputs.BaseModelOutput) 또는 `torch.Tensor`의 튜플(`return_dict=False`가 전달되거나 `config.return_dict=False`인 경우).

[Nemotron3_5TranscribeAsrAudioModel](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeAsrAudioModel)의 forward 메서드는 `__call__` 특수 메서드를 오버라이드합니다.

`Module` 인스턴스는 전처리 및 후처리 단계를 실행하는 것을 처리하지만, 이 함수는 해당 단계를 조용히 무시하므로, 순전파(forward pass) 레시피를 이 함수 내에서 정의해야 하더라도 이후에는 이 함수 대신 `Module` 인스턴스를 호출해야 합니다.

- **last_hidden_state** (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`) -- 모델의 마지막 레이어 출력에서 생성된 hidden-state 시퀀스입니다.
- **hidden_states** (`tuple(torch.Tensor)`, *선택 사항*, `output_hidden_states=True`가 전달되었거나 `config.output_hidden_states=True`인 경우 반환됨) -- `torch.Tensor`의 튜플(모델에 임베딩 레이어가 있는 경우 임베딩 출력 1개 + 각 레이어의 출력 1개)로, 형태는 `(batch_size, sequence_length, hidden_size)`입니다.

  각 레이어의 출력에서 모델의 Hidden-states와 선택적 초기 임베딩 출력을 포함합니다.
- **attentions** (`tuple(torch.Tensor)`, *선택 사항*, `output_attentions=True`가 전달되었거나 `config.output_attentions=True`인 경우 반환됨) -- 각 레이어마다 하나씩 포함된 `torch.Tensor`의 튜플로, 모양은 `(batch_size, num_heads, sequence_length, sequence_length)`입니다.

  self-attention 헤드에서 가중 평균을 계산하는 데 사용되는 attention softmax 이후의 attention 가중치입니다.

## Nemotron3_5TranscribeAudioModel[[transformers.Nemotron3_5TranscribeAudioModel]]

#### transformers.Nemotron3_5TranscribeAudioModel[[transformers.Nemotron3_5TranscribeAudioModel]]

```python
transformers.Nemotron3_5TranscribeAudioModel(config: Nemotron3_5TranscribeAudioConfig)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L547)

**매개변수:**

config ([Nemotron3_5TranscribeAudioConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeAudioConfig)) : 모델의 모든 매개변수를 포함하는 모델 구성 클래스입니다. 구성 파일로 초기화하면 모델과 관련된 가중치가 로드되지 않고 구성만 로드됩니다. 모델 가중치를 로드하려면 [from_pretrained()](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained) 메서드를 확인하세요.

Nemotron 3.5 Transcribe 오디오 모델: 음성 인식 인코더와 화자 분리 모델이 동일한 스펙트로그램에서 병렬로 실행되며, 화자 활동이 음성 인식 인코더의 출력에 추가됩니다.

이 모델은 [PreTrainedModel](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel)에서 상속됩니다. 라이브러리가 모든 모델에 대해 구현하는 일반적 메서드(다운로드 또는 저장, 입력 임베딩 크기 조정, 헤드 프루닝 등)에 대해서는 상위 클래스 문서를 확인하세요.

이 모델은 또한 PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)의 하위 클래스입니다. 일반적인 PyTorch Module처럼 사용하며, 일반적인 사용법과 동작에 관한 모든 사항은 PyTorch 문서를 참조하세요.

#### forward[[transformers.Nemotron3_5TranscribeAudioModel.forward]]

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

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L561)

**매개변수:**

input_features (`torch.Tensor`, shape `(batch_size, feature_sequence_length, num_mel_bins)`) : `config.subsampling_factor` 프레임의 배수로 패딩된 로그 멜 스펙트로그램입니다. 원본과 동일하게, `config.diarization_config.chunk_length` 인코더 프레임보다 긴 오디오는 컨텍스트를 포함하여 청크 단위로 인코딩됩니다.

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`, *선택 사항*) : 유효한 스펙트로그램 프레임의 마스크입니다. 패딩은 오른쪽에 있어야 합니다.

**반환값:** `Nemotron3_5TranscribeAudioModelOutput` 또는 `tuple(torch.Tensor)`

`Nemotron3_5TranscribeAudioModelOutput` 또는 `torch.Tensor`의 튜플(`return_dict=False`가 전달되거나 `config.return_dict=False`인 경우)로, 구성([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig))과 입력에 따라 다양한 요소를 포함합니다.

[Nemotron3_5TranscribeAudioModel](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeAudioModel)의 forward 메서드는 `__call__` 특수 메서드를 오버라이드합니다.

`Module` 인스턴스는 전처리 및 후처리 단계를 실행하는 것을 처리하지만, 이 함수는 해당 단계를 조용히 무시하므로, 순전파(forward pass) 레시피를 이 함수 내에서 정의해야 하더라도 이후에는 이 함수 대신 `Module` 인스턴스를 호출해야 합니다.

- **last_hidden_state** (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`) -- 모델의 마지막 레이어 출력에서 생성된 hidden-state 시퀀스입니다.
- **pooler_output** (`torch.Tensor`, shape `(num_audio_tokens, text_config.hidden_size)`, *선택 사항*) -- 각 녹음의 유효한 인코더 프레임에 대한 투영된 오디오 임베딩을 배치 순서대로 반환합니다. 프롬프트의 오디오 토큰을 대체하는 임베딩입니다. `get_audio_features`에서 반환됩니다.
- **hidden_states** (`tuple(torch.Tensor)`, *선택 사항*, `output_hidden_states=True`가 전달되었거나 `config.output_hidden_states=True`인 경우 반환됨) -- `torch.Tensor`의 튜플(모델에 임베딩 레이어가 있는 경우 임베딩 출력 1개 + 각 레이어의 출력 1개)로, 형태는 `(batch_size, sequence_length, hidden_size)`입니다.

  각 레이어의 출력에서 모델의 Hidden-states와 선택적 초기 임베딩 출력을 포함합니다.
- **attentions** (`tuple(torch.Tensor)`, *선택 사항*, `output_attentions=True`가 전달되었거나 `config.output_attentions=True`인 경우 반환됨) -- 각 레이어마다 하나씩 포함된 `torch.Tensor`의 튜플로, 모양은 `(batch_size, num_heads, sequence_length, sequence_length)`입니다.

  self-attention 헤드에서 가중 평균을 계산하는 데 사용되는 attention softmax 이후의 attention 가중치입니다.
- **asr_last_hidden_state** (`torch.Tensor`, shape `(batch_size, num_frames, audio_config.hidden_size)`) -- 음성 인식 인코더의 출력으로, 정규화 및 화자 임베딩 적용 전 상태입니다. [get_word_timestamp_logits()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeForConditionalGeneration.get_word_timestamp_logits)의 입력입니다.
- **speaker_logits** (`torch.Tensor`, shape `(batch_size, feature_sequence_length, audio_config.num_speakers)`) -- 화자 분리 모델의 logits. 스펙트로그램 프레임마다 1프레임씩 생성됩니다.

## Nemotron3_5TranscribeWordTimestampModel[[transformers.Nemotron3_5TranscribeWordTimestampModel]]

#### transformers.Nemotron3_5TranscribeWordTimestampModel[[transformers.Nemotron3_5TranscribeWordTimestampModel]]

```python
transformers.Nemotron3_5TranscribeWordTimestampModel(config: Nemotron3_5TranscribeWordTimestampConfig)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L444)

**매개변수:**

config ([Nemotron3_5TranscribeWordTimestampConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeWordTimestampConfig)) : 모델의 모든 매개변수를 포함하는 모델 구성 클래스입니다. 구성 파일로 초기화하면 모델과 관련된 가중치가 로드되지 않고 구성만 로드됩니다. 모델 가중치를 로드하려면 [from_pretrained()](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained) 메서드를 확인하세요.

Nemotron 3.5 Transcribe의 워드 타임스탬프 헤드 트랜스포머입니다. `Nemotron3_5TranscribeForConditionalGeneration.word_timestamp_head`는 출력을 분류합니다.

이 모델은 [PreTrainedModel](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel)에서 상속됩니다. 라이브러리가 모든 모델에 대해 구현하는 일반적 메서드(다운로드 또는 저장, 입력 임베딩 크기 조정, 헤드 프루닝 등)에 대해서는 상위 클래스 문서를 확인하세요.

이 모델은 또한 PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)의 하위 클래스입니다. 일반적인 PyTorch Module처럼 사용하며, 일반적인 사용법과 동작에 관한 모든 사항은 PyTorch 문서를 참조하세요.

#### forward[[transformers.Nemotron3_5TranscribeWordTimestampModel.forward]]

```python
forward(inputs_embeds: Tensor, attention_mask: typing.Optional[torch.Tensor] = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L470)

**매개변수:**

inputs_embeds (`torch.Tensor`, shape `(batch_size, num_frames, hidden_size)`) : 오디오 모델의 `asr_norm` 및 스피커 임베딩 적용 전의 음성 인식 인코더 상태

attention_mask (`torch.Tensor`, shape `(batch_size, num_frames)`, *선택 사항*) : 유효한 인코더 프레임의 마스크입니다.

[Nemotron3_5TranscribeWordTimestampModel](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeWordTimestampModel)의 forward 메서드는 `__call__` 특수 메서드를 오버라이드합니다.

`Module` 인스턴스는 전처리 및 후처리 단계를 실행하는 것을 처리하지만, 이 함수는 해당 단계를 조용히 무시하므로, 순전파(forward pass) 레시피를 이 함수 내에서 정의해야 하더라도 이후에는 이 함수 대신 `Module` 인스턴스를 호출해야 합니다.

`num_frames * upsampling_factor`개의 프레임을 반환합니다.

## Nemotron3_5TranscribeModel[[transformers.Nemotron3_5TranscribeModel]]

#### transformers.Nemotron3_5TranscribeModel[[transformers.Nemotron3_5TranscribeModel]]

```python
transformers.Nemotron3_5TranscribeModel(config: Nemotron3_5TranscribeConfig)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L641)

**매개변수:**

config ([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig)) : 모델의 모든 매개변수를 포함하는 모델 구성 클래스입니다. 구성 파일로 초기화하는 것은 모델과 관련된 가중치를 로드하지 않으며, 구성 정보만 로드합니다. 모델 가중치를 로드하려면 [from_pretrained()](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained) 메서드를 확인하세요.

언어 모델링 헤드가 없는 Nemotron 3.5 Transcribe 모델(음성 인식 인코더와 화자 분리 모델을 병렬로 사용하고, 선형 프로젝터와 Nemotron-H 언어 모델을 포함).

이 모델은 [PreTrainedModel](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel)에서 상속됩니다. 라이브러리가 모든 모델에 대해 구현하는 일반적 메서드(다운로드 또는 저장, 입력 임베딩 크기 조정, 헤드 프루닝 등)에 대해서는 상위 클래스 문서를 확인하세요.

이 모델은 또한 PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)의 하위 클래스입니다. 일반적인 PyTorch Module처럼 사용하며, 일반적인 사용법과 동작에 관한 모든 사항은 PyTorch 문서를 참조하세요.

#### forward[[transformers.Nemotron3_5TranscribeModel.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, input_features: typing.Optional[torch.Tensor] = None, input_features_mask: typing.Optional[torch.Tensor] = 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.Tensor] = None, use_cache: bool | None = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L708)

**매개변수:**

input_ids (`torch.LongTensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 어휘(input sequence tokens)의 인덱스입니다. 기본적으로 패딩은 무시됩니다. [AutoTokenizer](/docs/transformers/v5.23.0/ko/model_doc/auto#transformers.AutoTokenizer)를 사용하여 인덱스를 얻을 수 있습니다. 자세한 내용은 [PreTrainedTokenizer.encode()](/docs/transformers/v5.23.0/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) 및 [PreTrainedTokenizer.__call__()](/docs/transformers/v5.23.0/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__)를 참조하세요. [입력 ID란 무엇인가요?](../glossary#input-ids)

input_features (`torch.Tensor`, shape `(batch_size, sequence_length, feature_dim)`, *선택 사항*) : 입력 오디오 특징에 해당하는 텐서입니다. 오디오 특징은 `feature_extractor_class`를 사용하여 얻을 수 있습니다. 자세한 내용은 `feature_extractor_class.__call__`를 참조하세요 (`processor_class`는 오디오 처리에 `feature_extractor_class`를 사용합니다).

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : padding feature 인덱스에 attention을 수행하지 않도록 방지하는 마스크.

attention_mask (`torch.Tensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 패딩 토큰 인덱스에 대한 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(셀프 어텐션 블록과 크로스 어텐션 블록의 key 및 value)입니다. 일반적으로 `use_cache=True` 또는 `config.use_cache=True`일 때 모델이 디코딩의 이전 단계에서 반환한 `past_key_values`로 구성됩니다. 입력으로 [Cache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.Cache) 인스턴스만 허용되며, [kv cache 가이드](https://huggingface.co/docs/transformers/en/kv_cache)를 참조하세요. `past_key_values`가 전달되지 않으면 기본적으로 [DynamicCache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.DynamicCache)가 초기화됩니다. 모델은 입력으로 제공된 것과 동일한 캐시 형식을 출력합니다. `past_key_values`를 사용하는 경우, 이 모델에 과거 key value 상태가 제공되지 않은 `input_ids`(처리되지 않은 항목)만 `(batch_size, unprocessed_length)` 형식으로 입력해야 하며, `(batch_size, sequence_length)` 형식의 모든 `input_ids`를 입력하지 않습니다.

inputs_embeds (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`, *선택 사항*) : `input_ids`를 전달하는 대신 임베디드 표현을 직접 전달할 수 있습니다. 이는 모델의 내부 임베딩 조회 행렬보다 `input_ids` 인덱스를 관련 벡터로 변환하는 방식에 대해 더 많은 제어가 필요한 경우 유용합니다.

use_cache (`bool`, *선택 사항*) : `True`로 설정하면 `past_key_values` 키 값 상태가 반환되며, 디코딩 속도를 높이는 데 사용할 수 있습니다(`past_key_values` 참조).

**반환값:** `Nemotron3_5TranscribeModelOutputWithPast` 또는 `tuple(torch.Tensor)`

`Nemotron3_5TranscribeModelOutputWithPast` 또는 `torch.Tensor`의 튜플(`return_dict=False`가 전달되었거나 `config.return_dict=False`인 경우)로, 구성([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig))과 입력에 따라 다양한 요소를 포함합니다.

[Nemotron3_5TranscribeModel](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeModel)의 forward 메서드는 `__call__` 특수 메서드를 오버라이드합니다.

`Module` 인스턴스는 전처리 및 후처리 단계를 실행하는 것을 처리하지만, 이 함수는 해당 단계를 조용히 무시하므로, 순전파(forward pass) 레시피를 이 함수 내에서 정의해야 하더라도 이후에는 이 함수 대신 `Module` 인스턴스를 호출해야 합니다.

- **last_hidden_state** (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`) -- 모델의 마지막 레이어 출력에서 생성된 hidden-state 시퀀스입니다.

  `past_key_values`가 사용되면, `(batch_size, 1, hidden_size)` 형태의 시퀀스의 마지막 hidden-state만 출력됩니다.
- **past_key_values** (`Cache`, *선택 사항*, `use_cache=True`가 전달되었거나 `config.use_cache=True`인 경우 반환됨) -- [Cache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.Cache) 인스턴스입니다. 자세한 내용은 [kv cache 가이드](https://huggingface.co/docs/transformers/en/kv_cache)를 참조하세요.

  순차적 디코딩을 가속화하는 데 사용할 수 있는 사전 계산된 hidden-states(셀프 어텐션 블록의 key와 value, 그리고 `config.is_encoder_decoder=True`인 경우 크로스 어텐션 블록의 key와 value)를 포함합니다(입력 `past_key_values` 참조).
- **hidden_states** (`tuple(torch.Tensor)`, *선택 사항*, `output_hidden_states=True`가 전달되었거나 `config.output_hidden_states=True`인 경우 반환됨) -- `torch.Tensor`의 튜플(모델에 임베딩 레이어가 있는 경우 임베딩 출력 1개 + 각 레이어의 출력 1개)로, 형태는 `(batch_size, sequence_length, hidden_size)`입니다.

  각 레이어의 출력에서 모델의 Hidden-states와 선택적 초기 임베딩 출력을 포함합니다.
- **attentions** (`tuple(torch.Tensor)`, *선택 사항*, `output_attentions=True`가 전달되었거나 `config.output_attentions=True`인 경우 반환됨) -- 각 레이어마다 하나씩 포함된 `torch.Tensor`의 튜플로, 모양은 `(batch_size, num_heads, sequence_length, sequence_length)`입니다.

  self-attention 헤드에서 가중 평균을 계산하는 데 사용되는 attention softmax 이후의 attention 가중치입니다.
- **audio_hidden_states** (`torch.Tensor`, *선택 사항*) -- 투영된 오디오 히든 상태입니다.

#### get_audio_features[[transformers.Nemotron3_5TranscribeModel.get_audio_features]]

```python
get_audio_features(input_features: Tensor, input_features_mask: Tensor, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L654)

**매개변수:**

input_features (`torch.Tensor`) : 원시 음성 파형에서 추출한 멜 특징의 부동 소수점 값.

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : 패딩된 feature 인덱스에 attention을 수행하지 않도록 하는 마스크입니다.

**반환값:** [BaseModelOutputWithPooling](/docs/transformers/v5.23.0/ko/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling) 또는 `tuple(torch.Tensor)`

`torch.Tensor`의 튜플 또는 [BaseModelOutputWithPooling](/docs/transformers/v5.23.0/ko/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling) (`return_dict=False`가 전달되었거나 `config.return_dict=False`인 경우)로, 구성([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig))과 입력에 따라 다양한 요소를 포함합니다.

이 메서드는 입력 특징(로그 멜 스펙트로그램)에서 오디오 임베딩을 가져오는 데 사용되며, 이는 오디오 인코더와 멀티모달 프로젝터를 추론하는 것을 의미합니다.

- **last_hidden_state** (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`) -- 모델의 마지막 레이어 출력에서 생성된 hidden-state 시퀀스입니다.
- **pooler_output** (`torch.Tensor`, shape `(batch_size, hidden_size)`) -- 시퀀스의 첫 번째 토큰(분류 토큰)의 마지막 레이어 hidden-state입니다. 보조 사전학습 작업을 위해 사용되는 레이어들을 통해 추가 처리된 값입니다. 예를 들어 BERT 계열 모델의 경우, 선형 레이어와 tanh 활성화 함수를 통해 처리된 분류 토큰을 반환합니다. 선형 레이어의 가중치는 사전학습 단계에서 다음 문장 예측(분류) 목적 함수를 통해 학습됩니다.
- **hidden_states** (`tuple(torch.Tensor)`, *선택 사항*, `output_hidden_states=True`가 전달되었거나 `config.output_hidden_states=True`인 경우 반환됨) -- `torch.Tensor`의 튜플(모델에 임베딩 레이어가 있는 경우 임베딩 출력 1개 + 각 레이어의 출력 1개)로, 형태는 `(batch_size, sequence_length, hidden_size)`입니다.

  각 레이어의 출력에서 모델의 Hidden-states와 선택적 초기 임베딩 출력을 포함합니다.
- **attentions** (`tuple(torch.Tensor)`, *선택 사항*, `output_attentions=True`가 전달되었거나 `config.output_attentions=True`인 경우 반환됨) -- 각 레이어마다 하나씩 포함된 `torch.Tensor`의 튜플로, 모양은 `(batch_size, num_heads, sequence_length, sequence_length)`입니다.

  self-attention 헤드에서 가중 평균을 계산하는 데 사용되는 attention softmax 이후의 attention 가중치입니다.

#### get_word_timestamp_hidden_states[[transformers.Nemotron3_5TranscribeModel.get_word_timestamp_hidden_states]]

```python
get_word_timestamp_hidden_states(asr_last_hidden_state: Tensor, input_features_mask: Tensor)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L767)

**매개변수:**

asr_last_hidden_state (`torch.Tensor`, shape `(batch_size, num_frames, audio_config.hidden_size)`) : `input_features_mask`에 대해 [get_audio_features()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeModel.get_audio_features)가 반환하는, 정규화 및 화자 임베딩 적용 전 음성 인식 인코더의 출력입니다.

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : 유효한 스펙트로그램 프레임의 마스크입니다. 패딩은 오른쪽에 있어야 합니다.

**반환값:**

`torch.Tensor`, shape `(batch_size, num_frames * word_timestamp_config.upsampling_factor, audio_config.hidden_size)`: word timestamp encoder의 dtype로, encoder 프레임당 `upsampling_factor`개의 프레임.

인코더의 청크 단위에서 음성 인식 인코더 상태에 대해 단어 타임스탬프 인코더를 실행합니다: 단어 타임스탬프 헤드가 분류하는 상태입니다.

## Nemotron3_5TranscribeForConditionalGeneration[[transformers.Nemotron3_5TranscribeForConditionalGeneration]]

#### transformers.Nemotron3_5TranscribeForConditionalGeneration[[transformers.Nemotron3_5TranscribeForConditionalGeneration]]

```python
transformers.Nemotron3_5TranscribeForConditionalGeneration(config: Nemotron3_5TranscribeConfig)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L808)

**매개변수:**

config ([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig)) : 모델의 모든 매개변수를 포함하는 모델 구성 클래스입니다. 구성 파일로 초기화하는 것은 모델과 관련된 가중치를 로드하지 않으며, 구성 정보만 로드합니다. 모델 가중치를 로드하려면 [from_pretrained()](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained) 메서드를 확인하세요.

언어 모델링 헤드를 갖춘 Nemotron 3.5 Transcribe 모델(병렬로 동작하는 음성 인식 인코더와 화자 분리 모델, 선형 프로젝터, Nemotron-H 언어 모델)

이 모델은 [PreTrainedModel](/docs/transformers/v5.23.0/ko/main_classes/model#transformers.PreTrainedModel)에서 상속됩니다. 라이브러리가 모든 모델에 대해 구현하는 일반적 메서드(다운로드 또는 저장, 입력 임베딩 크기 조정, 헤드 프루닝 등)에 대해서는 상위 클래스 문서를 확인하세요.

이 모델은 또한 PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)의 하위 클래스입니다. 일반적인 PyTorch Module처럼 사용하며, 일반적인 사용법과 동작에 관한 모든 사항은 PyTorch 문서를 참조하세요.

#### forward[[transformers.Nemotron3_5TranscribeForConditionalGeneration.forward]]

```python
forward(input_ids: typing.Optional[torch.LongTensor] = None, input_features: typing.Optional[torch.Tensor] = None, input_features_mask: typing.Optional[torch.Tensor] = 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.Tensor] = None, labels: typing.Optional[torch.LongTensor] = None, use_cache: bool | None = None, logits_to_keep: typing.Union[int, torch.Tensor] = 0, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L828)

**매개변수:**

input_ids (`torch.LongTensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 어휘(input sequence tokens)의 인덱스입니다. 기본적으로 패딩은 무시됩니다. [AutoTokenizer](/docs/transformers/v5.23.0/ko/model_doc/auto#transformers.AutoTokenizer)를 사용하여 인덱스를 얻을 수 있습니다. 자세한 내용은 [PreTrainedTokenizer.encode()](/docs/transformers/v5.23.0/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode) 및 [PreTrainedTokenizer.__call__()](/docs/transformers/v5.23.0/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__)를 참조하세요. [입력 ID란 무엇인가요?](../glossary#input-ids)

input_features (`torch.Tensor`, shape `(batch_size, sequence_length, feature_dim)`, *선택 사항*) : 입력 오디오 특징에 해당하는 텐서입니다. 오디오 특징은 `feature_extractor_class`를 사용하여 얻을 수 있습니다. 자세한 내용은 `feature_extractor_class.__call__`를 참조하세요 (`processor_class`는 오디오 처리에 `feature_extractor_class`를 사용합니다).

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : padding feature 인덱스에 attention을 수행하지 않도록 방지하는 마스크.

attention_mask (`torch.Tensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : 패딩 토큰 인덱스에 대한 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(셀프 어텐션 블록과 크로스 어텐션 블록의 key 및 value)입니다. 일반적으로 `use_cache=True` 또는 `config.use_cache=True`일 때 모델이 디코딩의 이전 단계에서 반환한 `past_key_values`로 구성됩니다. 입력으로 [Cache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.Cache) 인스턴스만 허용되며, [kv cache 가이드](https://huggingface.co/docs/transformers/en/kv_cache)를 참조하세요. `past_key_values`가 전달되지 않으면 기본적으로 [DynamicCache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.DynamicCache)가 초기화됩니다. 모델은 입력으로 제공된 것과 동일한 캐시 형식을 출력합니다. `past_key_values`를 사용하는 경우, 이 모델에 과거 key value 상태가 제공되지 않은 `input_ids`(처리되지 않은 항목)만 `(batch_size, unprocessed_length)` 형식으로 입력해야 하며, `(batch_size, sequence_length)` 형식의 모든 `input_ids`를 입력하지 않습니다.

inputs_embeds (`torch.Tensor`, shape `(batch_size, sequence_length, hidden_size)`, *선택 사항*) : `input_ids`를 전달하는 대신 임베디드 표현을 직접 전달할 수 있습니다. 이는 모델의 내부 임베딩 조회 행렬보다 `input_ids` 인덱스를 관련 벡터로 변환하는 방식에 대해 더 많은 제어가 필요한 경우 유용합니다.

labels (`torch.LongTensor`, shape `(batch_size, sequence_length)`, *선택 사항*) : masked language modeling loss를 계산하기 위한 라벨.

use_cache (`bool`, *선택 사항*) : `True`로 설정하면 `past_key_values` 키 값 상태가 반환되며, 디코딩 속도를 높이는 데 사용할 수 있습니다(`past_key_values` 참조).

logits_to_keep (`Union[int, torch.Tensor]`, *선택 사항*, 기본값 `0`) : `int`인 경우, 마지막 `logits_to_keep` 토큰에 대한 logits를 계산합니다. `0`인 경우, 모든 `input_ids`에 대한 logits를 계산합니다(특수한 경우). 생성에는 마지막 토큰의 logits만 필요하며, 해당 토큰에 대해서만 계산하면 메모리를 절약할 수 있습니다. 이는 긴 시퀀스나 큰 어휘 크기의 경우 상당한 이점을 제공합니다. `torch.Tensor`인 경우, 시퀀스 길이 차원에서 유지할 인덱스에 해당하는 1차원 텐서여야 합니다. 이는 packed tensor 형식(배치와 시퀀스 길이를 단일 차원으로 사용하는 경우)을 사용할 때 유용합니다.

**반환값:** `Nemotron3_5TranscribeCausalLMOutputWithPast` 또는 `tuple(torch.Tensor)`

`Nemotron3_5TranscribeCausalLMOutputWithPast` 또는 `torch.Tensor`의 튜플(`return_dict=False`가 전달되었거나 `config.return_dict=False`인 경우)로, 구성([Nemotron3_5TranscribeConfig](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeConfig))과 입력에 따라 다양한 요소를 포함합니다.

[Nemotron3_5TranscribeForConditionalGeneration](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeForConditionalGeneration)의 forward 메서드는 `__call__` 특수 메서드를 오버라이드합니다.

`Module` 인스턴스는 전처리 및 후처리 단계를 실행하는 것을 처리하지만, 이 함수는 해당 단계를 조용히 무시하므로, 순전파(forward pass) 레시피를 이 함수 내에서 정의해야 하더라도 이후에는 이 함수 대신 `Module` 인스턴스를 호출해야 합니다.

- **loss** (`torch.Tensor`, shape `(1,)`, *선택 사항*, `labels`가 제공될 때 반환됨) -- 언어 모델링 손실(다음 토큰 예측용).
- **logits** (`torch.Tensor`, shape `(batch_size, sequence_length, config.vocab_size)`) -- 언어 모델링 헤드의 예측 점수.
- **past_key_values** (`Cache`, *선택*, `use_cache=True`가 전달되거나 `config.use_cache=True`인 경우 반환됨) -- [Cache](/docs/transformers/v5.23.0/ko/internal/generation_utils#transformers.Cache) 인스턴스입니다.
- **hidden_states** (`tuple[torch.Tensor]`, *선택*, `output_hidden_states=True`가 전달되었거나 `config.output_hidden_states=True`인 경우 반환됨) -- `torch.Tensor`의 튜플(모델에 임베딩 레이어가 있는 경우 임베딩 출력용 1개 + 각 레이어의 출력용 1개)로, 모양은 `(batch_size, sequence_length, hidden_size)`입니다.

  각 레이어의 출력에서 모델의 Hidden-states와 선택적 초기 임베딩 출력을 포함합니다.
- **attentions** (`tuple[torch.Tensor]`, *선택*, `output_attentions=True`가 전달되었거나 `config.output_attentions=True`인 경우 반환됨) -- 각 레이어마다 하나씩 포함된 `torch.Tensor`의 튜플로, 모양은 `(batch_size, num_heads, sequence_length, sequence_length)`입니다.

  self-attention 헤드에서 가중 평균을 계산하는 데 사용되는 attention softmax 이후의 attention 가중치입니다.
- **audio_hidden_states** (`torch.Tensor`, *선택 사항*) -- 투영 이후 오디오 인코더의 히든 스테이트입니다.

예:

```python
>>> from transformers import Nemotron3_5TranscribeForConditionalGeneration, AutoProcessor

>>> model_id = "nvidia/audio-flamingo-3-hf"
>>> processor = AutoProcessor.from_pretrained(model_id)
>>> model = Nemotron3_5TranscribeForConditionalGeneration.from_pretrained(model_id, device_map="auto")
```

#### get_audio_features[[transformers.Nemotron3_5TranscribeForConditionalGeneration.get_audio_features]]

```python
get_audio_features(input_features, input_features_mask, **kwargs)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L820)

**매개변수:**

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

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : 유효한 스펙트로그램 프레임의 마스크입니다. 패딩은 오른쪽에 있어야 합니다.

예:

```python
```

#### get_word_timestamp_logits[[transformers.Nemotron3_5TranscribeForConditionalGeneration.get_word_timestamp_logits]]

```python
get_word_timestamp_logits(asr_last_hidden_state: Tensor, input_features_mask: Tensor)
```

[소스](https://github.com/huggingface/transformers/blob/v5.23.0/src/transformers/models/nemotron3_5_transcribe/modeling_nemotron3_5_transcribe.py#L890)

**매개변수:**

asr_last_hidden_state (`torch.Tensor`, shape `(batch_size, num_frames, audio_config.hidden_size)`) : `input_features_mask`에 대해 [get_audio_features()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeForConditionalGeneration.get_audio_features)가 반환하는, 정규화 및 화자 임베딩 적용 전 음성 인식 인코더의 출력입니다.

input_features_mask (`torch.Tensor`, shape `(batch_size, feature_sequence_length)`) : 유효한 스펙트로그램 프레임의 마스크입니다. 패딩은 오른쪽에 있어야 합니다.

**반환값:**

`torch.Tensor`, shape `(batch_size, num_frames * word_timestamp_config.upsampling_factor, word_timestamp_config.vocab_size)`: alignment tokenizer 조각과 blank에 대한 raw logits, 인코더 프레임당 `upsampling_factor` 프레임 (프로세서가 log-softmax를 적용합니다).

음성 인식 인코더 상태에 대한 단어 timestamp 헤드의 Logits로, [align_word_timestamps()](/docs/transformers/v5.23.0/ko/model_doc/nemotron3_5_transcribe#transformers.Nemotron3_5TranscribeProcessor.align_word_timestamps)가 이를 단어 시간으로 변환합니다.

예:

```python
```

