mirror of
https://github.com/unslothai/unsloth.git
synced 2026-08-16 04:13:54 +00:00
* Add fast fast_inference GRPO smoke test for the vLLM LoRA rollout path Covers the vLLM >= 0.25.0 LoRA collision path (unsloth#7283, fixed in unsloth-zoo#919) with all seven attention and MLP projections as LoRA targets so both fused families (qkv_proj, gate_up_proj) are exercised. Kept tiny: the ungated unsloth/Qwen2.5-0.5B-Instruct, max_steps=1 (the collision triggers on the first rollout), short prompts/completions, and enforce_eager=True to skip CUDA graph capture. Runs in ~89s cold and ~37s on a warm torch.compile cache. Wrapped as a pytest test that skips without CUDA and still runs as a script; a length-based reward gives non-zero GRPO advantages; asserts the vLLM engine is attached at load and still bound on the trainer. Heavy imports are deferred into the test so CPU-only collection stays import-free. Co-authored-by: JoshuaL3000 <joshua.jian.ern.liew@intel.com> * Assert GRPO metrics and pin seed in fast_inference test Switch to unsloth/Qwen3-0.6B, disable vLLM torch.compile (compilation_config=0) and run 3 steps so the updated LoRA adapter is re-synced into vLLM on every step, not just loaded once. Pin GRPOConfig(seed=...), which TRL forwards to vLLM SamplingParams, so the run is reproducible, and assert per-step metrics (loss, grad_norm, completion length, reward, reward spread, kl) instead of only checking that train() returned. Verified across seeds 42/123/2024/7. * Correct the seed comment and drop the pytest return GRPOConfig(seed=...) does not reach vLLM SamplingParams: TRL's generation_kwargs carries no seed key. Reproducibility comes from the Trainer's set_seed pinning the global RNG the colocated sampler draws from, so describe that instead. Returning a value from a test triggers PytestReturnNotNoneWarning, which pytest intends to make an error; the value was unused. --------- Co-authored-by: danielhanchen <unslothai@gmail.com> |
||
|---|---|---|
| .. | ||
| test_fast_inference.py | ||