Skip to content

Commit

Permalink
Fix Stream Generator on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Walmsley committed Jun 14, 2024
1 parent dbf1a08 commit f5b81c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TTS/tts/layers/xtts/stream_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ def generate(
requires_attention_mask = "encoder_outputs" not in model_kwargs

if model_kwargs.get("attention_mask", None) is None and requires_attention_mask and accepts_attention_mask:
pad_token_tensor = torch.tensor([generation_config.pad_token_id], device=inputs_tensor.device) if generation_config.pad_token_id is not None else None
eos_token_tensor = torch.tensor([generation_config.eos_token_id], device=inputs_tensor.device) if generation_config.eos_token_id is not None else None
model_kwargs["attention_mask"] = self._prepare_attention_mask_for_generation(
inputs_tensor,
generation_config.pad_token_id,
generation_config.eos_token_id,
pad_token_tensor,
eos_token_tensor,
)

# decoder-only models should use left-padding for generation
Expand Down

0 comments on commit f5b81c9

Please sign in to comment.