shentianxiao / language-style-transfer

Apache License 2.0
553 stars 135 forks source link

How do you sample the result? #9

Closed sheonhan closed 6 years ago

sheonhan commented 6 years ago

torch-rnn seems to have a script that we can sample some results after training. Is there any way we can do the same thing here? If not, what would be the best way to go about doing it?

shentianxiao commented 6 years ago

There's an online_testing option. By running the command

python style_transfer.py --vocab ../model/yelp.vocab --model ../model/model --load_model true --online_testing true --beam 8

it will load a trained model, then you can input a style indicator and a sentence, and it will output the transferred sentence:

INFO:tensorflow:Restoring parameters from ../model/model
> 0 ok never going back to this place again .                 
original: just disappointed to go back this place again .
transfer: good place to go back again .
> 1 staff are very nice and efficient !
original: staff are very nice and efficient !
transfer: staff are very poor and was dead .
> exit

Is this what you are looking for?

sheonhan commented 6 years ago

This is it. Thanks!