【发布时间】:2021-07-01 00:13:07
【问题描述】:
我在 google colab 上使用 roberta 的问答模型来处理推文情感提取问题。
但模型无法训练,因为我收到了 Resourceexhaustederror;
查看完整错误:
ResourceExhaustedError: OOM when allocating tensor with shape[32,16,128,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[node model/tf_roberta_model/roberta/encoder/layer_._17/attention/self/transpose (defined at /usr/local/lib/python3.7/dist-packages/transformers/models/roberta/modeling_tf_roberta.py:218) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
[Op:__inference_train_function_112984]...
在此处查看模型:
ids = Input((MAX_LEN,), dtype=tf.int32)
att = Input((MAX_LEN,), dtype=tf.int32)
bert_model = TFRobertaModel.from_pretrained('roberta-large')
x = bert_model(ids, attention_mask= att)
x1 = Dropout(0.1)(x[0])
x1 = Conv1D(1,1)(x1)
x1 = Flatten()(x1)
x1 = Activation('softmax')(x1)
x2 = Dropout(0.1)(x[0])
x2 = Conv1D(1,1)(x2)
x2 = Flatten()(x2)
x2 = Activation('softmax')(x2)
model = Model(inputs = [ids, att], outputs = [x1, x2])
如有任何帮助解决此错误,我们将不胜感激。
【问题讨论】:
标签: python tensorflow deep-learning gpu google-colaboratory