使用 DVC 進行資料版本控管入門
Ravi Bhadauria
Machine Learning Engineer
pip 通用安裝 $ pip install dvc
$ dvc version
DVC version: 3.40.1 (pip)Platform: Python 3.9.16 on macOS-14.2.1-arm64-arm-64bitConfig: Global: /Users/<username>/Library/Application Support/dvc System: /Library/Application Support/dvcRepo: dvc, git
$ git init
Initialized empty Git repository in /path/to/repo/.git/
$ dvc init
Initialized DVC repository.
You can now commit the changes to git.
$ git status
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: .dvc/.gitignore
new file: .dvc/config
new file: .dvcignore
$ git commit -m "initialized dvc"
類似 .gitignore 檔
當有許多不需追蹤的資料檔時很實用
# .dvcignore # 忽略 'data' 目錄中的所有檔案 data/*# 但不要忽略 'data/data.csv' !data/data.csv# 忽略所有 .tmp 檔案 *.tmp
dvc check-ignore 指令$ dvc check-ignore data/file.txt
data/file.txt
-d 旗標可查看詳細資訊$ dvc check-ignore -d data/file.txt
.dvcignore:3:data/* data/file.txt
pip install dvc 安裝 DVCdvc versiondvc init.dvcignore 指定排除的檔案.gitignore 類似,語法相同dvc check-ignore <filename>使用 DVC 進行資料版本控管入門