deserialize error
#1426
-
Can I ask for a help on this error when I tried to deserialize a trained model: ~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/model/predictor.py in deserialize(cls, path, **kwargs)
117
118 # call deserialize() for the concrete Predictor type
--> 119 return tpe.deserialize(path, **kwargs)
120
121 @classmethod
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/mx/model/predictor.py in deserialize(cls, path, ctx)
383 # deserialize transformation chain
384 with (path / "input_transform.json").open("r") as fp:
--> 385 transform = load_json(fp.read())
386
387 # deserialize prediction network
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_json.py in load_json(s)
75 Inverse function.
76 """
---> 77 return decode(json.loads(s))
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
290
291 args = decode(r.get("args", []))
--> 292 kwargs = decode(r.get("kwargs", {}))
293
294 if kind == Kind.Instance:
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
303
304 if type(r) == dict:
--> 305 return valmap(decode, r)
306
307 if type(r) == list:
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/toolz/dicttoolz.py in valmap(func, d, factory)
81 """
82 rv = factory()
---> 83 rv.update(zip(d.keys(), map(func, d.values())))
84 return rv
85
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
306
307 if type(r) == list:
--> 308 return list(map(decode, r))
309
310 return r
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
290
291 args = decode(r.get("args", []))
--> 292 kwargs = decode(r.get("kwargs", {}))
293
294 if kind == Kind.Instance:
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
303
304 if type(r) == dict:
--> 305 return valmap(decode, r)
306
307 if type(r) == list:
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/toolz/dicttoolz.py in valmap(func, d, factory)
81 """
82 rv = factory()
---> 83 rv.update(zip(d.keys(), map(func, d.values())))
84 return rv
85
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
306
307 if type(r) == list:
--> 308 return list(map(decode, r))
309
310 return r
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/serde/_base.py in decode(r)
293
294 if kind == Kind.Instance:
--> 295 return cls(*args, **kwargs)
296
297 if kind == Kind.Stateful:
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluonts/core/component.py in init_wrapper(*args, **kwargs)
343 self.__class__.__repr__ = validated_repr
344
--> 345 return init(self, **all_args)
346
347 # attach the Pydantic model as the attribute of the initializer wrapper
TypeError: __init__() got an unexpected keyword argument 'normalized' |
Beta Was this translation helpful? Give feedback.
Answered by
lostella
Apr 29, 2021
Replies: 1 comment 1 reply
-
@xyanb is this a model you serialized with The fix is to de-serialize using the same version of |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jaheba
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@xyanb is this a model you serialized with
gluonts<0.7
and you are de-serializing withgluonts==0.7
? That may not work because of some breaking change that were introduced.The fix is to de-serialize using the same version of
gluonts
that was used for serialization.