Update configuration to str for tensorboard.

This commit is contained in:
Colin 2025-03-13 23:02:11 +08:00
parent b3817f84fe
commit e3493163f3
1 changed files with 3 additions and 3 deletions

View File

@ -74,15 +74,15 @@ class TrainConfig:
def class_to_dict(obj):
if isinstance(obj, (int, float, str, bool, type(None))):
return obj
return str(obj)
elif isinstance(obj, dict):
return {k: class_to_dict(v) for k, v in obj.items()}
elif isinstance(obj, list):
return {str(index): value for index, value in enumerate(obj)}
return {str(index): str(value) for index, value in enumerate(obj)}
elif hasattr(obj, "__dict__"):
return {k: class_to_dict(v) for k, v in obj.__dict__.items()}
else:
return obj
return str(obj)
# train_config = TrainConfig()