重要提示

您正在查看 NeMo 2.0 文档。此版本引入了对 API 的重大更改和一个新的库 NeMo Run。我们目前正在将所有功能从 NeMo 1.0 移植到 2.0。有关先前版本或 2.0 中尚不可用的功能的文档,请参阅 NeMo 24.07 文档

配置#

配置类#

class nemo_run.config.Partial(*args: Any, **kwargs: Any)#

基类:Generic[_T], ~_T, _CloneAndFNMixin, _VisualizeMixin

fdl.Partial 的包装器,具有 nemo_run 特定的功能。有关更多信息,请参阅 fdl.Partial

class nemo_run.config.Script(
path: str = '',
inline: str = '',
args: list[str] = <factory>,
env: dict[str,
str] = <factory>,
entrypoint: str = 'bash',
m: bool = False,
)#

基类:ConfigurableMixin

用于配置原始脚本的数据类。

示例

file_based_script = run.Script("./scripts/echo.sh")

inline_script = run.Script(
    inline="""
env
echo "Hello 1"
echo "Hello 2"
"""
)
args: list[str]#

传递给脚本的参数,仅在设置路径时适用。

entrypoint: str = 'bash'#

要使用的入口点,默认为 bash。

env: dict[str, str]#

运行脚本时要设置的环境变量。

get_name()#
inline: str = ''#

脚本的内联内容。路径或内联内容需要设置其中一个。

m: bool = False#

通过 python 执行时是否使用 python -m

path: str = ''#

脚本的路径

to_command(
with_entrypoint: bool = False,
filename: str | None = None,
is_local: bool = False,
) list[str]#