Closed diegobodner closed 4 years ago
@diegobodner , did saving as pickle work?
Hi @diegobodner, You need to import torch
explicitly somewhere.
assuming you called your instance of the synthesiser 'ctgan' then it's pretty simple:
torch.save(ctgan,'my_awesome_model')
loaded_model = torch.load('my_awesome_model')
sample = loaded_model.sample(500)
Here's an example: https://colab.research.google.com/drive/1YBxeOlsATKt6zesv_O3HPCPR-G8sPPib
however, I'm currently getting ImportError: cannot import name '_is_url'
error now when returned the sampled pandas data frame. Not sure if this is unique to the ColabNotebook I'm running in.
Many thanks!!
torch.save(ctgan,'my_awesome_model') works well.
Best regards
Thanks @oregonpillow. Closing this for now.
Hi @diegobodner, You need to explicitly somewhere.
import torch
assuming you called your instance of the synthesiser 'ctgan' then it's pretty simple:
torch.save(ctgan,'my_awesome_model') loaded_model = torch.load('my_awesome_model') sample = loaded_model.sample(500)
Here's an example: https://colab.research.google.com/drive/1YBxeOlsATKt6zesv_O3HPCPR-G8sPPib
however, I'm currently getting error now when returned the sampled pandas data frame. Not sure if this is unique to the ColabNotebook I'm running in.
ImportError: cannot import name '_is_url'
I can't thank you enough.
Description
I would like to save in disk a CTGAN trained model. I did it in the past using TGAN using tgan.save command.
What I Did
It seems it's not possible to save models