nemo_rl.utils.path_utils#
Path and IO helpers that also understand msc:// URLs; local paths are unchanged.
Module Contents#
Functions#
Return whether a path explicitly selects an MSC storage profile. |
|
Enable MSC in Megatron(-Bridge) for this process if any path is |
|
Preserve MSC URLs when normalizing a checkpoint location. |
|
Save controller checkpoint state beside local or MSC model shards. |
|
Load controller checkpoint state saved by |
|
|
|
|
|
|
|
|
|
|
|
|
API#
- nemo_rl.utils.path_utils.is_msc_path(path: str | os.PathLike[str]) bool#
Return whether a path explicitly selects an MSC storage profile.
- nemo_rl.utils.path_utils.maybe_enable_msc(*paths: str | os.PathLike[str] | None) None#
Enable MSC in Megatron(-Bridge) for this process if any path is
msc://.Megatron(-Bridge) only treats
msc://as remote once its process-global MSC flag is on, so call this at every entry point that is handed a checkpoint path (load or save). Local-path runs never import Megatron.
- nemo_rl.utils.path_utils.checkpoint_abspath(path: str | os.PathLike[str]) str#
Preserve MSC URLs when normalizing a checkpoint location.
- nemo_rl.utils.path_utils.save_checkpoint_object(
- value: Any,
- path: str | os.PathLike[str],
Save controller checkpoint state beside local or MSC model shards.
- nemo_rl.utils.path_utils.load_checkpoint_object(
- path: str | os.PathLike[str],
- **kwargs: Any,
Load controller checkpoint state saved by
save_checkpoint_object.
- nemo_rl.utils.path_utils.path_exists(path: str | os.PathLike[str]) bool#
os.path.existsthat also understandsmsc://URLs.
- nemo_rl.utils.path_utils.open_path(path: str | os.PathLike[str], mode: str = 'r') Any#
openthat also understandsmsc://URLs.
- nemo_rl.utils.path_utils.as_path(path: str | os.PathLike[str]) pathlib.Path#
Path(path), or the MSC path class formsc://URLs.
- nemo_rl.utils.path_utils.path_isdir(path: str | os.PathLike[str], strict: bool = True) bool#
os.path.isdirthat also understandsmsc://URLs.strict=Falsetreats a missing MSC prefix as “not a directory” instead of raising.
- nemo_rl.utils.path_utils.listdir(path: str | os.PathLike[str]) list[str]#
os.listdirthat also understandsmsc://URLs.
- nemo_rl.utils.path_utils.rmtree(path: str | os.PathLike[str]) None#
shutil.rmtreethat also understandsmsc://URLs.