We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 039d526 commit 86d1963Copy full SHA for 86d1963
tests/slow/test_sft_slow.py
@@ -412,12 +412,12 @@ def cleanup_liger_patches(trainer):
412
eval_dataset=self.eval_dataset,
413
)
414
415
- # Register cleanup now that we have the trainer
416
- self.addCleanup(cleanup_liger_patches, trainer)
417
-
418
- trainer.train()
419
420
- release_memory(trainer.model, trainer)
+ # Ensure cleanup of liger patches after the test
+ try:
+ trainer.train()
+ release_memory(trainer.model, trainer)
+ finally:
+ cleanup_liger_patches(trainer)
421
422
@parameterized.expand(list(itertools.product(MODELS_TO_TEST, PACKING_OPTIONS)))
423
@require_torch_accelerator
0 commit comments