Skip to content

Remove the legacy torchtitan.components.lr_scheduler import path - #4172

Merged
ivy-zhou merged 1 commit into
pytorch:mainfrom
ivy-zhou:pr4172
Aug 18, 2026
Merged

ivy-zhou merged 1 commit into
pytorch:mainfrom
ivy-zhou:pr4172

Conversation

@ivy-zhou

@ivy-zhou ivy-zhou commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
components/lr_scheduler.py became a re-export shim when the optimizer
components were grouped into a package. Keeping it means every importer can
pick either path, and the two-path state is the thing reviewers flagged: the
shim exists only so unrelated files did not have to change in that diff, not
because either path is meaningfully better.

Delete the shim and move all 17 importers to
torchtitan.components.optimizer. Every one of them already imported
something else from that package -- default_adamw, OptimizersContainer,
ParamGroupConfig -- so each becomes a single combined import rather than two
adjacent ones, which is what the package re-export was for.

torchtitan.components.optimizer.lr_scheduler is untouched and remains the
module that defines LRSchedulersContainer; only the components.lr_scheduler
alias is gone. Files updated span all model variants (llama3, qwen3, qwen3_5,
deepseek_v3, gpt_oss, kimi_k2_7, muse_glimmer, flux) plus the forge, torchft,
transformers_modeling_backend, and rl experiments.

This is an import-path change only; no runtime behavior changes.

Test Plan:
pytest tests/unit_tests/test_lr_scheduler.py tests/unit_tests/test_optimizer_param_groups.py tests/unit_tests/test_checkpoint.py tests/unit_tests/test_state_dict_keys.py:
72 passed, 2 subtests passed.

Dropped TestLRScheduler.test_legacy_import_path, which asserted the shim
resolved to the same object; it cannot outlive the shim.
test_optimizer_package_import_path still covers the surviving contract, that
the package re-export is the same object as the submodule definition.

Also verified:

  • No components.lr_scheduler references remain anywhere in the repo
    (py, md, yaml, toml, txt).
  • import torchtitan.components.lr_scheduler now raises ModuleNotFoundError.
  • All 17 touched modules byte-compile, and the 10 whose optional dependencies
    are installed import cleanly. The other 6 fail only on absent optional
    packages (fla, transformers, vllm), unrelated to this change.
  • ufmt and flake8 --config=.flake8 clean on the changed files.

Stack created with Sapling. Best reviewed with ReviewStack.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 17, 2026
ivy-zhou added a commit that referenced this pull request Aug 17, 2026
Summary:
@tianyu-l asked for a dedicated folder for the optimizer components, and
both
@fegin and @tianyu-l pointed out that `checkpoint_utils.py` is not an
optimizer
module even though three of its four public functions are
optimizer-only.

Split it on that line and group the result:

components/optimizer.py -> components/optimizer/optimizer.py
components/lr_scheduler.py -> components/optimizer/lr_scheduler.py
  components/checkpoint_utils.py:optimizer state helpers
-> components/optimizer/utils.py

`init_optim_state`, `get_flat_optim_state_dict`, and
`load_flat_optim_state_dict`
all take a `torch.optim.Optimizer`, so they move. `canonical_fqn(name:
str, ...)`
does not: it strips activation-checkpoint wrapper segments from a dotted
FQN and
is a checkpointing concern. It stays in `components/checkpoint_utils.py`
here and
moves to `components/checkpointer/utils.py` in the next change, which is
the one
that creates that folder, so it only ever moves once.

Nothing outside the package has to change its imports:

- `components/optimizer/__init__.py` re-exports `OptimizersContainer`,
`ParamGroupConfig`, `default_adamw`, `register_moe_load_balancing_hook`,
and
`LRSchedulersContainer`, so `torchtitan.components.optimizer` keeps
working and
  the scheduler now comes from the same short path as the container.
- `components/lr_scheduler.py` and `components/checkpoint_utils.py` stay
as
  forwarding modules for their old names.

EMA has no module today, so there is nothing to move for it yet.

Test Plan:
`pytest tests/unit_tests/test_checkpoint.py
tests/unit_tests/test_state_dict_keys.py
tests/unit_tests/test_lr_scheduler.py
tests/unit_tests/test_optimizer_param_groups.py`
passes (68 tests) at this commit, in a venv matching the CPU CI job.

`torchtitan.trainer` and `torchtitan.components.optimizer` both import
standalone
at this commit. `flake8` and `ufmt` (pinned black 22.12.0 / usort 1.0.5,
matching
`.pre-commit-config.yaml`) are clean on the changed files.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/torchtitan/pull/4140).
* #4172
* #4058
* #4141
* __->__ #4140
@ivy-zhou
ivy-zhou force-pushed the pr4172 branch 2 times, most recently from 4bfae5c to 14ab0a2 Compare August 17, 2026 19:45
ivy-zhou added a commit that referenced this pull request Aug 17, 2026
Summary:
Introduce a dependency-neutral checkpoint manager contract for
TorchTitan and
group the checkpointing modules under `components/checkpointer/`.

`BaseCheckpointManager(Configurable, ABC)` owns the trainer-facing
checkpoint
policy as its nested `Config`, the runtime contract as
`@abstractmethod`s, the
checkpoint item names, and the model-state wrapper shared by concrete
managers.
Keeping the config nested matches how every other Configurable works:
`Configurable.__init_subclass__` sets `Config._owner` on the class that
declares
it and `build()` constructs `_owner`, so selecting a config selects its
manager.
A config declared outside a manager could not be built at all.

Making the contract an abstract base rather than a `Protocol` means a
manager
that omits a method fails at class definition instead of at call time,
and
extension is the same shape as the rest of the repo: subclass, declare
`class Config(BaseCheckpointManager.Config)` with any extra fields, and
`_owner`
auto-wires.

Module layout, using the short names @tianyu-l asked for:

components/checkpoint.py -> components/checkpointer/dcp.py
components/checkpoint_utils.py:canonical_fqn ->
components/checkpointer/utils.py
(new) -> components/checkpointer/base.py

`checkpointer/__init__.py` re-exports the public names and
`components/checkpoint.py` stays as a forwarding module, so call sites
outside
this folder are untouched.

That re-export is only possible because `dcp.py` now imports
`OptimizersContainer`,
`LRSchedulersContainer`, `BaseDataLoader`, and `nn` under
`TYPE_CHECKING`. They
appear only in annotations, and importing them at runtime would close a
cycle:
`optimizer` -> `checkpointer.utils` -> `checkpointer/__init__` -> `dcp`
->
`optimizer`. Importing a submodule runs the package init first, so there
is no
way to re-export the managers while that runtime edge exists.

Keep the existing DCP `CheckpointManager` as the default implementation
while its
config defines only the DCP-specific `async_mode`; all shared fields and
validation live in the base config. `Trainer.checkpointer` is typed as
`BaseCheckpointManager` and its config field as
`BaseCheckpointManager.Config`
with `CheckpointManager.Config` as the default factory, so an
independent manager
can be selected without adding backend branches. Model config registries
keep
naming the concrete class. TorchFT remains explicitly tied to the legacy
DCP
implementation.

Two follow-on fixes the rename requires:

- Checkpoint tests patch `torch.distributed.checkpoint` functions
directly with
`mock.patch.object`, avoiding relocation-sensitive paths through the
local
  `dcp` alias, including the TorchFT async-save test.
- The TorchFT workflows filtered on
`torchtitan/components/checkpoint.py`, so
  they would have stopped triggering; they now filter on
  `torchtitan/components/checkpointer/**`.

Test Plan:
`pytest tests/unit_tests/test_checkpoint.py
tests/unit_tests/test_state_dict_keys.py
tests/unit_tests/test_lr_scheduler.py
tests/unit_tests/test_optimizer_param_groups.py`
passes (73 tests) at this commit, in a venv matching the CPU CI job.

`torchtitan.trainer` and `torchtitan.components.optimizer` import
standalone at
this commit, confirming the cycle is gone. `flake8` and `ufmt` are clean
on the
changed files.

Also verified:
- `BaseCheckpointManager.__abstractmethods__` is
`{load, save, maybe_wait_for_staging, close}`; the base cannot be
instantiated.
- `CheckpointManager` subclasses the base and `Config._owner` resolves
to it;
  `async_mode` stays on the DCP config only.
- A throwaway subclass with an extra config field builds via
`Config(...).build()`
  and returns that subclass; inherited validation still raises on
  `keep_latest_k=1`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/torchtitan/pull/4141).
* #4172
* #4058
* __->__ #4141
ivy-zhou added a commit that referenced this pull request Aug 17, 2026
Summary:
Introduce `TorchCheckpointingManager` as an independent `Configurable`
component
rather than adding backend selectors and branches to the legacy DCP
`CheckpointManager`.

`TorchCheckpointingManager.Config` intentionally adds no fields beyond
`BaseCheckpointManager.Config`, but it must still be declared:
`Config._owner` is
set on the class that declares it, so a subclass that inherited `Config`
unchanged would build the abstract base. It remains buildable for
`Trainer`
construction, while `TorchCheckpointingManager` constructs its fixed
`torch_checkpointing` backend internally. The backend supplies the model
and
optimizer DTensor resharding schema, pinned-memory async staging, and
the
TorchTitan TCPStore barrier without exposing backend resharders or
callbacks
through TorchTitan configuration or Tyro.

The manager lives at `components/checkpointer/torch_checkpointing.py`,
named to
match its siblings `base.py` and `dcp.py`. It is not re-exported from
`checkpointer/__init__.py`; it is selected by config, not by import.

When checkpointing is disabled, `load`, `save`, and
`maybe_wait_for_staging` are
no-ops, matching the DCP manager. When it is enabled they raise
`NotImplementedError`: the routing lands in later changes, and they are
stubbed
rather than omitted because `BaseCheckpointManager` declares them
abstract, so a
partial implementation could not be instantiated at all.

`torch_checkpointing` moves from an optional extra to a required
dependency in
`pyproject.toml`, superseding the optional-dependency arrangement added
in
#4123. Note this makes it the only core dependency with an unconditional
`torch` requirement (`torch>=2.6.0`); the others declare torch only
under
extras. `pip install torchtitan` will therefore pull a stable torch
wheel,
which users who installed a nightly first should be aware of.

It is deliberately NOT added to `.ci/docker/requirements.txt`. That file
is
symlinked from the repo root, so one entry feeds both the Docker image
build
and the lint job, and it is installed with dependencies -- which would
drag a
stable torch into an image whose stated invariant is that it ships no
torch and
every job installs a nightly. The image already installs the library,
from git
`@main` with `--no-deps`, in `.ci/docker/common/install_conda.sh`. The
lint job
needs it importable too, because pyrefly type-checks
`components/checkpointer/torch_checkpointing.py`, so it gets the same
`--no-deps` install, ordered after the nightly torch install so it
cannot
displace it.

Selecting `TorchCheckpointingManager.Config` selects the implementation;
the
legacy manager and its config remain unchanged.

Rebased onto main at 0d2438f ("Add remat as an optional dependency",
#4163). That change added a `remat` optional-dependency group
immediately after
the `torch-checkpointing` group this commit deletes, so the two collided
in
`pyproject.toml`; the resolution keeps `remat` and drops
`torch-checkpointing`,
which is this commit's intent unchanged.

Test Plan:
`pytest tests/unit_tests` at the top of the rebased stack: 624 passed,
18
failed. Every failure reproduces identically on unmodified `remote/main`
(0d2438f) in the same environment, so none are attributable to this
change.
They split into missing optional dependencies (`transformers` for the
flux
config and dataset tests, `fla` for the qwen3.5 rope test) and
environment-specific kernel/compile failures (14 helion rope tests, one
inductor C++ compile error in lora).

Scoped to the code this stack touches -- `test_checkpoint`,
`test_state_dict_keys`, `test_lr_scheduler`, `test_torch_checkpointing`,
`test_config_manager` -- 85 passed, with only the known `transformers`
failure.

Also verified:
- `TorchCheckpointingManager` subclasses `BaseCheckpointManager` and its
  `Config._owner` resolves to itself.
- `torchtitan.components.checkpointer.torch_checkpointing` imports
standalone.
- The resolved `pyproject.toml` parses under `tomllib`, with
`torch_checkpointing>=0.1.0` in the core dependency list and the
optional
  groups reduced to exactly `dev` and `remat`.
- `ufmt` and `codespell` clean on the changed files; `flake8
--config=.flake8`
  clean apart from one `F824` in `graph_trainer/simple_fsdp.py` that is
  pre-existing on main and untouched here.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/torchtitan/pull/4058).
* #4173
* #4172
* __->__ #4058
Summary:
`components/lr_scheduler.py` became a re-export shim when the optimizer
components were grouped into a package. Keeping it means every importer can
pick either path, and the two-path state is the thing reviewers flagged: the
shim exists only so unrelated files did not have to change in that diff, not
because either path is meaningfully better.

Delete the shim and move all 17 importers to
`torchtitan.components.optimizer`. Every one of them already imported
something else from that package -- `default_adamw`, `OptimizersContainer`,
`ParamGroupConfig` -- so each becomes a single combined import rather than two
adjacent ones, which is what the package re-export was for.

`torchtitan.components.optimizer.lr_scheduler` is untouched and remains the
module that defines `LRSchedulersContainer`; only the `components.lr_scheduler`
alias is gone. Files updated span all model variants (llama3, qwen3, qwen3_5,
deepseek_v3, gpt_oss, kimi_k2_7, muse_glimmer, flux) plus the forge, torchft,
transformers_modeling_backend, and rl experiments.

This is an import-path change only; no runtime behavior changes.

Test Plan:
`pytest tests/unit_tests/test_lr_scheduler.py
tests/unit_tests/test_optimizer_param_groups.py
tests/unit_tests/test_checkpoint.py tests/unit_tests/test_state_dict_keys.py`:
72 passed, 2 subtests passed.

Dropped `TestLRScheduler.test_legacy_import_path`, which asserted the shim
resolved to the same object; it cannot outlive the shim.
`test_optimizer_package_import_path` still covers the surviving contract, that
the package re-export is the same object as the submodule definition.

Also verified:
- No `components.lr_scheduler` references remain anywhere in the repo
  (py, md, yaml, toml, txt).
- `import torchtitan.components.lr_scheduler` now raises `ModuleNotFoundError`.
- All 17 touched modules byte-compile, and the 10 whose optional dependencies
  are installed import cleanly. The other 6 fail only on absent optional
  packages (`fla`, `transformers`, `vllm`), unrelated to this change.
- `ufmt` and `flake8 --config=.flake8` clean on the changed files.
@ivy-zhou
ivy-zhou marked this pull request as ready for review August 17, 2026 21:07
@ivy-zhou
ivy-zhou merged commit 203f9a8 into pytorch:main Aug 18, 2026
48 of 52 checks passed
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Aug 19, 2026
…imizer

Upstream pytorch#4172 deleted torchtitan/components/lr_scheduler.py. It had become a
re-export shim when pytorch#4140 grouped the optimizer components into a package, so
LRSchedulersContainer now lives in torchtitan.components.optimizer.

Four ezpz registries imported the deleted path: agpt, moe, and the two RL
config registries. Without this every one of them fails at import, which is
the same failure shape as pytorch#4045 (maybe_enable_async_tp) and pytorch#3996
(wire_meshes tp_mesh) -- upstream removes a path, ezpz overrides still name it.

components.optimizer itself survives as a package, so the five other ezpz
files importing default_adamw / OptimizersContainer / ParamGroupConfig need
no change.

Verified: 0 unresolvable torchtitan imports and 0 syntax errors across all
ezpz .py files on the merged tree.
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Aug 19, 2026
…ytorch#4085

Records the full arc: merge 210282f, PRE/POST paired verification, and the
four distinct breakages that pytorch#4085 (spmd_types as default) produced -- mesh
name, unconditional model.parallelize, dual mesh_info flattening, and the
unannotated RoPE cache buffer -- plus pytorch#4172's deleted lr_scheduler shim.

Final state: dense path (agpt2b, agpt2b-tp2) verified 20/20 across four POST
runs, matching PRE. moe-2b-det now passes where it VOIDed pre-merge. MoE sweep
has 5 configs passing that previously all failed on the same rope error.

Also records that moe_10b_2b_sdpa passes at its own default EP and only fails
under my forced EP=12 -- a flag error, not a config defect.
ivy-zhou added a commit that referenced this pull request Aug 20, 2026
Summary:
`components/checkpoint.py` is the last of the three re-export shims left
behind
when the checkpointer was grouped into a package, after the lr_scheduler
shim
in #4172 and checkpoint_utils in the preceding change. With it gone
there are
no compatibility shims left under `torchtitan/components/`.

This one is a pure module rename at the callsite.
`checkpointer/__init__.py` already re-exports exactly the same eight
symbols
the shim forwarded -- `AsyncMode`, `CheckpointManager`, `ModelWrapper`,
and the
`MODEL` / `OPTIMIZER` / `LR_SCHEDULER` / `DATALOADER` / `TRAIN_STATE`
key
constants -- so every importer changes only the module it names, with
the
imported names and their grouping untouched. Verified by parsing each
importer
and checking every imported symbol against the package's `__all__`
before
touching anything; nothing referenced a symbol the package does not
expose, and
no callsite used the plain `import torchtitan.components.checkpoint`
form.

Thirty modules are updated, spanning the checkpoint-conversion scripts,
the
forge, torchft, graph_trainer and rl experiments, and the unit tests. A
thirty-first file, `experiments/rl/__init__.py`, carries the import
inside its
module docstring as a usage example; that is updated too, so the
documented
path matches the working one.

This is an import-path change only; no runtime behavior changes.

Test Plan:
Full `pytest tests/unit_tests` (excluding `test_rope.py`, which cannot
be
collected without the optional `fla` package): 622 passed, 18 failed.
The 18
are the same set that fails on unmodified main in this environment --
missing
optional dependencies (`transformers`, `fla`) and environment-specific
kernel/compile failures (helion rope, inductor lora).

Also verified:
- No `components.checkpoint` references remain anywhere in the repo,
across all
  file types, and no `Compatibility imports` shim remains under
  `torchtitan/components/`.
- `import torchtitan.components.checkpoint` now raises
`ModuleNotFoundError`.
- All eight symbols import cleanly from
`torchtitan.components.checkpointer`.
- All 31 changed files byte-compile, and the affected non-test modules
(`trainer`, `forge.engine`, `torchft.checkpoint`, `torchft.optimizer`,
both
checkpoint-conversion scripts) import cleanly. `experiments.rl` fails
only on
  the absent optional `vllm` package, unrelated to this change.
- `ufmt` and `flake8 --config=.flake8` clean on all 31 files.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/torchtitan/pull/4184).
* #4240
* #4230
* #4191
* #4190
* #4189
* #4188
* #4197
* #4187
* #4186
* #4185
* __->__ #4184
ivy-zhou added a commit that referenced this pull request Aug 20, 2026
…4185)

Summary:
`components/checkpoint_utils.py` became a re-export shim when the
optimizer and
checkpointer components were grouped into packages. Unlike the
lr_scheduler
shim removed in #4172, this one forwarded to two different destinations
at
once, which is what made it worth deleting rather than keeping: reading
an
import of `checkpoint_utils` told you nothing about whether the symbol
was
optimizer plumbing or checkpointer plumbing.

Route each of the four importers to the module that actually defines the
symbol. `canonical_fqn` lives in `checkpointer/utils.py`;
`init_optim_state`,
`get_flat_optim_state_dict`, and `load_flat_optim_state_dict` live in
`optimizer/utils.py`. This also settles the naming objection fegin
raised on
#4140, that `canonical_fqn` does not belong under an optimizer-shaped
name --
its importer in the rl trainer now names the checkpointer package
directly.

The three state-dict helpers are imported from `optimizer.utils` rather
than
re-exported through `optimizer/__init__.py`. They are low-level DCP
plumbing
with two callers between them, not part of the package's public surface,
which
stays `OptimizersContainer`, `LRSchedulersContainer`,
`ParamGroupConfig`, and
`default_adamw`.

This is an import-path change only; no runtime behavior changes.

Test Plan:
`pytest tests/unit_tests/test_state_dict_keys.py
tests/unit_tests/test_checkpoint.py
tests/unit_tests/test_lr_scheduler.py
tests/unit_tests/test_optimizer_param_groups.py
tests/unit_tests/test_torch_checkpointing.py`: 77 passed, 4 subtests
passed.

`test_legacy_checkpoint_utils_imports`, which asserted the shim's
symbols were
identical to the submodule's, is dropped -- it cannot outlive the shim.

`test_legacy_checkpoint_utils_can_be_imported_first` is kept but
retargeted, as
`test_state_dict_helpers_can_be_imported_first`. It guards a real
property
rather than the shim: the `optimizer` and `checkpointer` package
`__init__`
files import from each other, so importing either leaf `utils` module
first in
a fresh interpreter must not close an import cycle. It now subtests both
leaf
modules instead of the single shim.

Also verified:
- No `checkpoint_utils` references remain anywhere in the repo, across
all file
  types, not only Python.
- `import torchtitan.components.checkpoint_utils` now raises
  `ModuleNotFoundError`.
- `ufmt` and `flake8 --config=.flake8` clean on the four changed files.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/torchtitan/pull/4185).
* #4240
* #4230
* #4191
* #4190
* #4189
* #4188
* #4197
* #4187
* #4186
* __->__ #4185
* #4184
ivy-zhou added a commit that referenced this pull request Aug 20, 2026
…4241)

Summary:
`components/checkpoint_utils.py` became a re-export shim when the
optimizer and
checkpointer components were grouped into packages. Unlike the
lr_scheduler
shim removed in #4172, this one forwarded to two different destinations
at
once, which is what made it worth deleting rather than keeping: reading
an
import of `checkpoint_utils` told you nothing about whether the symbol
was
optimizer plumbing or checkpointer plumbing.

Route each of the four importers to the module that actually defines the
symbol. `canonical_fqn` lives in `checkpointer/utils.py`;
`init_optim_state`,
`get_flat_optim_state_dict`, and `load_flat_optim_state_dict` live in
`optimizer/utils.py`. This also settles the naming objection fegin
raised on
#4140, that `canonical_fqn` does not belong under an optimizer-shaped
name --
its importer in the rl trainer now names the checkpointer package
directly.

The three state-dict helpers are imported from `optimizer.utils` rather
than
re-exported through `optimizer/__init__.py`. They are low-level DCP
plumbing
with two callers between them, not part of the package's public surface,
which
stays `OptimizersContainer`, `LRSchedulersContainer`,
`ParamGroupConfig`, and
`default_adamw`.

This is an import-path change only; no runtime behavior changes.

Test Plan:
`pytest tests/unit_tests/test_state_dict_keys.py
tests/unit_tests/test_checkpoint.py
tests/unit_tests/test_lr_scheduler.py
tests/unit_tests/test_optimizer_param_groups.py
tests/unit_tests/test_torch_checkpointing.py`: 77 passed, 4 subtests
passed.

`test_legacy_checkpoint_utils_imports`, which asserted the shim's
symbols were
identical to the submodule's, is dropped -- it cannot outlive the shim.

`test_legacy_checkpoint_utils_can_be_imported_first` is kept but
retargeted, as
`test_state_dict_helpers_can_be_imported_first`. It guards a real
property
rather than the shim: the `optimizer` and `checkpointer` package
`__init__`
files import from each other, so importing either leaf `utils` module
first in
a fresh interpreter must not close an import cycle. It now subtests both
leaf
modules instead of the single shim.

Also verified:
- No `checkpoint_utils` references remain anywhere in the repo, across
all file
  types, not only Python.
- `import torchtitan.components.checkpoint_utils` now raises
  `ModuleNotFoundError`.
- `ufmt` and `flake8 --config=.flake8` clean on the four changed files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl ciflow/8gpu 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