Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pickle works with the old API not the new one #4985

Open
Khalifa1997 opened this issue Mar 31, 2020 · 8 comments
Open

Pickle works with the old API not the new one #4985

Khalifa1997 opened this issue Mar 31, 2020 · 8 comments

Comments

@Khalifa1997
Copy link
Contributor

Khalifa1997 commented Mar 31, 2020

Whenever Pickle loads a saved Shogun model, it expects the model to be implemented using the old API this can be demonstrated here

I guess this is related to #4463

@karlnapf
Copy link
Member

Could you post a minimal standalone python example on synthetic trivial data instead of the notebook? Thx

@Khalifa1997
Copy link
Contributor Author

@karlnapf I have updated the link, now it's a python file using Shogun's data however you're going to have to edit the path to point to your shogun dir

@karlnapf
Copy link
Member

karlnapf commented Apr 1, 2020

thanks. that does it.
(BTW standalone means no loading of files, or adjustment of paths, but one can run this straight away, but nevermind this is sufficient.)

@gf712
Copy link
Member

gf712 commented Apr 1, 2020

Could you share Traceback if there is one please?

@Khalifa1997
Copy link
Contributor Author

Could you share Traceback if there is one please?

@gf712 I have updated the gist

@karlnapf
Copy link
Member

karlnapf commented Apr 1, 2020

I think the offender is this hackery in swig/interfaces/SGBase.i

if isinstance(cls, str) and cls.startswith('shogun.'):
            if base is object:
                import shogun
                return eval(cls+'()')

Simple solution would be to replace it with the create method, but not sure that works with all cases of templated objects (although machines are rarely templated)

@gf712
Copy link
Member

gf712 commented Apr 1, 2020

Which templated objects are you referring to? The template type is hidden from interfaces no?

@karlnapf
Copy link
Member

karlnapf commented Apr 1, 2020

Nevermind for now, I thought this could become a problem, but not sure anymore now, as the serialization and the new api have changed the picture. I guess someone will see when trying to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants