lf1-io / padl

Functional deep learning
Apache License 2.0
106 stars 4 forks source link

Loading a `padl.save` model into a notebook and saving it back does not work #387

Closed jasonkhadka closed 2 years ago

jasonkhadka commented 2 years ago

🐞 Bug

In notebook, following does not work:

model = padl.load('model.padl')
padl.save(model, 'model2.padl')

Throws:


File ~/.../padl/transforms.py:173, in Transform._pd_full_dump(self)
    170     return True
    171 # fully dump all Transforms from packages or modules specified in
    172 # _pd_external_full_dump_modules
--> 173 if self._pd_is_full_dump_module(module.__spec__.name):
    174     return True
    175 return self._pd_external_full_dump

AttributeError: 'NoneType' object has no attribute 'name'

Seems like module.__spec__ is set to None in interactive environment. So, a None handling here might solve the issue.

https://docs.python.org/3/reference/import.html#main-spec