nemo_rl.models.generation.trtllm.trtllm_worker_async#
Ray actor wrapping tensorrt_llm._torch.async_llm.AsyncLLM.
The sole TRT-LLM generation worker (the synchronous engine path was removed;
see :class:TrtllmGeneration, which asserts trtllm_cfg.async_engine=true).
Every method that calls into AsyncLLM is exposed as async def with the
_async suffix, so Ray’s actor runtime runs them on the actor’s own asyncio
loop; process-lifecycle / helper methods (e.g. shutdown,
configure_worker) stay sync.
Weight updates flow through NcclExtension inside TRT-LLM’s internal
RayGPUWorker, invoked via llm.collective_rpc().
Module Contents#
Classes#
Plain (non-actor) implementation of the async TRT-LLM generation worker. |
|
Ray actor wrapper around :class: |
API#
- class nemo_rl.models.generation.trtllm.trtllm_worker_async.TrtllmAsyncGenerationWorkerImpl(
- config: nemo_rl.models.generation.trtllm.config.TrtllmConfig,
- bundle_indices: Optional[list[int]] = None,
- fraction_of_gpus: float = 1.0,
- seed: Optional[int] = None,
Plain (non-actor) implementation of the async TRT-LLM generation worker.
Held separately from the
@ray.remote-wrapped- Class:
TrtllmAsyncGenerationWorkerso it can be exercised without Ray.
Initialization
- static configure_worker(
- num_gpus: int | float,
- bundle_indices: Optional[tuple[int, list[int]]] = None,
- num_gpus_per_node: Optional[int] = None,
- __repr__() str#
- is_alive() bool#
- async post_init_async() None#
Finish async engine setup on the Ray actor’s asyncio loop and (optionally) start HTTP server.
- shutdown() bool#
- start_http_server(port: int = 0) str#
Start an OpenAI-compatible HTTP server backed by
self.llm.
- stop_http_server() None#
- async report_dp_openai_server_base_url() Optional[str]#
- async init_collective_async(
- rank_prefix: int,
- ip: str,
- port: int,
- world_size: int,
- train_world_size: int,
- async prepare_refit_info_async(
- state_dict_info: dict[str, Any],
- async update_weights_from_collective_async(
- *,
- drain: bool = True,
- recompute_kv: bool = False,
Async version of
update_weights_from_collective.- Parameters:
drain – If False, run the refit at a scheduler step boundary without draining in-flight requests (in-flight weight update). Default True preserves the original drain-first behavior.
recompute_kv – If True (and
drain=False), preempt all in-flight requests after the refit so the scheduler re-prefills them under the new weights.
- async update_weights_via_ipc_zmq_async() bool#
- async report_device_id_async() list[str]#
- classmethod _weights_tags() list[str]#
- classmethod _all_sleep_tags() list[str]#
- _resolve_wake_tags(tags: Optional[list[str]]) list[str]#
- async sleep_async(**kwargs: Any) bool#
- async wake_up_async(**kwargs: Any) bool#
- async reset_prefix_cache_async(**kwargs: Any) bool#
- async start_gpu_profiling_async() None#
- async stop_gpu_profiling_async() None#
- async generate_async(
- data: nemo_rl.distributed.batched_data_dict.BatchedDataDict[nemo_rl.models.generation.interfaces.GenerationDatumSpec],
- greedy: bool = False,
- _build_sampling_params(*, greedy: bool)#
- class nemo_rl.models.generation.trtllm.trtllm_worker_async.TrtllmAsyncGenerationWorker(
- config: nemo_rl.models.generation.trtllm.config.TrtllmConfig,
- bundle_indices: Optional[list[int]] = None,
- fraction_of_gpus: float = 1.0,
- seed: Optional[int] = None,
Bases:
nemo_rl.models.generation.trtllm.trtllm_worker_async.TrtllmAsyncGenerationWorkerImplRay actor wrapper around :class:
TrtllmAsyncGenerationWorkerImpl.Initialization