chore: fix typos in the tests directory (#36813)

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* chore: fix typos in the tests

* fix: format codes

* chore: fix copy mismatch issue

* fix: format codes

* chore: fix copy mismatch issue

* chore: fix copy mismatch issue

* chore: fix copy mismatch issue

* chore: restore previous words

* chore: revert unexpected changes
This commit is contained in:
Afanti
2025-03-21 17:20:05 +08:00
committed by GitHub
parent 0adbc873d0
commit 26c83490d2
78 changed files with 181 additions and 148 deletions

View File

@@ -179,7 +179,10 @@ class EncoderDecoderMixin:
**kwargs,
):
encoder_model, decoder_model = self.get_encoder_decoder_model(config, decoder_config)
with tempfile.TemporaryDirectory() as encoder_tmp_dirname, tempfile.TemporaryDirectory() as decoder_tmp_dirname:
with (
tempfile.TemporaryDirectory() as encoder_tmp_dirname,
tempfile.TemporaryDirectory() as decoder_tmp_dirname,
):
encoder_model.save_pretrained(encoder_tmp_dirname)
decoder_model.save_pretrained(decoder_tmp_dirname)
model_kwargs = {"encoder_hidden_dropout_prob": 0.0}
@@ -306,7 +309,10 @@ class EncoderDecoderMixin:
out_2 = outputs[0].cpu().numpy()
out_2[np.isnan(out_2)] = 0
with tempfile.TemporaryDirectory() as encoder_tmp_dirname, tempfile.TemporaryDirectory() as decoder_tmp_dirname:
with (
tempfile.TemporaryDirectory() as encoder_tmp_dirname,
tempfile.TemporaryDirectory() as decoder_tmp_dirname,
):
enc_dec_model.encoder.save_pretrained(encoder_tmp_dirname)
enc_dec_model.decoder.save_pretrained(decoder_tmp_dirname)
enc_dec_model = EncoderDecoderModel.from_encoder_decoder_pretrained(