Repository navigation
Add a Cosmos 3 Transfer README for the Shadow Hand camera task - #8731
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
…ride and a prompt is never read as a path
| * Removed the ``blur`` Cosmos control and ``blur_processor``, which no workflow used: the current Sim-Transfer | ||
| checkpoint is depth-trained, and blur was the only control the service had to copy between GPU and CPU. | ||
| * Removed the ``edge`` and ``seg`` Cosmos controls with their recipes and helpers (``edge_processor``, | ||
| ``regional_edge_processor``, ``segmentation_processor``, ``edge_control``, ``region_control``, |
There was a problem hiding this comment.
Why do we keep this information about edge, segment etc. This doesn't exist yet.
[Medium impact] The changes reach Cosmos camera workflows and Shadow Hand training across the repository. Fix MIG device matching before merging so the default transport does not break training on separate instances of one GPU. Findings
SummaryAdds the Shadow Hand Cosmos demo README and expands the underlying camera integration.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Camera capture] --> B[Prepare depth controls]
B --> C[Split views across services]
C --> D{Choose transport}
D -->|Socket| E[Send image arrays]
D -->|CUDA IPC| F[Share GPU buffers]
E --> G[Cosmos generates images]
F --> G
G --> H[Publish RGB to each camera]
H --> I[Train policy and feature extractor]
Reviews (1) · Last reviewed commit: "Merge the default-history docs" · Reviewed by Greptile |
| service_gpu = _cuda_ipc.device_by_bus_id(capabilities.get("pci_bus_id")) | ||
| if service_gpu is None: | ||
| reason = "this process cannot see the service's GPU" | ||
| elif not _cuda_ipc.can_access_peer(device.index or 0, service_gpu): | ||
| reason = "this GPU and the service's GPU cannot access each other's memory directly" | ||
| else: | ||
| self._service_device = torch.device("cuda", service_gpu) |
There was a problem hiding this comment.
MIG instances get mistaken identity
When the camera and service run on separate MIG instances of one GPU, auto can incorrectly choose CUDA IPC. Those instances share a PCI bus ID, so device_by_bus_id can resolve the service's ID to the camera's own instance. can_access_peer then accepts the matching local indices, even though the two instances cannot share memory.
Training fails while opening the shared buffers instead of falling back to socket. Exchange and match CUDA device UUIDs, including the MIG instance identity, before choosing CUDA IPC.
There was a problem hiding this comment.
Valid for two MIG slices of one GPU; doesn't affect full GPUs. Will switch the device match to CUDA UUIDs in a follow-up.
Description
Add a short README,
demos/cosmos3-transfer/README.md, that shows how to train the Shadow Hand camera task with Cosmos on its camera. It uses only the built-in commands fromcosmos_service.mdandcosmos.md: startisaaclab-cosmos-serverin one terminal, then runisaaclab train ... presets=cosmosin another, with the prompts set by an ordinary Isaac Lab override,env.cosmos.prompt, and each option explained. A separate section records a clip of both environments without mid-episode resets.Depends on #8492 and #8488.
A Linux run with the real model (two 48 GB MIG slices) trained with these commands before the latest review changes: both prompts appeared, and the socket transport and depth-range overrides took effect. It is being repeated on the final commits.
Checklist
pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched packageCONTRIBUTORS.mdor my name already exists there