nemo_rl.utils.venvs#
Module Contents#
Functions#
Make Hugging Face |
|
Create a virtual environment using uv and execute a command within it. |
|
Create a virtual environment on each Ray node. |
|
Build a Ray |
Data#
API#
- nemo_rl.utils.venvs.dir_path#
‘dirname(…)’
- nemo_rl.utils.venvs.git_root#
‘abspath(…)’
- nemo_rl.utils.venvs.DEFAULT_VENV_DIR#
‘join(…)’
- nemo_rl.utils.venvs.logger#
‘getLogger(…)’
- nemo_rl.utils.venvs.add_hf_modules_cache_to_pythonpath(
- env_vars: dict[str, str],
Make Hugging Face
trust_remote_codemodules importable by Ray actors.
- nemo_rl.utils.venvs.create_local_venv(
- py_executable: str,
- venv_name: str,
- force_rebuild: bool = False,
Create a virtual environment using uv and execute a command within it.
The output can be used as a py_executable for a Ray worker assuming the worker nodes also have access to the same file system as the head node.
This function is cached to avoid multiple calls to uv to create the same venv, which avoids duplicate logging.
- Parameters:
py_executable (str) – Command to run with the virtual environment (e.g., “uv.sh run –locked”)
venv_name (str) – Name of the virtual environment (e.g., “foobar.Worker”)
force_rebuild (bool) – If True, force rebuild the venv even if it already exists
- Returns:
Path to the python executable in the created virtual environment
- Return type:
str
- nemo_rl.utils.venvs._env_builder(
- py_executable: str,
- venv_name: str,
- node_idx: int,
- force_rebuild: bool = False,
- nemo_rl.utils.venvs.create_local_venv_on_each_node(py_executable: str, venv_name: str)#
Create a virtual environment on each Ray node.
- Parameters:
py_executable (str) – Command to run with the virtual environment
venv_name (str) – Name of the virtual environment
- Returns:
Path to the python executable in the created virtual environment
- Return type:
str
- nemo_rl.utils.venvs.make_actor_runtime_env(
- actor_class_fqn: str,
- *,
- extra_env_vars: dict[str, str] | None = None,
Build a Ray
runtime_envfor one of our registered actors.Resolves the actor’s tier-specific py_executable via the registry, materializes a per-node venv when uv-managed, and packages it with
VIRTUAL_ENV/UV_PROJECT_ENVIRONMENTenv vars so workers see the same interpreter as the driver. Additional actor-specific environment variables can be supplied viaextra_env_vars.Used by ReplayBuffer, AsyncTrajectoryCollector, and SyncRolloutActor — three actors that need the VLLM tier’s venv on every node. Also used by the SGLang router and SGLang generation engines (SGLANG tier).