ml.core.env

Defines any core environment variables used in the ML repository.

In order to keep all environment variables in one place, so that they can be easily referenced, don’t use os.environ or os.getenv outside of this file. Instead, add a new accessor function to this file.

class ml.core.env.StrEnvVar(key: str, *, default: str | None = None)[source]

Bases: object

get(*, allow_default: bool = True) str[source]
maybe_get(*, allow_default: bool = True) str | None[source]
set(value: str) None[source]
class ml.core.env.StrSetEnvVar(key: str, *, sep: str = ',')[source]

Bases: object

get() set[str][source]
set(values: set[str]) None[source]
add(value: str) None[source]
class ml.core.env.BoolEnvVar(key: str, default: bool = False)[source]

Bases: object

get(*, allow_default: bool = True) bool[source]
set(val: bool) None[source]
class ml.core.env.IntEnvVar(key: str, *, default: int | None = None)[source]

Bases: object

get(*, allow_default: bool = True) int[source]
maybe_get(*, allow_default: bool = True) int | None[source]
set(value: int) None[source]
class ml.core.env.PathEnvVar(key: str, *, default: Path | None = None)[source]

Bases: object

get(*, allow_default: bool = True) Path[source]
maybe_get(*, allow_default: bool = True) Path | None[source]
set(value: Path) None[source]
ml.core.env.is_debugging(*, allow_default: bool = True) bool
ml.core.env.get_cache_dir(*, allow_default: bool = True) Path
ml.core.env.get_run_dir(*, allow_default: bool = True) Path
ml.core.env.set_run_dir(value: Path) None
ml.core.env.get_eval_run_dir(*, allow_default: bool = True) Path
ml.core.env.set_eval_run_dir(value: Path) None
ml.core.env.get_exp_name(*, allow_default: bool = True) str
ml.core.env.set_exp_name(value: str) None
ml.core.env.get_data_dir(*, allow_default: bool = True) Path
ml.core.env.set_data_dir(value: Path) None
ml.core.env.get_slurm_conf_path(*, allow_default: bool = True) Path
ml.core.env.get_s3_data_bucket(*, allow_default: bool = True) str
ml.core.env.set_s3_data_bucket(value: str) None
ml.core.env.get_s3_runs_bucket(*, allow_default: bool = True) str
ml.core.env.set_s3_runs_bucket(value: str) None
ml.core.env.get_model_dir(*, allow_default: bool = True) Path
ml.core.env.set_model_dir(value: Path) None
ml.core.env.get_env_random_seed(*, allow_default: bool = True) int
ml.core.env.set_env_random_seed(value: int) None
ml.core.env.get_stage_dir(*, allow_default: bool = True) Path
ml.core.env.set_stage_dir(value: Path) None
ml.core.env.get_global_tags() set[str]
ml.core.env.set_global_tags(values: set[str]) None
ml.core.env.add_global_tag(value: str) None
ml.core.env.is_metal_disabled(*, allow_default: bool = True) bool
ml.core.env.is_gpu_disabled(*, allow_default: bool = True) bool
ml.core.env.are_colors_disabled(*, allow_default: bool = True) bool
ml.core.env.is_tensorboard_disabled(*, allow_default: bool = True) bool
ml.core.env.should_show_full_import_error(*, allow_default: bool = True) bool
ml.core.env.get_ml_config_path(*, allow_default: bool = True) Path | None
ml.core.env.set_ml_config_path(value: Path) None
ml.core.env.should_show_all_logs(*, allow_default: bool = True) bool
ml.core.env.ignore_registry_cache(*, allow_default: bool = True) bool
ml.core.env.get_wandb_entity(*, allow_default: bool = True) str | None
ml.core.env.get_default_config_root_path(*, allow_default: bool = True) Path