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

Saving model #2

Closed
Eric-Simon-IA opened this issue Aug 11, 2022 · 4 comments
Closed

Saving model #2

Eric-Simon-IA opened this issue Aug 11, 2022 · 4 comments

Comments

@Eric-Simon-IA
Copy link

Hello,
First, thank you for your work, I've been using USAD so far but your solution seems to give similar or even better results on my data, while being easier to tune/train

I'm not really familar with models built that way, so I'm kinda stuck on one point, if you could guide me I'd be grateful:
I trained my model on colab, but need to make it available on another computer (inference on CPU only) for experimentation purpose.

Here is the struggle : I Can't find the proper way to save the model to be used elsewhere.

What I tried :

  • dill/pickle/torch.save the trained model object, rearrange functions,... but there's always at least one of the dependencies that cannot be interpreted. I know it's not the best pratice to do so anyway
  • Just saved the 'net' state_dict, recreate the COUTA instance and load dict but too much things are done in fit(), so I can't reload weights if the model is not fitted before

Any help will be appreciated, thank you in advance

@Eric-Simon-IA
Copy link
Author

Well I managed to make something work now, by saving state_dict, dim and c, but not sure if it's the best way to do that

@xuhongzuo
Copy link
Owner

Thanks for raising this issue. I will add model saving and loading into the notebook file.
Yes, saving state_dict of the network, the center c, and the dimensionality dim seems to be a good solution.

@xuhongzuo
Copy link
Owner

xuhongzuo commented Sep 5, 2022

Hi @Eric-Simon-IA, I just added model save and load to couta_algo.py. You can now assign save_model_path and load_model_path when initializing COUTA to realize saving the trained network or loading of the fitted network. I also update a section in the Readme.md.

Thanks again for raising this issue and sorry for the late update.
I will close this issue, and if you have any further problems related to this problem, please feel free to reopen it.

Cheers! Hope you have a wonderful week!

@Eric-Simon-IA
Copy link
Author

Thank you, will look at it when I manage to get some free time.
Hope you have a nice week as well !

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

No branches or pull requests

2 participants