常见问题解答#
本节提供按 Nemo-Run 功能组织的常见问题解答。
配置#
问: 使用 run.Partial
或 run.Config
时出现 UnserializableValueError#
fiddle._src.experimental.serialization.UnserializableValueError: Unserializable value .tmp of type <class 'pathlib.PosixPath'>. Error occurred at path '<root>.something'."
答: run.Partial
或 run.Config
内的每个嵌套对象都需要是可序列化的。因此,如果您尝试配置对象,最好将它们包装在 run.Config
中。例如,当您执行以下操作时,会出现上述错误
from nemorun.config import ZlibJSONSerializer
partial = run.Partial(some_function, something=Path("/tmp"))
ZlibJSONSerializer().serialize(partial)
您可以通过执行以下操作来修复它
from nemorun.config import ZlibJSONSerializer
partial = run.Partial(some_function, something=run.Config(Path, "/tmp"))
ZlibJSONSerializer().serialize(partial)
问: 使用 run.Partial
或 run.Config
时出现反序列化错误#
下面显示了一个示例
ValueError: Using the Buildable constructor to convert a buildable to a new type or to override arguments is forbidden; please use either `fdl.cast(new_type, buildable)` (for casting) or `fdl.copy_with(buildable, **kwargs)` (for overriding arguments).
答: 确保您的嵌套配置中仅存在 Config
或 Partial
对象。您可以通过执行以下操作来运行快速健全性检查
from nemorun.config import ZlibJSONSerializer
serializer = ZlibJSONSerializer()
partial = run.Partial(some_function, something=run.Config(Path, "/tmp"))
serializer.deserialize(serializer.serialize(partial)) == partial
问: 如何在 autoconvert 中使用控制流?#
如果我将控制流与 run.autoconvert
一起使用,则会收到 UnsupportedLanguageConstructError: Control flow (ListComp) is unsupported by auto_config.
。例如,以下方法不起作用。
@run.autoconvert
def control_flow() -> llm.PreTrainingDataModule:
return llm.PreTrainingDataModule(
paths=[Path(f"some_doc_{i}") for i in range(10)],
weights=[1 for i in range(10)]
)
答: 正如错误消息所述,不支持 run.autoconvert
中的控制流。要克服这个问题,只需直接返回配置并像使用常规 python 函数一样使用它。因此,示例将变为
def control_flow_config() -> run.Config[llm.PreTrainingDataModule]:
return run.Config(
llm.PreTrainingDataModule,
paths=[run.Config(Path, f"some_doc_{i}") for i in range(10)],
weights=[1 for i in range(10)]
)
问: 我在本地 git 仓库中进行了更改,并使用本地执行器进行了测试。但是,更改未反映在远程作业中。#
答: 这很可能是因为您尚未提交更改。请参阅有关 GitArchivePackager
的详细信息,此处 以了解更多信息。
问: 我在 外部 本地 git 仓库中进行了更改,并使用本地执行器进行了测试。但是,更改未反映在远程作业中。#
答: 目前,我们仅打包您当前的仓库。要将更改传输到远程集群上的其他仓库,您需要在远程集群上检出软件包,然后在 docker 镜像中的正确路径处挂载它。我们将在未来添加对打包多个仓库的支持。
执行#
问: 对于 SlurmExecutor,如何直接从集群的登录节点执行。#
答: 例如,要通过 SSH 从本地计算机执行 SlurmExecutor,您可能需要
ssh_tunnel = run.SSHTunnel(
host="your-slurm-host",
user="your-user",
job_dir="/your/home/directory/nemo-run-experiments",
)
executor = run.SlurmExecutor(
...
tunnel=ssh_tunnel,
...
)
如果您在 Slurm 集群的登录节点上,只需更改隧道,如下所示
executor = run.SlurmExecutor(
...
tunnel=run.LocalTunnel(),
...
)
管理#
问: 我无法检索实验的日志。#
答: 这可能有几个原因,如下所述
Nemo-Run 主目录已更改。默认情况下,主目录位于
~/.nemorun
,但您可以使用NEMORUN_HOME
覆盖它。如果在启动实验和尝试检索实验之间主目录存在差异,则检索日志可能会很困难。Nemo-Run 主目录已从您运行实验时删除或覆盖。
远程集群上没有日志。例如,如果使用
SkypilotExecutor
在 Kubernetes 上启动,并且 Skypilot 集群已终止或 pod 已删除,则日志将不可用。