Closed TeamEpimicro closed 1 year ago
This is actually a core python bug which has been fixed in some releases but has not been backported to a 3.9 release yet.
We have a workaround for it here: https://github.com/iterative/dvc/blob/ed664143b48f5372773075ad5093b93ffdfd755b/dvc/repo/experiments/serialize.py#L59-L71
but I'm guessing this issue means we need to make the defaultdict->dict
conversion recursive
I'm facing the same issue, it happens even with python 3.10. Are there any workarounds at the moment?
@pmrowla Is it expected that it would still happen with 3.10?
@Danila89 hey, could you please also share a bit more information - dvc version
output, logs, etc. Thanks.
@shcheklein seems that the problem depends on what exactly the experiments look like. I'm exploring DVC capabilities, I delete and run a lot of experiments. At some point in time I encountered the issue. Vscode extension did not work, dvc exp show --json
failed with both Python 3.10.9 and Python 3.9.6. I reproduced it with dvc 2.58.2 and dvc 3.0.0. But at the moment (I guess after deletion of some experiments) the problem is gone. If I will encounter it next time I will share the details and try to find the way to reproduce.
@mattseddon reported that he can reproduce it with python 3.10 in https://github.com/iterative/dvc/issues/9588#issuecomment-1594504602. Looking into it.
Update: looks like a regression from https://github.com/iterative/dvc/commit/ec090c5680c490f34339edf3beaf9b40a90397a9.
@pmrowla Is it expected that it would still happen with 3.10?
This will happen in Python <3.12.
@skshetry I think it's actually Python<3.11.0, right?
AFAICT the default dicts are only nested one level deep, so I put a quick fix PR in https://github.com/iterative/dvc/pull/9619. @skshetry @pmrowla Any issues with this quick fix?
@TeamEpimicro If you want to try, you could do pip install git+https://github.com/iterative/dvc.git@exp-serialize-defaultdict
and check if it fixes the problem.
@skshetry I think it's actually Python<3.11.0, right?
No, it was fixed only in 3.12. See https://github.com/python/cpython/pull/32056.
i can still repro in 3.11 using:
from collections import defaultdict
from dataclasses import asdict, dataclass, field
@dataclass
class Klass:
d: dict[str, list[int]] = field(default_factory=dict)
d = defaultdict(list, {"lst": [1, 2, 3]})
inst = Klass(d=d)
print(asdict(inst))
Closing as fixed by #9619.
@TeamEpimicro @Danila89 Please follow up if you still have issues.
Bug Report
dvc exp show --json : ERROR: unexpected error - first argument must be callable or None
Description
I am currently using the VS Code extension with version v0.9.6 and dvc with version v2.58.2 (see
dvc doctor
output below). My.dvc/config
file is the following:My VS Code Extension is showing "No experiment to display" in the Experiments tab of the left sidebar. In addition, the Experiment tab in the Setup view of the DVC extension says: "Your project contains no data"
As a result, I am unable to use the VS Code Extension.
However I already ran of couple of experiments through
dvc exp run
and pushed the associateddvc.lock
files to my git repo, which I can successfully track through the CLI withdvc exp show --rev master
:I found an error in the VS Code Developper Console :
The same error is displayed when running
dvc exp show --json
in the CLI :Here is the same command ran with
--verbose
:Reproduce
git init
dvc init
dvc exp run
dvc push
git add dvc.lock
git commit -m "some commit name"
git push
dvc exp show --json
Expected
No error is expected.
Environment information
Output of
dvc doctor
:I am using poetry for package and environment management.
Output of
pip check
:Output of
poetry check
:Output of
poetry env info
:Output of
poetry show dvc
:Additionnal Information
I am instantiating dvclive in my code with the following :
And tracking some metrics with both
live.summary()
andlive.log_metric()
: