Machine Learning 的 CI/CD
Ravi Bhadauria
Machine Learning Engineer

定義 ML 工作流程與相依性的階段序列
定義於 dvc.yaml 檔
deps)cmd)outs)metrics 與 plots類似 GitHub Actions 的 workflow
dvc stage add 建立階段dvc stage add \
-n preprocess \
-d raw_data.csv -d preprocess.py \
-o processed_data.csv \
python preprocess.py
dvc.yaml 內容stages:
preprocess:
cmd: python preprocess.py
deps:
- preprocess.py
- raw_data.csv
outs:
- processed_data.csv
dvc stage add \
-n train \
-d train.py -d processed_data.csv \
-o plots.png -o metrics.txt \
python train.py
stages: preprocess: cmd: python preprocess.py deps: - preprocess.py - raw_data.csv outs: - processed_data.csvtrain: cmd: python train.py deps: - processed_data.csv - train.py outs: - plots.png
dvc repro 重製管線-> dvc repro Running stage 'preprocess': > python preprocess.pyRunning stage 'train': > python train.py Updating lock file 'dvc.lock'
dvc.lock.dvc 檔,記錄 MD5 雜湊git add dvc.lock && git commit -m "first pipeline repro"`-> dvc repro
Stage 'preprocess' didn't change, skipping
Running stage 'train' with command: ...
-> dvc dag
+------------+
| preprocess |
+------------+
*
*
*
+-------+
| train |
+-------+
dvc.yaml 與 dvc.lock 確保可重現性dvc stage add 產生管線dvc repro 重製/執行dvc dag 視覺化Machine Learning 的 CI/CD