Skip to content

Commit

Permalink
Dvclive 3.0 (#253)
Browse files Browse the repository at this point in the history
* use dvclive 3.0

* update code to use dvclive 3.0

* update dvclive branch

* final updates for dvclive 3.0 review
  • Loading branch information
Dave Berenbaum authored Sep 22, 2023
1 parent b869d35 commit 3c5249d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions example-get-started-experiments/code/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dvc[s3]>=3.0
dvclive>=2.11.3
dvclive>=3.0
fastai
python-box
sagemaker
sagemaker
2 changes: 1 addition & 1 deletion example-get-started-experiments/code/src/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def evaluate():
get_mask_path(fpath, Path("data") / "test_data") for fpath in test_img_fpaths
]
masks_true = [Image.open(mask_path) for mask_path in test_mask_fpaths]
with Live("results/evaluate", report=None, cache_images=True) as live:
with Live("results/evaluate") as live:
dice_multi = 0.0
for ii in range(len(masks_true)):
mask_pred, mask_true = masks_pred[ii], masks_true[ii]
Expand Down
2 changes: 1 addition & 1 deletion example-get-started-experiments/code/src/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def train():
if params.train.arch not in model_names:
raise ValueError(f"Unsupported model, must be one of:\n{model_names}")

with Live("results/train", report=None) as live:
with Live("results/train") as live:
learn = unet_learner(
data_loader, arch=getattr(models, params.train.arch), metrics=DiceMulti
)
Expand Down
6 changes: 3 additions & 3 deletions example-get-started-experiments/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dvc stage add -n train \
dvc stage add -n evaluate \
-p base,evaluate \
-d src/evaluate.py -d models/model.pkl -d data/test_data \
python src/evaluate.py
python src/evaluate.py -o results

dvc stage add -n sagemaker \
-d models/model.pth -o model.tar.gz \
Expand All @@ -130,8 +130,8 @@ git add .
tick
git commit -m "Run dvc.yaml pipeline"
git tag -a "2-dvc-pipeline" -m "Experiment using dvc pipeline"
gto register results/train:pool-segmentation --version v0.1.0
gto assign results/train:pool-segmentation --version v0.1.0 --stage dev
gto register pool-segmentation --version v0.1.0
gto assign pool-segmentation --version v0.1.0 --stage dev

export GIT_AUTHOR_NAME="David de la Iglesia"
export GIT_AUTHOR_EMAIL="daviddelaiglesiacastro@gmail.com"
Expand Down
4 changes: 1 addition & 3 deletions example-get-started/code/src/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,10 @@ def main():
test, _ = pickle.load(fd)

# Evaluate train and test datasets.
with Live(EVAL_PATH, dvcyaml=False, report=None) as live:
with Live(EVAL_PATH, dvcyaml=False) as live:
evaluate(model, train, "train", live, save_path=EVAL_PATH)
evaluate(model, test, "test", live, save_path=EVAL_PATH)

live.make_summary()

# Dump feature importance plot.
save_importance_plot(live, model, feature_names)

Expand Down
2 changes: 1 addition & 1 deletion example-get-started/code/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dvclive>=2.14
dvclive>=3.0
pandas
pyaml
scikit-learn>=1.3
Expand Down

0 comments on commit 3c5249d

Please sign in to comment.