Skip to content

Commit

Permalink
change NumpyEncoder in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
kervias committed Jul 29, 2024
1 parent 72d6a32 commit 7d723a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions edustudio/utils/callback/callbacks/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
import json
import os
import numpy as np

class NumpyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarray):
return obj.tolist()
return json.JSONEncoder.default(self, obj)
from edustudio.utils.common import NumpyEncoder


class History(Callback):
Expand Down
2 changes: 1 addition & 1 deletion edustudio/utils/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


from .commonUtil import PathUtil, IDUtil, tensor2npy, tensor2cpu, IOUtil, set_same_seeds, get_gpu_usage, DecoratorTimer
from .configUtil import UnifyConfig
from .configUtil import UnifyConfig, NumpyEncoder
from .loggerUtil import Logger

0 comments on commit 7d723a5

Please sign in to comment.