salesforce / ctrl

Conditional Transformer Language Model for Controllable Generation
https://arxiv.org/abs/1909.05858
BSD 3-Clause "New" or "Revised" License
1.87k stars 208 forks source link

Enhancement request: How to read prompts from a text file? #48

Closed GenTxt closed 5 years ago

GenTxt commented 5 years ago

Thanks for the cool model and repo. New to python and pytorch. Using ubuntu 18.04 and python 3.6.8 Have inference working fine using 512 and 256 models with prompt on local 8 gig gpu.

I would appreciate if you could suggest coding change that would allow pytorch_generation.py to read an input text file line-by-line instead of manually entering each prompt.

Format of text file would be same as prompt.

For example:

Books This is the first line. Books This is the second line. Books This is the third line. etc.

Cheers.

GenTxt commented 5 years ago

Nice to see a repo that uses a simple < for input text file using a prompt. Works 100% Closing non-issue.