dvc: Plots with multiple curves displayed wrong in cml
I am getting beautiful pr curves with DVC, where I have a curve for each class on my plot.
I took what I had and created a cml pipeline and the result looked completely different/worse.
From dvc
I run:
dvc plots diff

For the cml
version I run:
dvc plots diff --target pr.csv --show-vega origin/main

For cml
I used the docker image found on dockerhub, updated five days prior to my usage dvcorg/cml
@pared mentioned it might be due to fact that “file” results override flexible plots, as its parsed later, need to prepare a reproduction script.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (4 by maintainers)
Commits related to this issue
- plots: show-vega: adjust renderers before show vega Fixes: iterative/cml#1112 — committed to pared/dvc by pared 2 years ago
- plots: show-vega: adjust renderers before show vega Fixes: iterative/cml#1112 — committed to pared/dvc by pared 2 years ago
- plots: show-vega: adjust renderers before show vega Fixes: iterative/cml#1112 — committed to iterative/dvc by pared 2 years ago
@shortcipher3 created a PR to fix this: iterative/dvc#8114
@shortcipher3 thank you for the detailed steps, I was able to determine part of the issue.
The dvc plot being rendered via
dvc plots diff --targets model_pr.csv main
is in the regularvega
format and the plot rendered viadvc plots diff --target model_pr.csv --show-vega main > vega.json
is in thevega-lite
format which differs slightlythere is probably a good way to programmatically extract the vega data embed on the index.html (in which case you can use
vg2png
instead ofvl2png
), but the quickest path to something workable would be to go:cml publish with output a link like: https://asset.cml.dev/36855bf8a25c5882ce4c52ec85fc5d5f9f8f272f?cml=html which you can use in a report.md etc.
CC @daavoo @0x2b3bfa0 as feel they can probably recommend another approach?
For CI I’m using Gitlab, here is the relevant contents of my
.gitlab-ci.yml
My
dvc.yaml
looks like this:@dacbd Adding
npm install -g vega-lite@v5
into my container as seen above didn’t help.@DavidGOrtega I’ve attached the metrics file.
model_pr.csv
I think only certain tags are parsed within markdown, I would be surprised if script tags worked for example.
From the cml container:
LGTM.
It looks like an issue with the combination of flexible plots and
show_vega
arg.I believe this issue can be transferred to DVC. There is a function (
adjust_vega_renderers
) being applied to the vega plot embedded in the HTML that it is not being applied to thejson
returned byshow_vega
:https://github.com/iterative/dvc/blob/496599518a2f79a79b63888a1d9eaa30d8712021/dvc/commands/plots.py#L158-L177
So I just modified a couple of the numbers in the csv to get a “unique” one.
For more of a minimum reproducible experiment I ran something like:
I renamed
vega.json
tovega.txt
to upload it. vega.txtI renamed
dvc.yaml
todvc.txt
to upload it. dvc.txt