如何回应Kaggle中的CLI提示?

发布于 2025-01-25 07:41:06 字数 1827 浏览 0 评论 0原文

我正在使用Kaggle生成具有GPT-2的诗歌样本。我的笔记本使用来自并使用 nshepperd的gpt-2模型

这一切都可以很好地与我的笔记本生成无条件样品。

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

但是,我想生成“交互式条件”方法的样本:

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

问题是当它请求“模型提示” 时,我无法输入提示。

当我在Kaggle的CLI中输入提示时,它不起作用。

如果我使用自己的计算能力在桌面上运行此功能,它将自动允许我输入文本以响应提示。

有没有办法在Kaggle中输入提示?

我尝试使用标志自动响应,例如您将如何使用-y自动接受是是的/安装中没有提示,但是到目前为止尚未工作。

如果您想对其进行测试,请在这里进行公开。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

总以为 2025-02-01 07:41:06

为此,您必须创建一个存储所需输入的文件。

!echo your_input > /kaggle/input.txt

注意您的工作目录可能只读,因此您可能必须写入Kaggle目录。
接下来,运行命令,将文件作为输入

!python do_stuff.py < /kaggle/input.txt

提供一个简单的方法

<input> |

在命令之前添加。喜欢

!yes | sudo apt-get upgrade

输入“是”作为对“ apt-get Update”的响应。

To do this, you have to create a file that stores the input you want.

!echo your_input > /kaggle/input.txt

Note that your working directory might be read-only, so you might have to write to the kaggle directory instead.
Next, run your command, giving the file as input

!python do_stuff.py < /kaggle/input.txt

A simpler method would be to add

<input> |

before your command. Like

!yes | sudo apt-get upgrade

to input "yes" as a response to "apt-get update".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文