gpt-2-simple icon indicating copy to clipboard operation
gpt-2-simple copied to clipboard

How to read a text file lines as input prompts for generate function?

Open GenTxt opened this issue 4 years ago • 2 comments

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 avatar Mar 14 '20 21:03 GenTxt

@GenTxt Did you find a solution ?

hafsahabib-educator avatar Jul 10 '20 16:07 hafsahabib-educator

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.

xaedes avatar Aug 04 '20 22:08 xaedes