Skip to content

refactor(miles): drop redundant num_gpus=1 in RLix train actor decorator#30

Open
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:tianye/f12-actor-group-num-gpus-dedup
Open

refactor(miles): drop redundant num_gpus=1 in RLix train actor decorator#30
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:tianye/f12-actor-group-num-gpus-dedup

Conversation

@TianyeGGBond

Copy link
Copy Markdown

Context

In the F12 shared-PG / RLix-mode train path, RayTrainGroup._allocate_gpus_via_placements builds each train actor like this:

TrainRayActor = ray.remote(num_gpus=1, runtime_env={"env_vars": env_vars})(actor_impl)
actor = TrainRayActor.options(
    num_cpus=num_gpus_per_actor,
    num_gpus=num_gpus_per_actor,   # <- always overrides the decorator
    scheduling_strategy=...,
).remote(...)

.options(num_gpus=num_gpus_per_actor) is applied on every single use, so the num_gpus=1 in the ray.remote(...) decorator is never the effective value. It is dead, and worse it is misleading: a reviewer sees num_gpus=1 in the decorator and num_gpus=num_gpus_per_actor (0 in RLix mode) in .options() and has to reason about which one wins.

Change

  • miles/ray/actor_group.py: remove num_gpus=1 from the ray.remote(...) decorator. GPU resource is now declared in exactly one place — .options().

Impact

None. .options() already overrode the decorator on every code path, so effective scheduling behavior is byte-for-byte identical. This is a readability-only change.

The ray.remote(num_gpus=1) decorator value is immediately overridden by
.options(num_gpus=num_gpus_per_actor) on every use, so the 1 is dead and
misleading. Declare GPU resources only in .options().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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