Skip to content

Commit 2434ca7

Browse files
committed
Replace signature inspection with explicit version check for liger-kernel
Use is_liger_kernel_available(min_version="0.6.6") instead of inspecting LigerFusedLinearGRPOLoss.forward signature. The version will be updated once linkedin/Liger-Kernel#1088 is released.
1 parent 97aaed2 commit 2434ca7

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

tests/test_grpo_trainer.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,6 @@
5858
from peft import LoraConfig, PeftModel, get_peft_model
5959

6060

61-
def _liger_supports_vllm_is_ratio():
62-
"""Check if the installed liger-kernel supports vllm_is_ratio parameter in LigerFusedLinearGRPOLoss."""
63-
try:
64-
import inspect
65-
66-
from liger_kernel.chunked_loss import LigerFusedLinearGRPOLoss
67-
68-
return "vllm_is_ratio" in inspect.signature(LigerFusedLinearGRPOLoss.forward).parameters
69-
except Exception:
70-
return False
71-
72-
7361
def multiply_tool(a: int, b: int) -> int:
7462
"""
7563
Multiplies two integers.
@@ -1002,8 +990,8 @@ def test_training_with_off_policy_mask_with_liger(self):
1002990

1003991
@require_liger_kernel
1004992
@pytest.mark.xfail(
1005-
not _liger_supports_vllm_is_ratio(),
1006-
reason="Requires vllm_is_ratio support in liger-kernel (linkedin/Liger-Kernel#1088)",
993+
not is_liger_kernel_available(min_version="0.6.6"),
994+
reason="Requires vllm_is_ratio support in liger-kernel >= 0.6.6 (linkedin/Liger-Kernel#1088)",
1007995
strict=True,
1008996
)
1009997
def test_compute_liger_loss_passes_vllm_is_ratio(self):

0 commit comments

Comments
 (0)