Skip to content

Parallel env tests: pin UNSLOTH_RETURN_LOGITS unset for the packing checks - #16594

Merged
danielhanchen merged 1 commit into
mainfrom
dh/parallel-env-return-logits-pin
Nov 3, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
dh/parallel-env-return-logits-pin

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Two context parallel packing tests in tests/test_parallel_env.py depend on whichever test ran before them in the same xdist worker. On staging CI for #16588, a LoRA decode PR that does not touch this code, Repo tests (CPU, rest) failed with:

tests/test_parallel_env.py::test_auto_keeps_packing_and_ring_turns_it_off
E   AssertionError: auto (Ulysses) must keep packing on
WARNING  unsloth.trainer:trainer.py:2030 Unsloth: packing=True ignored (UNSLOTH_RETURN_LOGITS=1).
tests/test_parallel_env.py::test_cp_x_tp_never_turns_padding_free_on_automatically

UNSLOTH_RETURN_LOGITS=1 turns packing off by design, so the trainer behaved correctly for the environment it saw. The tests never stated that they assume the variable is unset. An earlier test in the worker left it at 1, and both cases then checked a run where packing had already been switched off. The same thing reproduces on main:

tests/test_parallel_env.py on main result
clean environment 131 passed
UNSLOTH_RETURN_LOGITS=1 2 failed, 129 passed (the two cases above)

Change

tests/test_parallel_env.py only:

  • _auto_packing, the helper behind the auto-packing cases, now runs monkeypatch.delenv("UNSLOTH_RETURN_LOGITS").
  • UNSLOTH_RETURN_LOGITS joins _ENV, so clean_env also clears it.

monkeypatch restores any value that was there before. No product code changes.

Testing

tests/test_parallel_env.py on this branch: 131 passed with a clean environment, and 131 passed with UNSLOTH_RETURN_LOGITS=1 exported.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T20:38:34.545452Z e595bdb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: e595bdba38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 8d2d7b6 into main Nov 3, 2026
@danielhanchen
danielhanchen deleted the dh/parallel-env-return-logits-pin branch November 3, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant