Skip to content

[CI fix] Call Trainer.train directly in the profiler-close test - #6358

Merged
acisseJZhong merged 2 commits into
mainfrom
acisseJZhong/fix-trainer-train-wrapped
Nov 24, 2026
Merged

acisseJZhong merged 2 commits into
mainfrom
acisseJZhong/fix-trainer-train-wrapped

Conversation

@acisseJZhong

@acisseJZhong acisseJZhong commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

fix CI failing test

Agent details (AI-generated, to be reviewed by @acisseJZhong)

AI-generated by an AI agent on behalf of @acisseJZhong.

Why. CPU Unit Test fails on main since #6336:

FAILED tests/unit_tests/cpu/test_trainer.py::test_train_passes_failure_to_profiler_close[none|oom|wrapped_oom]
  AttributeError: 'function' object has no attribute '__wrapped__'

#6336 moved @record from Trainer.train to train.main, so Trainer.train.__wrapped__ no longer exists. The test (from #5679) only used __wrapped__ to bypass @record.

What changed. Test-only: call Trainer.train(trainer) instead of Trainer.train.__wrapped__(trainer).

Testing. pytest tests/unit_tests/cpu/test_trainer.py tests/unit_tests/cpu/test_train_main.py: 3 failed before, 59 passed after (torch 2.16.0.dev20261124+cpu).

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 24, 2026
@acisseJZhong
acisseJZhong marked this pull request as ready for review November 24, 2026 16:54
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 24, 2026
#6336 removed `@record` from `Trainer.train`, so `Trainer.train.__wrapped__`
no longer exists and `test_train_passes_failure_to_profiler_close` (added in
#5679) fails with `AttributeError: 'function' object has no attribute
'__wrapped__'`, breaking CPU Unit Test on main. The test only used
`__wrapped__` to bypass `@record`; call `Trainer.train` directly.

Test plan:
```
pytest tests/unit_tests/cpu/test_trainer.py tests/unit_tests/cpu/test_train_main.py
```
Before: 3 failed. After: 59 passed.

This PR was authored with an AI assistant.
@acisseJZhong
acisseJZhong force-pushed the acisseJZhong/fix-trainer-train-wrapped branch from 3973935 to 75076e4 Compare November 24, 2026 16:55
@acisseJZhong acisseJZhong changed the title [tests] Call Trainer.train directly in the profiler-close test [CI fix] Call Trainer.train directly in the profiler-close test Nov 24, 2026
@acisseJZhong
acisseJZhong merged commit 519624e into main Nov 24, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants