Fix more inefficient PT operations (#37060)
* Fix inefficient operations * Remove cpu() call * Reorder detach() * Reorder detach() * tolist without detach * item without detach * Update src/transformers/models/rag/modeling_rag.py Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com> * Update tests/models/encodec/test_modeling_encodec.py Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com> * Use detach().cpu().numpy * Revert some numpy operations * More fixes --------- Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com>
This commit is contained in:
@@ -540,7 +540,7 @@ class MimiIntegrationTest(unittest.TestCase):
|
||||
# use max bandwidth for best possible reconstruction
|
||||
encoder_outputs = model.encode(inputs["input_values"], num_quantizers=int(num_codebooks))
|
||||
|
||||
audio_code_sums = encoder_outputs[0].sum().cpu().item()
|
||||
audio_code_sums = encoder_outputs[0].sum().item()
|
||||
|
||||
# make sure audio encoded codes are correct
|
||||
# assert relative difference less than a threshold, because `audio_code_sums` varies a bit
|
||||
|
||||
Reference in New Issue
Block a user