Skip to content

tests: fix unreachable DeepSpeed+cpu_offload xfail in test_training_feature_matrix - #714

Open
UgaTheDev wants to merge 1 commit into
instructlab:mainfrom
UgaTheDev:fix/smoke-deepspeed-xfail-unreachable
Open

tests: fix unreachable DeepSpeed+cpu_offload xfail in test_training_feature_matrix#714
UgaTheDev wants to merge 1 commit into
instructlab:mainfrom
UgaTheDev:fix/smoke-deepspeed-xfail-unreachable

Conversation

@UgaTheDev

Copy link
Copy Markdown

In tests/smoke/test_train.py::test_training_feature_matrix, the DeepSpeed
branch was:

else:
    pytest.xfail("DeepSpeed not currently functional. OOMs during backprop.")
    if cpu_offload:
        pytest.xfail("DeepSpeed CPU Adam isn't currently building correctly")
    train_args.deepspeed_options.cpu_offload_optimizer = cpu_offload

pytest.xfail() raises immediately, so the if cpu_offload: block and the
cpu_offload_optimizer assignment below it could never run — both
DeepSpeed-parametrized cases (cpu_offload=True and cpu_offload=False)
always hit the same generic message and the more specific CPU-Adam reason was
dead code.

This reorders the checks so the cpu_offload=True case reports its own
specific, more accurate xfail reason, and only the cpu_offload=False case
falls through to the general "OOMs during backprop" one:

else:
    if cpu_offload:
        pytest.xfail("DeepSpeed CPU Adam isn't currently building correctly")
    pytest.xfail("DeepSpeed not currently functional. OOMs during backprop.")

Verified both xfail messages are now reachable by simulating the branch
logic standalone (can't run the real test without GPU hardware / the full
package installed):

cpu_offload=True: raised XFailed: DeepSpeed CPU Adam isn't currently building correctly
cpu_offload=False: raised XFailed: DeepSpeed not currently functional. OOMs during backprop.

Also confirmed the file still parses (python3 -m py_compile).

This is a test-only change — no non-test code touched, no new coverage
claimed, just makes the two existing xfail reasons distinguishable per the
docstring/#705 finding: "the second xfail below it for DeepSpeed plus CPU
offload... that block and the deepspeed_options.cpu_offload_optimizer
assignment after it are unreachable."

Originally flagged in #705 (comment from 2026-07-29).

pytest.xfail() raises immediately, so the nested 'if cpu_offload' xfail
and the cpu_offload_optimizer assignment after the first xfail() call
could never execute. Both DeepSpeed-parametrized cases always hit the
same generic 'OOMs during backprop' message, and the more specific
'CPU Adam isn't currently building correctly' reason was dead code.
Reorders the checks so cpu_offload=True reports its own reason and
cpu_offload=False falls through to the general one.

Ref: instructlab#705

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Kush Zingade <kush.zingade@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 69922ed7-78f1-49d2-adb2-268dc8e52568

📥 Commits

Reviewing files that changed from the base of the PR and between da76404 and 9431891.

📒 Files selected for processing (1)
  • tests/smoke/test_train.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant