Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions nemo_gym/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import platform
import shlex
import sys
import tomllib
from glob import glob
from importlib.metadata import entry_points
from importlib.metadata import version as md_version
from os import environ, makedirs
from os.path import exists
Expand Down Expand Up @@ -798,11 +798,8 @@ def display_help(): # pragma: no cover
# Just here for help
BaseNeMoGymCLIConfig.model_validate(global_config_dict)

pyproject_path = PARENT_DIR / "pyproject.toml"
with pyproject_path.open("rb") as f:
pyproject_data = tomllib.load(f)

project_scripts = pyproject_data["project"]["scripts"]
eps = entry_points().select(group="console_scripts")
project_scripts = {ep.name: ep.value for ep in eps if ep.name.startswith(("nemo_gym_", "ng_"))}
rich.print("""Run a command with `+h=true` or `+help=true` to see more detailed information!

[bold]Available CLI scripts[/bold]
Expand Down
12 changes: 9 additions & 3 deletions nemo_gym/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ def load_extra_config_paths(self, config_paths: List[str]) -> Tuple[List[str], L
extra_configs: List[DictConfig] = []
for config_path in config_paths:
config_path = Path(config_path)
# Assume relative to the parent dir
# Check cwd first for user's local configs, then install location
if not config_path.is_absolute():
config_path = PARENT_DIR / config_path
cwd_path = Path.cwd() / config_path
config_path = cwd_path if cwd_path.exists() else PARENT_DIR / config_path

extra_config = OmegaConf.load(config_path)
for new_config_path in extra_config.get(CONFIG_PATHS_KEY_NAME) or []:
Expand Down Expand Up @@ -214,7 +215,12 @@ def parse(self, parse_config: Optional[GlobalConfigDictParserConfig] = None) ->
global_config_dict: DictConfig = OmegaConf.merge(initial_global_config_dict, global_config_dict)

# Load the env.yaml config. We load it early so that people can use it to conveniently store config paths.
dotenv_path = parse_config.dotenv_path or PARENT_DIR / "env.yaml"
if parse_config.dotenv_path:
dotenv_path = parse_config.dotenv_path
else:
cwd_env_yaml = Path.cwd() / "env.yaml"
dotenv_path = cwd_env_yaml if cwd_env_yaml.exists() else PARENT_DIR / "env.yaml"

dotenv_extra_config = DictConfig({})
if dotenv_path.exists() and not parse_config.skip_load_from_dotenv:
dotenv_extra_config = OmegaConf.load(dotenv_path)
Expand Down