mirror of
https://github.com/huggingface/trl.git
synced 2025-10-20 18:43:52 +08:00
Replace unittest skipTest with pytest.skip (#4263)
This commit is contained in:
committed by
GitHub
parent
7e0adbc552
commit
ef40c047aa
@ -329,11 +329,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
|
||||
assert lora_params_changed, "No LoRA parameters were updated during training."
|
||||
|
||||
except torch.OutOfMemoryError as e:
|
||||
self.skipTest(f"Skipping VLM training test due to insufficient GPU memory: {e}")
|
||||
pytest.skip(f"Skipping VLM training test due to insufficient GPU memory: {e}")
|
||||
except Exception as e:
|
||||
# Check for other memory-related errors
|
||||
if any(keyword in str(e).lower() for keyword in ["memory", "cuda", "out of memory", "insufficient"]):
|
||||
self.skipTest(f"Skipping VLM training test due to hardware constraints: {e}")
|
||||
pytest.skip(f"Skipping VLM training test due to hardware constraints: {e}")
|
||||
else:
|
||||
raise
|
||||
|
||||
@ -474,11 +474,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
|
||||
"decrease gpu memory",
|
||||
]
|
||||
):
|
||||
self.skipTest(f"Skipping vLLM colocate test due to hardware constraints: {e}")
|
||||
pytest.skip(f"Skipping vLLM colocate test due to hardware constraints: {e}")
|
||||
elif "KeyError" in str(e) and "RANK" in str(e):
|
||||
self.skipTest(f"Skipping vLLM colocate test due to environment setup issues: {e}")
|
||||
pytest.skip(f"Skipping vLLM colocate test due to environment setup issues: {e}")
|
||||
elif "ValueError" in str(e) and "memory" in str(e).lower():
|
||||
self.skipTest(f"Skipping vLLM colocate test due to memory constraints: {e}")
|
||||
pytest.skip(f"Skipping vLLM colocate test due to memory constraints: {e}")
|
||||
else:
|
||||
raise
|
||||
finally:
|
||||
@ -541,11 +541,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
|
||||
"decrease gpu memory",
|
||||
]
|
||||
):
|
||||
self.skipTest(f"Skipping vLLM training test due to hardware constraints: {e}")
|
||||
pytest.skip(f"Skipping vLLM training test due to hardware constraints: {e}")
|
||||
elif "KeyError" in str(e) and "RANK" in str(e):
|
||||
self.skipTest(f"Skipping vLLM training test due to environment setup issues: {e}")
|
||||
pytest.skip(f"Skipping vLLM training test due to environment setup issues: {e}")
|
||||
elif "ValueError" in str(e) and "memory" in str(e).lower():
|
||||
self.skipTest(f"Skipping vLLM training test due to memory constraints: {e}")
|
||||
pytest.skip(f"Skipping vLLM training test due to memory constraints: {e}")
|
||||
else:
|
||||
raise
|
||||
|
||||
|
@ -259,7 +259,7 @@ class TestGKDTrainer(TrlTestCase):
|
||||
|
||||
# Ensure liger fused JSD path is enabled; if not, skip (runtime may lack system libs)
|
||||
if not getattr(trainer, "use_liger_gkd_loss", False):
|
||||
self.skipTest("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
|
||||
pytest.skip("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
|
||||
|
||||
trainer.train()
|
||||
|
||||
|
Reference in New Issue
Block a user