Skip to content

Commit 2ae58aa

Browse files
committed
eval tracker fix 1
1 parent fa3ef62 commit 2ae58aa

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/lighteval/logging/evaluation_tracker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,15 @@ class EnhancedJSONEncoder(json.JSONEncoder):
6363
Notably manages the json encoding of dataclasses.
6464
"""
6565

66-
def default(self, o):
66+
def default(self, o): # noqa : C901
6767
if is_dataclass(o):
6868
try:
6969
return asdict(o) # type: ignore
7070
except Exception:
71-
return str(o)
71+
try:
72+
return o.__dict__
73+
except Exception:
74+
return str(o)
7275
if callable(o):
7376
if hasattr(o, "__name__"):
7477
return o.__name__

0 commit comments

Comments
 (0)