rpryzant / delete_retrieve_generate

PyTorch implementation of the Delete, Retrieve Generate style transfer algorithm
MIT License
132 stars 26 forks source link

Inference Mode #17

Closed abhinavkashyap closed 4 years ago

abhinavkashyap commented 4 years ago

Hi,

Thank you for this implementation. Is there any script that can load lines from a text file and perform inference on the trained model ?

The evaluate.inference_metrics is useful only when there is a reference test dataset. If we do not have one, is there a way to use the model for inference on sentences ?

rpryzant commented 4 years ago

So what you can do is point src_test and tgt_test at the same file in your config: https://github.com/rpryzant/delete_retrieve_generate/blob/master/yelp_config.json#L14

and then the metrics will be screwed up but the system should properly perform inference on the source senences: https://github.com/rpryzant/delete_retrieve_generate/blob/master/train.py#L75

abhinavkashyap commented 4 years ago

Thanks for that :) Yes. I did that...but the best model is saved according to the BLEU score. The problem setting assumes that there is no reference dataset and everything is based on reconstruction loss, if I am not wrong. Should not the model work when there is no reference dataset ?

Also, it becomes difficult to test on different sentences once the model is trained. We will have to train the model every time we want to test on a new dataset. :) It would be good if there is a way for just loading the model and taking the sentences. If I can help in any way to achieve this, that would be good :)

rpryzant commented 4 years ago

I see, I added an inference file, hopefully that should satisfy your request!

https://github.com/rpryzant/delete_retrieve_generate/blob/master/inference.py

abhinavkashyap commented 4 years ago

Thank you for the quick responses. I really appreciate it. I will give it a try and update this thread. Thank you