Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VITS] Fix nightly tests #25986

Merged
merged 8 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tests/models/vits/test_modeling_vits.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
is_flaky,
is_torch_available,
require_torch,
require_torch_multi_gpu,
slow,
torch_device,
)
Expand Down Expand Up @@ -177,6 +178,30 @@ def test_model_forward(self):
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_model_forward(*config_and_inputs)

@require_torch_multi_gpu
# override to force all elements of the batch to have the same sequence length across GPUs
def test_multi_gpu_data_parallel_forward(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
config.use_stochastic_duration_prediction = False

# move input tensors to cuda:O
for key, value in inputs_dict.items():
if torch.is_tensor(value):
# make all elements of the batch the same -> ensures the output seq lengths are the same for DP
sanchit-gandhi marked this conversation as resolved.
Show resolved Hide resolved
value[1:] = value[0]
inputs_dict[key] = value.to(0)

for model_class in self.all_model_classes:
model = model_class(config=config)
model.to(0)
model.eval()

# Wrap model in nn.DataParallel
model = torch.nn.DataParallel(model)
set_seed(555)
with torch.no_grad():
_ = model(**self._prepare_for_class(inputs_dict, model_class)).waveform

@unittest.skip("VITS is not deterministic")
def test_determinism(self):
pass
Expand Down
3 changes: 2 additions & 1 deletion tests/models/vits/test_tokenization_vits.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def test_tokenizer_integration(self):
for tokenizer_class in tokenizer_classes:
tokenizer = tokenizer_class.from_pretrained(
"facebook/mms-tts-eng",
revision="089bbb15da46b2ab2b282145941399aae353d917", # to pin the tokenizer version
revision="28cedf176aa99de5023a4344fd8a2cc477126fb8", # to pin the tokenizer version
pad_token="<pad>",
)
sanchit-gandhi marked this conversation as resolved.
Show resolved Hide resolved

encoding = tokenizer(sequences, padding=True, normalize=True)
Expand Down
Loading