小编Bha*_*iri的帖子

期望密集具有形状,但具有形状的阵列

在keras中运行文本分类模型时,调用model.predict函数时出现以下错误。我到处搜索,但对我来说不起作用。

ValueError: Error when checking input: expected dense_1_input to have shape (100,) but got array with shape (1,)
Run Code Online (Sandbox Code Playgroud)

我的数据有5个类,总共只有15个示例。以下是数据集

             query        tags
0               hi       intro
1      how are you       wellb
2            hello       intro
3        what's up       wellb
4       how's life       wellb
5              bye          gb
6    see you later          gb
7         good bye          gb
8           thanks   gratitude
9        thank you   gratitude
10  that's helpful   gratitude
11      I am great  revertfine
12            fine  revertfine
13       I am fine  revertfine
14            good  revertfine
Run Code Online (Sandbox Code Playgroud)

这是我模型的代码 …

python shape text-classification keras

10
推荐指数
1
解决办法
1万
查看次数

在重新训练 GPT 2 模型期间出现“资源耗尽:分配张量时出现 OOM”:

我使用 Friends Dialogues 作为数据集来训练使用 GPT-2 进行对话式 AI,但是,它显示我内存不足。我知道这个问题已经在 StackOverflow 上得到解决,但我无法弄清楚 NLP 任务的优化。

我尝试将批量大小设置为 50(我的数据集大约有 60k 行)。我一直在关注有关在自定义数据集上重新训练 GPT-2 的教程

我的系统规格是: 操作系统:Windows 10 RAM:16 GB CPU:i7 第 8 代 GPU:4GB Nvidia GTX 1050Ti

这是整个错误信息

Resource exhausted: OOM when allocating tensor with shape[51200,2304] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
Traceback (most recent call last):
  File "C:\Users\bhave\AppData\Local\conda\conda\envs\tf_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1334, in _do_call
    return fn(*args)
  File "C:\Users\bhave\AppData\Local\conda\conda\envs\tf_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1319, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "C:\Users\bhave\AppData\Local\conda\conda\envs\tf_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1407, in _call_tf_sessionrun
    run_metadata) …
Run Code Online (Sandbox Code Playgroud)

python memory-management gpu tensorflow tensor

4
推荐指数
1
解决办法
5129
查看次数

针对对话式 AI 微调 GPT-2 文本预测

我正在尝试 gpt-2 模型的条件文本生成,以将其调整为一个好的聊天机器人。我正在使用nsheppard 的代码在我的自定义数据集上重新训练它。

我在从 Facebook 数据中提取的自定义对话数据集上训练了我的模型。我将样本长度更改为 20,因为它们是交互式条件生成期间的对话。

数据集看起来像这样:

 How are you 
 Hi Great and you 
 Am also good 
 So you re a graphic designer  
 Yeah 
 How can you contribute to making the game In d graphics aspect 
 Can you show me some of your work if u don t mind  
 Am planning to learn making it a motion type    
 U can go through my photos 
 K 
 Can you make animations for it  
 Flash animations to be specific …
Run Code Online (Sandbox Code Playgroud)

python nlp chatbot tensorflow gpt-2

3
推荐指数
1
解决办法
5602
查看次数