EdGENetworks / attention-networks-for-classification

Hierarchical Attention Networks for Document Classification in PyTorch
606 stars 133 forks source link

An example for save this model #4

Closed dgai91 closed 7 years ago

dgai91 commented 7 years ago

thanks for your code. i've got an 40% acc in my work.but when i attempt to save this model, i'm confused. plz help me and give me an example for save this model. thank you!

Sandeep42 commented 7 years ago

You can save individual Word and Sentence encoders separately. torch.save(model_name.state_dict(), model_path) When loading, you can use torch.load function the saved model file into memory, and use model.load_state_dict()

dgai91 commented 7 years ago

thanks for your explaination.great work