exp push
概要
usage: dvc exp push [-h] [-q | -v] [-A] [--rev <commit>] [-n <num>] [-f]
[--no-cache] [-r <name>] [-j <number>]
[--run-cache | --no-run-cache]
git_remote [experiment ...]
positional arguments:
git_remote Git remote name or Git URL
experiment Experiment to push
描述
dvc exp push
和 dvc exp pull
命令是通过 Git 和 远程存储 在多个 仓库 副本间共享 实验 的方式。
普通的
git push
和git fetch
不适用于实验,因为实验是保存在自定义 Git 引用下的。有关 DVC 实验存储的更多信息,请参阅 DVC 实验概览 中的 “DVC 如何跟踪实验?”。
需要提供一个有效的 git_remote
名称(例如 origin
)或 Git URL。默认情况下,会推送源自 HEAD
提交的实验(参见下方选项)。
dvc exp push
的首要操作是将 experiments
上传至 Git 远端,以便其他仓库克隆之后可以拉取(等同于 git push <git_remote> refs/exps/<experiment>
)。使用 dvc exp list <git_remote>
查看远程仓库中的实验。
除非使用了 --no-cache
,否则此命令还会尝试将与实验相关的所有缓存数据通过 dvc push
推送至远程存储。
如果设置了 DVC Studio 访问令牌,DVC 将通知 DVC Studio 关于新实验的信息,并显示 DVC Studio 项目 URL 以查看实验。
选项
-
-A
,--all-commits
- 推送仓库中的所有实验(覆盖--rev
和--num
)。 -
--rev <commit>
- 以指定的<commit>
为基线,推送由此派生的实验(默认为 HEAD)。 -
-n <num>
,--num <num>
- 从--rev
基线开始,推送最近num
个提交(首父提交)中的实验。提供负值可包含所有首父提交(类似git log -n
)。 -
-f
,--force
- 若实验已存在于 Git 远端,则覆盖它。 -
--no-cache
- 不将与此实验相关的缓存文件推送至 DVC 远端。 -
-r <name>
,--remote <name>
- 将缓存文件推送至的dvc remote
名称。 -
--run-cache
,--no-run-cache
- 是否将所有可用的阶段运行历史上传到dvc remote
。默认值为--no-run-cache
。 -
-j <number>
,--jobs <number>
- DVC 向远程存储上传数据的并行级别。默认值为4 * cpu_count()
。注意,可通过dvc remote modify
的jobs
配置项设置默认值。增加并行数可能提升整体传输速度。 -
-h
,--help
- 显示帮助信息并退出。 -
-q
,--quiet
- 不向标准输出写入任何内容。如果没有问题则以 0 退出,否则以 1 退出。 -
-v
,--verbose
- 显示执行dvc pull
命令时的详细跟踪信息。
示例
本示例基于 我们的入门指南,您可在其中找到实际源代码。
假设我们在项目中运行了 3 个实验:
$ dvc exp list --all-commits
11-bigrams-experiment:
1d4c01d [conic-ease]
a80bca5 [lucid-lair]
9380a12 [major-mela]
我们现在希望将它们通过 Git 远端与其他用户共享:
$ dvc exp push origin
Pushed experiment conic-ease, lucid-lair, and major-mela to Git remote 'origin'.
现在我们可以看到,该实验已存在于远程仓库中:
$ dvc exp list --all origin
master:
conic-ease
lucid-lair
major-mela