jamesmf/cclm

TypeError: Object of type int64 is not JSON serializable

Opened this issue · 1 comments

persisting the config of the Embedder object in the base_pretraining example fails.

Likely one of the attributes (n_chars or max_len) is set by referencing an input/output shape (or similar) so it should be found and cast to int

>>> [(i, type(getattr(base, i))) for i in base.persisted_attrs]
[('max_len', <class 'int'>), ('char_emb_size', <class 'int'>), ('n_blocks', <class 'int'>), ('n_chars', <class 'numpy.int64'>), ('n_filters', <class 'int'>), ('global_filters', <class 'int'>), ('filter_len', <class 'int'>)]

looks like it's actually a numpy int64.