nemo_rl.models.generation#
Subpackages#
nemo_rl.models.generation.trtllmnemo_rl.models.generation.trtllm.quantizationnemo_rl.models.generation.trtllm.confignemo_rl.models.generation.trtllm.trtllm_disagg_servernemo_rl.models.generation.trtllm.trtllm_generationnemo_rl.models.generation.trtllm.trtllm_worker_asyncnemo_rl.models.generation.trtllm.trtllm_http_servernemo_rl.models.generation.trtllm.trtllm_backend
nemo_rl.models.generation.megatronnemo_rl.models.generation.vllmnemo_rl.models.generation.vllm.vllm_backendnemo_rl.models.generation.vllm.draft_utilsnemo_rl.models.generation.vllm.refit_layoutnemo_rl.models.generation.vllm.confignemo_rl.models.generation.vllm.refit_loadernemo_rl.models.generation.vllm.collective_rpcnemo_rl.models.generation.vllm.vllm_sparse_refitnemo_rl.models.generation.vllm.captured_chat_logprobsnemo_rl.models.generation.vllm.vllm_worker_asyncnemo_rl.models.generation.vllm.worker_utilsnemo_rl.models.generation.vllm.metric_namesnemo_rl.models.generation.vllm.video_utilsnemo_rl.models.generation.vllm.vllm_generationnemo_rl.models.generation.vllm.vllm_sparse_deltanemo_rl.models.generation.vllm.patchesnemo_rl.models.generation.vllm.utilsnemo_rl.models.generation.vllm.vllm_workernemo_rl.models.generation.vllm.checkpoint_engine
nemo_rl.models.generation.dynamonemo_rl.models.generation.dynamo.managed_runtimenemo_rl.models.generation.dynamo.confignemo_rl.models.generation.dynamo.dynamo_generationnemo_rl.models.generation.dynamo.argumentsnemo_rl.models.generation.dynamo.dynamo_workernemo_rl.models.generation.dynamo.refitnemo_rl.models.generation.dynamo.worker_poolnemo_rl.models.generation.dynamo.http_clientnemo_rl.models.generation.dynamo.venvnemo_rl.models.generation.dynamo.token_wrappernemo_rl.models.generation.dynamo.validate_dynamo_vllm_argsnemo_rl.models.generation.dynamo.metrics
Submodules#
Package Contents#
Functions#
Let the raylet reap a dead generation worker’s EngineCore, on runs the driver owns. |
|
Map |
|
Whether the trainer streams the drafter’s FULL weight set on refit. |
|
Apply specific configurations to generation config. |
Data#
API#
- nemo_rl.models.generation.TokenizerType#
None
- nemo_rl.models.generation.maybe_configure_engine_reaping_env(enabled: bool) None#
Let the raylet reap a dead generation worker’s EngineCore, on runs the driver owns.
A vLLM generation worker spawns its EngineCore as a plain multiprocessing child –
context.Process(target=EngineCoreProc.run_engine_core), nosetsid, not a daemon – and that child owns the CUDA context and the KV cache. Every cleanup path that exists runs INSIDE the dying process, so SIGKILL defeats all of them: vLLM’sweakref.finalizenever fires, a non-daemon multiprocessing child is designed to outlive its parent, and Ray’s defaultRAY_kill_child_processes_on_worker_exitis the worker’s own exit handler. The orphan then holds its GPU for the life of the job: measured on 4xGB200, one SIGKILLed shard left 114.95 GiB of a 184.31 GiB device still held, and it did not come back across five restart attempts – the replacement could not fit, so re-admission failed while the survivors carried on. Because the EngineCore never callssetsidit stays in the worker’s process group, which is exactly what per-worker process-group cleanup reaches.The raylet is the only reader, and this only reaches the raylet on runs where the driver starts it. Ray reads
process_group_cleanup_enabledin the raylet, at the raylet’s own startup. Call this beforeinit_ray(), like- Func:
~nemo_rl.data_plane.factory.maybe_configure_data_plane_env, and on a local/single-node runray.initforks a raylet that inherits this environment, so it lands. On a Slurm or k8s cluster it does NOT:ray starthas already run on every node before the driver process exists, andinit_ray()then attaches to it withaddress="auto". Nothing the driver sets afterwards can change a raylet that is already up. Those deployments set the flag where the raylet is actually launched – see theRAY_process_group_cleanup_enabledexport inray.sub– which means it is unconditional there, not scoped to fleet health.
So the gate below buys scoping on exactly one deployment shape. It is still worth having: a raylet-wide behaviour change should not follow from
import nemo_rl, and a plain SFT, DPO or distillation run has no EngineCore to reap. But it is not a property of the flag, it is a property of who started the raylet.setdefault, not assignment: an operator debugging a wedged engine may want the corpse, and an explicitRAY_process_group_cleanup_enabled=0stays honoured.- Parameters:
enabled – Whether this run can lose a generation worker and keep going. A
boolrather than the fleet-health config, so any entrypoint that builds vLLM generation can call it – the leak is not specific to fleet health, it just takes a run that survives the loss to leave the orphan behind. Note this isfleet_health.enabled, notrestart_dead_shards: any shard loss leaks that GPU, restarting is only what makes the loss survivable.
- nemo_rl.models.generation.resolve_generation_class(
- generation_config: nemo_rl.models.generation.interfaces.GenerationConfig,
Map
generation_configto its GenerationInterface class.
- nemo_rl.models.generation.draft_full_refit_enabled(policy_cfg: dict) bool#
Whether the trainer streams the drafter’s FULL weight set on refit.
True for Automodel draft co-training (dspark/dflash/eagle3), which exports the drafter’s entire state_dict under the
draft.prefix; the megatron eagle3 path streams a partial set instead. Feeds thedraft_full_refitargument of :func:configure_generation_config.automodel_cfg.enabled alone identifies the Automodel path.
- nemo_rl.models.generation.configure_generation_config(
- config: nemo_rl.models.generation.interfaces.GenerationConfig,
- tokenizer: nemo_rl.models.generation.TokenizerType,
- is_eval: bool = False,
- has_refit_draft_weights: bool = False,
- trains_mtp: bool = False,
- draft_full_refit: bool = False,
Apply specific configurations to generation config.