Skip to content

Commit

Permalink
Allow list for Comet artifact class 'names' field (#9654)
Browse files Browse the repository at this point in the history
* Update __init__.py

In the Comet logger, when I run train.py, it wants to download the data artifact. It was requiring me to format the 'names' field in the data artifact metadata as a dictionary, so I've changed this so that it also accepts a list.

Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update utils/loggers/comet/__init__.py

Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>

Signed-off-by: KristenKehrer <34010022+KristenKehrer@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
4 people authored Oct 2, 2022
1 parent 1158a50 commit c98128f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/loggers/comet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,14 @@ def download_dataset_artifact(self, artifact_path):
metadata = logged_artifact.metadata
data_dict = metadata.copy()
data_dict["path"] = artifact_save_dir
data_dict["names"] = {int(k): v for k, v in metadata.get("names").items()}

metadata_names = metadata.get("names")
if type(metadata_names) == dict:
data_dict["names"] = {int(k): v for k, v in metadata.get("names").items()}
elif type(metadata_names) == list:
data_dict["names"] = {int(k): v for k, v in zip(range(len(metadata_names)), metadata_names)}
else:
raise "Invalid 'names' field in dataset yaml file. Please use a list or dictionary"

data_dict = self.update_data_paths(data_dict)
return data_dict
Expand Down

0 comments on commit c98128f

Please sign in to comment.