Repository navigation
Conversation
…ervice The Cosmos service served one camera view with fixed settings. It now: - batches up to --max-views camera views in one session, each with its own prompt, seed, VAE caches, and generation history; views reset on their own on the compiled runtime, and all together on the eager one; - accepts a list of prompts, cycled per episode for one view and assigned per view for several; a reset may bring the next episode's prompt; - takes its episode cap from --max-episode-frames (default 201, 0 for none); - uses the Sim-Transfer recipe's history window (--kv-window 30, --attention-sink 3) and its prompts as given, without an appended instruction to follow the control; - adds the blur control, filtered in the service by the Framework's own augmentor with the recipe's medium preset. The image transfer modifier lets a view that resets mid-chunk join the next chunk with its newest control, so all views keep one cadence. Signed-off-by: Alexander Temirov <atemirov@nvidia.com>
Address review follow-ups on the batched service: - Warmup ran 33 frames, which filled the old 8-latent window but not the default 30, leaving the full-history path to the first real episode. It now runs 1 + 4 * kv_window frames (121 by default), within the episode cap. - A closed batch stream keeps no references to its views' VAE caches. - Only the batch tests that need the CUDA device skip without one; the prompt merging and warmup tests run on CPU machines. Signed-off-by: Alexander Temirov <atemirov@nvidia.com>
…ix socket Every Cosmos step copied the camera's controls to the host, sent them over TCP, and copied the generated images back, with the service listening on a TCP port. - CUDA IPC transport: on the same Linux machine and GPU, the camera shares GPU buffers with the service once per session, one row per view, and interprocess CUDA events order each step; only a small message goes over the endpoint. The model accepts CUDA tensors for this path. CosmosModelCfg.transport selects auto (default), cuda_ipc, or socket. - Unix socket endpoints: the service and cameras default to /tmp/isaaclab-cosmos-<uid>.sock on Linux, owner-only, with no network port; tcp://host:port remains for other machines. The server takes --endpoint instead of --host and --port. - Small messages leave in one write with TCP_NODELAY, so they no longer wait 40 ms for a delayed acknowledgment, and a connection failure names the endpoint. Signed-off-by: Alexander Temirov <atemirov@nvidia.com>
Putting Cosmos on a task needed a task-specific preset. Now: - --cosmos on isaaclab train and play puts Cosmos on the task's rgb camera with --cosmos_prompt (repeat for a list), --cosmos_camera, --cosmos_control depth/edge/blur, --cosmos_near/--cosmos_far, --cosmos_endpoint, and --cosmos_transport. --num_envs N batches the environments' cameras on a service started with --max-views N. - apply_cosmos and cosmos_camera render the camera at the Cosmos canvas with the same aspect ratio and view, and center_crop_resize returns the generated image to the camera's size, so observations keep their shape. The camera captures every few steps when an episode would exceed the service's episode cap. - The Manager-based Shadow Hand camera task gets the cosmos preset of the Direct task. Signed-off-by: Alexander Temirov <atemirov@nvidia.com>
The feature extractor held each generated image's pose target by counting captures 1, 5, 9, which only matches when every view starts its episode together. Batched Cosmos views share one chunk cadence, so a view that resets mid-chunk shows black and then updates off that count. Hold each view's target until its image changes instead, leave black views out of the loss, and drop the one-environment check so both presets accept --num_envs and one --cosmos_prompt per environment.
Independent resets shift each environment's capture times, and every capture runs the Cosmos step for all views, so a camera slower than the environment step queued extra frames and ran views past their episode budget. Reject that combination in apply_cosmos and the Shadow Hand presets, and document the multi-environment setup: server without warmup and a smaller history window on 48 GB, per-step Shadow Hand captures, and recording every environment through the Newton GL streaming view.
After independent resets, environments with a camera slower than the environment step capture at different steps, but each capture ran the modifier for every view, queueing the skipped views' stale renders as new frames and exhausting their episode budget. Read the owning sensor's capture mask and queue a control only for the views it covers.
The image transfer modifier now queues controls only for the views each capture covers, so cameras slower than the environment step batch several environments correctly. Remove the guard, keep the Shadow Hand presets at their 10 Hz camera, and document recording every environment.
# Conflicts: # source/isaaclab_tasks/changelog.d/cosmos-session-settings.fixed.rst
…ides, and simplify the service check
Contributor
Author
|
Closing: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Split one camera's environments across several Cosmos services, for example one per GPU, so a training run can use more than one GPU for generation.
Depends on #8461.
uv run isaaclab train --task Isaac-Reorient-Cube-Shadow-Camera-Direct --rl_library rsl_rl --num_envs 4 \ presets=cosmos \ env.cosmos.endpoint="['unix:///tmp/isaaclab-cosmos-gpu1.sock', 'unix:///tmp/isaaclab-cosmos-gpu2.sock']" \ env.cosmos.transport=cuda_ipcCosmosModelCfg.endpointtakes a list, and so doesenv.cosmos.endpoint. The environments are split into contiguous shares of near-equal size, one per service in the order given (8 environments on 3 services: 0-2, 3-5, 6-7). Each environment stays on its service, which keeps its generation history, and keeps its prompt,prompt[v % len(prompt)]by its index in the camera. A service with a single environment keeps that prompt too, instead of cycling the list per episode.apply_cosmoschecks that every service is running and idle, requires compiled inference only on a service with several environments, and rejects fewer environments than services.Review
cosmos_model.pyfirst:split_views,_ShardedStream, and the_send/_receivesplit. The old step body is reindented, so the diff is easier to read ignoring whitespace. Thenapply_cosmos.Compatibility
One endpoint behaves as before. The protocol and the service are unchanged: each service sees an ordinary session for its share. Each service loads its own copy of the model, so every GPU needs memory for the model and its share's generation histories. A service on another GPU uses CUDA IPC only with peer access (#8461); otherwise
autouses the socket.Validation
The GPU runs below were measured before the Cosmos options moved from command-line flags to configuration overrides and
apply_cosmosarguments, and have not been repeated. The rewritten unit tests (test_cosmos_any_task.pyand the Cosmos sensor and Shadow Hand tests) pass on Windows. A Linux run of the whole stack with the real model (two 48 GB MIG slices) trained the Shadow Hand task before the latest review changes; it is being repeated on the final commits.On two NVIDIA L40 GPUs with PCIe peer access (no NVLink), with #8461's fix:
test_cosmos.py(the split; two local services with stand-in models receiving their own views, seeds, prompts, and remapped resets; a failure on either service closing both sessions) andtest_cosmos_any_task.py(a list of endpoints, the per-service checks, too few environments) passed, none skipped.cuda_ipc: iterations of 20.3, 20.2, and 20.5 s, close to one environment on one service. These are short runs, not a benchmark.ConnectionError, and the GPU 0 service closed its session.Rerun on the final commit:
test_cosmos.py55 andtest_cosmos_any_task.py14 passed, none skipped. Two environments on one eager service per GPU: three iterations of 20.2, 22.9, and 20.8 s. Stopping the GPU 1 service after the first iteration ended training with aConnectionError4 s later; the GPU 0 service then reported no active session and accepted a new session that generated a 640×640 image. A session that fails while awaiting its reply keeps its controls, which its service may still read. No GPU processes remained. Scaling beyond two GPUs is untested.Checklist
pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched packageCONTRIBUTORS.mdor my name already exists there