Open jackrobson opened 5 years ago
eval.py is for model evaluation.
For you question, you need to save the trained model first. Then, load the saved model into the memory and call the instance function (i.e., call) of the class MODEL. Note that you should set "is_train" as False and the size of the current dataset as 1 (containing your input sentence).
How do I save the trained model?
How do I load the saved model?
Hi
I've managed to setup and compile your project.
The script main.py runs without errors [see bottom for script output].
However, I can't figure out how to save a trained model and then use it.
I.e. let's say I have an input text file with one line
"Wasted so much money on previous laptops - why did I not buy this from the start.... Extremely happy with this product!"
How do I train the model, i.e. using the 14semeval_laptop dataset, and then use the model on my input text file?
Encase you need to send me something, my email is jackrobsongateshead@gmail.com
This is what I get when I run the main.py: $ python3 main.py -n_epoch 1 [dynet] random seed: 1314159 [dynet] allocating memory: 4096MB [dynet] memory allocation done. N opinion: 3041 N dataset: 3041 N opinion: 800 N dataset: 800 Use the saved word embeddings Embeddings shape: (5302, 300) Use case-insensitive word embeddings Parameters: Namespace(attention_type='bilinear', dim_asp=100, dim_opi=30, dim_w=300, dropout=0.5, dropout_asp=0.5, dropout_opi=0.5, ds_name='14semeval_rest', dynet_seed=1314159, flag='glove_840B', model_name='full', n_asp_tags=3, n_epoch=1, n_opi_tags=2, n_steps=5, optimizer='sgd', random_seed=1234, rnn_type='LSTM', running_mode='train-test', sgd_lr=0.07, win=3) Use pretrained word embeddings In Epoch 1 / 1: The dy.parameter(...) call is now DEPRECATED. There is no longer need to explicitly add parameters to the computation graph. Any used parameter will be added automatically. train loss: 18462.82, train precision: 67.54, train recall: 59.55, train f1: 63.29 Current results: precision: 81.03, recall: 77.60, f1: 79.27 $