gpt-2-simple
gpt-2-simple copied to clipboard
How to read a text file lines as input prompts for generate function?
Hello:
Thanks for the repo and the numerous updates. Have everything working fine except reading lines from a text file for 'gpt2.generate' function. Would like to read line-by-line instead of having to enter a single prompt each time for a single generated output.
Since it includes many functions of nshepperd's repo I was hoping a simple < redirect might work or some combination of piping but no luck. Have checked issues and forks for possible solution but haven't found one.
Maybe I missed a command? Any help is appreciated.
Cheers
@GenTxt Did you find a solution ?
I think this line needs to be adjusted: https://github.com/minimaxir/gpt-2-simple/blob/master/gpt_2_simple/gpt_2.py#L476
The prefix
is repeated batch_size
times to build context
. I think you could use different prefixes there.