0

I'm using Kaggle to generate poetry samples with GPT-2. My notebook uses datasets from Gwern's poetry generator and uses nshepperd's GPT-2 model.

This all works fine with my notebook when generating unconditional samples.

!python src/generate_unconditional_samples.py --top_k 40 --nsamples 1 --temperature 0.9 --model_name=1.5b-model --length=300

enter image description here

However, I want to generate samples with the "interactive conditional" method:

!python src/interactive_conditional_samples.py --top_k 40 --nsamples 10 --temperature 0.9 --model_name=1.5b-model --length=300

The problem is when it requests a "model prompt" and I have no way of entering a prompt.

enter image description here

It doesn't work when I enter a prompt in Kaggle's CLI.

enter image description here

If I were to run this on my desktop using my own computing power it would automatically allow me to enter text in response to the prompt.

enter image description here

Is there a way for me to enter a prompt in kaggle?

I've tried to auto respond using flags, like how you would use -y to auto accept a yes/no prompt in installs, but it hasn't worked so far.

The notebook is public here if you want to test it out.

theo
  • 65
  • 2
  • 10
  • I don't know how to run your code. If I create a cell with `print(input("what?"))`, it presents a box and allows me to type. You should have the same option. – Tim Roberts Apr 28 '22 at 17:19
  • @TimRoberts Thanks for the response, not sure how familiar you are with Kaggle but following the link to my notebook - you have to click "copy & edit" > then to run it press **"run all"** - it helps if you have an account to access their GPU. The last 2 cells are the "unconditional" and "interactive conditional" samples I mentioned in the question. **Comment out whichever one you don't want to test**. You can also change the `--nsamples x` value to only generate 1 sample to save processing time. – theo Apr 29 '22 at 12:02
  • You could probably use output redirection. Something like `!python do_stuff.py < $(echo "this is my input")` – ForceBru Apr 29 '22 at 17:06
  • Like this? `!python src/interactive_conditional_samples.py --top_k 40 --nsamples 1 --temperature 0.9 --model_name=1.5b-model --length=300 < $(echo "this is my input")` I get an ambiguous redirect error when i try that. – theo Apr 30 '22 at 17:40

0 Answers0