You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit aea5c53
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/bridge-rl-integration.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,7 +352,28 @@ for name, weight in bridge.export_hf_weights(megatron_model, cpu=True, show_prog
352
352
353
353
Point your inference engine (e.g., vLLM) to `"/path/to/hf_export"`.
354
354
355
-
### B) Zero-copy streaming via ZMQ (fast refit, colocated)
355
+
### B) Pipeline-stage-local streaming for RL weight synchronization
356
+
357
+
When inference workers collectively receive shards from every training pipeline stage, avoid replicating the full
358
+
HF stream across PP ranks:
359
+
360
+
```python
361
+
for name, weight in bridge.export_hf_weights(
362
+
megatron_model,
363
+
show_progress=False,
364
+
current_pp_stage_only=True,
365
+
):
366
+
send_to_inference_workers(name, weight)
367
+
```
368
+
369
+
-`current_pp_stage_only` changes ownership only across the PP axis.
370
+
- TP/EP ranks in the owning stage still gather shards and perform normal HF layout conversion.
371
+
- Combining one representative stream from every PP stage reconstructs the normal complete export.
372
+
- Source-only HF passthrough tensors are assigned to PP stage 0; duplicate Megatron parameters use the lowest PP owner.
373
+
374
+
This mode is opt-in. Omitting the flag preserves the complete stream on every rank.
375
+
376
+
### C) Zero-copy streaming via ZMQ (fast refit, colocated)
356
377
357
378
Stream tensors from the training side to your inference runtime without writing to disk. The transport is ZMQ peer-to-peer with async send/recv and ping‑pong buffers for overlap; Ray is used only for lightweight coordination. This replaces the earlier ad‑hoc per‑tensor IPC handle passing and aligns with the refactor in [NVIDIA-NeMo/RL#1267](https://github.com/NVIDIA-NeMo/RL/pull/1267).
0 commit comments