[UltraVox] Fix output type (#37224)

Signed-off-by: vasqu <antonprogamer@gmail.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Anton Vlasjuk
2026-03-17 15:51:17 +01:00
committed by GitHub
parent a836524d20
commit 2ff0ad9694
2 changed files with 9 additions and 6 deletions

View File

@@ -404,12 +404,14 @@ class UltravoxTransformerProjector(nn.Module, ModuleUtilsMixin):
kwargs["layer_head_mask"] = None
for layer in self.layers:
layer_outputs = layer(
hidden_states = layer(
hidden_states,
attention_mask=extended_attention_mask,
**kwargs,
)
hidden_states = layer_outputs[0]
# BC version that allows for the old tupled output
if isinstance(hidden_states, tuple):
hidden_states = hidden_states[0]
hidden_states = self.ln_post(hidden_states)
hidden_states = self.linear_out(hidden_states)
@@ -509,13 +511,14 @@ class ModifiedWhisperEncoder(WhisperEncoder):
kwargs["layer_head_mask"] = None
for encoder_layer in self.layers:
layer_outputs = encoder_layer(
hidden_states = encoder_layer(
hidden_states,
attention_mask,
**kwargs,
)
hidden_states = layer_outputs[0]
# BC version that allows for the old tupled output
if isinstance(hidden_states, tuple):
hidden_states = hidden_states[0]
hidden_states = self.layer_norm(hidden_states)
return hidden_states

View File

@@ -43,7 +43,6 @@ class UltravoxConfig(transformers.PretrainedConfig):
use `False`, but v0.5 and above use `True`.
"""
wrapped_model_config: transformers.PretrainedConfig
model_type = "ultravox"
audio_token = "<|audio|>"
is_composition = False
@@ -75,6 +74,7 @@ class UltravoxConfig(transformers.PretrainedConfig):
self.num_projector_layers = num_projector_layers
# N.B. May set the wrapped_model_config below.
self.wrapped_model_config: transformers.PretrainedConfig
self.text_model_id = text_model_id
if text_model_id is None:
text_config = text_config or {}