Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions nemo_rl/environments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from nemo_rl.distributed.ray_actor_environment_registry import get_actor_python_env
from nemo_rl.environments.interfaces import EnvironmentInterface
from nemo_rl.utils.venvs import create_local_venv_on_each_node


# Environment registry entry schema.
Expand Down Expand Up @@ -105,10 +106,21 @@ def create_env(env_name: str, env_config: dict) -> EnvironmentInterface:
)
actor_class_fqn = ENV_REGISTRY[env_name]["actor_class_fqn"]
actor_class = get_object(actor_class_fqn)
actor_py_exec = get_actor_python_env(actor_class_fqn)
extra_env_vars = {}
if actor_py_exec.startswith("uv"):
actor_py_exec = create_local_venv_on_each_node(
actor_py_exec,
actor_class_fqn,
)
extra_env_vars = {
"VIRTUAL_ENV": actor_py_exec,
"UV_PROJECT_ENVIRONMENT": actor_py_exec,
}
env = actor_class.options( # type: ignore # it's wrapped with ray.remote
runtime_env={
"py_executable": get_actor_python_env(actor_class_fqn),
"env_vars": dict(os.environ),
"py_executable": actor_py_exec,
"env_vars": {**dict(os.environ), **extra_env_vars},
}
).remote(env_config)
return env
Expand Down
Loading