iterative / example-repos-dev

Source code and generator scripts for example DVC projects
https://dvc.org/doc
21 stars 13 forks source link

`example-get-started`: DVC plots fail to parse output with `SyntaxError: Unexpected token I in JSON` #225

Closed shcheklein closed 11 months ago

shcheklein commented 11 months ago

Context: https://github.com/iterative/example-get-started/actions/runs/5484365547/job/14852022942?pr=53

Specifically:

SyntaxError: Unexpected token I in JSON at position 121
    at JSON.parse (<anonymous>)
    at /usr/local/lib/node_modules/vega-lite/bin/render.js:66:31
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Process completed with exit code 1.

When it executes:

 dvc plots diff $PREVIOUS_REF workspace \
    --show-vega --targets Precision-Recall > vega.json
  vl2svg vega.json prc.svg

It "easy" to reproduce it locally with vl2svg installed via npm install canvas@2 vega@5 vega-cli@5 vega-lite@5 (on Mac OS you would need to use nvm to force node x64 vs arm64, e.g. https://stackoverflow.com/a/70572866/298182).

The reason is that since https://github.com/scikit-learn/scikit-learn/pull/26194/files PRC produces Infinity in JSON. That Vega CLI tool fails to parse. Online / browser and I think VS Code work fine with that.