Skip to content

[BUG] swanlab.config can't fit hydra - is not JSON serializable #237

@Zeyi-Lin

Description

@Zeyi-Lin

🤩 Features description [Please make everyone to understand it]

test code:

import hydra
from omegaconf import DictConfig, OmegaConf
import json
import swanlab


@hydra.main(config_path=".", config_name="configs", version_base="1.3.2")
def startup(cfg: DictConfig):
    config = dict(cfg)
    print(config)
    print("#" * 30)
    swanlab.init(experiment_name="abc", config=config)
   
startup()

configs.yaml, locate in the same dir:

data:
  dir_image: "./data/samimage256/256/"
  dir_mask: "./data/samimage256/mymask/"
  image_size: 512

hardware:
  seed: 2021
  num_workers: 4

Error:

Traceback (most recent call last):
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/data/run/main.py", line 310, in __check_config
    ujson.dumps(config)
TypeError: {'dir_image': './data/samimage256/256/', 'dir_mask': './data/samimage256/mymask/', 'image_size': 512} is not JSON serializable

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions