DVC-DataVersionControl 数据版本管理
介绍
作为一名算法工程师,你是否有这样的困惑,每个实验的数据(配置)文件和模型文件,模型结果无法很好的进行版本管理
这三者的匹配是很麻烦的一个事情,当你做了很多次实验之后,你发现,诶,这个结果对应的参数配置是哪套,对应的数据处理方法是什么?模型文件是怎么命名的,面对文件夹里的一堆开始拼命回忆和翻找
这时候就会想要个能够对数据和模型文件进行版本管理的工具,想要回退某个版本,直接git checkout就可以了
代码我们通常会使用git工具,进行版本管理追踪,但是对于数据和模型文件等体积较大的非文本文件,git无能为力,你也许会自然而然想到lfs,但是我试了,git-lfs的效率和容错率让我放弃了
DVC-DataVersionControl
终于,我发现了一个神器,
Data Version Control(DVC)配合git能够一站式管理数据和模型,开源易用,使用pip install
就能安装,对于我这个pythoner来说,太友好了
大致原理
DVC通过编码实现数据版本控制。您可以生成简单的元文件一次,描述要跟踪的数据集、ML 工件等。这些元数据可以放在 Git 中代替大文件。现在,您可以使用 DVC 创建数据快照、恢复以前的版本、重现实验、记录不断变化的指标等等!
使用git来管理.dvc/
目录下的元文件,然后dvc工具通过解析元文件记录来操作(创建和恢复)大型文件。
From a very high-level point of view, DVC works as follows:
- A Git project is initialized as a DVC project (dvc init).
- Adding a data file to the DVC version control system moves the file to the local cache, letting Git track only the corresponding .dvc file.
- Files in the local cache can be synced with a remote repository (dvc push).
- At any time, files can be synced from the remote repository to the local cache (dvc fetch) or from the local cache to the working folder (dvc pull).
本地缓存
The strength of having a local cache is allowing local sharing among projects and users:
参考资料
License:
CC BY 4.0