您好,运行example/re/standard/run.py报错
Describe the question
程序会卡特别久,提醒信息如下
This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPretraining model).
This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/rnn.py:47: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.3 and num_layers=1
warnings.warn("dropout option adds dropout after all but last "
卡很久之后 报错信息如下
)
[2022-04-19 11:26:20,159][main][INFO] - ========== Start training ==========
Traceback (most recent call last):
File "run.py", line 162, in cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)
wandb: Waiting for W&B process to finish, PID 15885... (failed 1). wandb: You can sync this run to the cloud by running: wandb: wandb sync /data/sen/DeepKE/example/re/standard/logs/2022-04-19_11-17-16/wandb/offline-run-20220419_111718-2zdxarri wandb: Find logs at: ./logs/2022-04-19_11-17-16/wandb/offline-run-20220419_111718-2zdxarri/logs/debug.log wandb:
Environment (please complete the following information): 使用显卡为 NVIDIA GeForce RTX 3090
Screenshots
If applicable, add screenshots to help explain your problem.
![]()
Additional context
Add any other context about the problem here.
您好,引起上述错误的原因有很多种,建议您着重检查一下是否存在输入的矩阵维度与函数需求的维度不匹配的问题,详细请参考https://stackoverflow.com/questions/66600362/runtimeerror-cuda-error-cublas-status-execution-failed-when-calling-cublassge 以上意见仅供参考😊
代码未作任何修改 应该不是输入矩阵的问题 就是想跑通example
Describe the question 程序会卡特别久,提醒信息如下 This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPretraining model). This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). /root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/rnn.py:47: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.3 and num_layers=1 warnings.warn("dropout option adds dropout after all but last " 卡很久之后 报错信息如下 ) [2022-04-19 11:26:20,159][main][INFO] - ========== Start training ========== Traceback (most recent call last): File "run.py", line 162, in main() File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/main.py", line 32, in decorated_main _run_hydra( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/_internal/utils.py", line 346, in _run_hydra run_and_report( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/_internal/utils.py", line 201, in run_and_report raise ex File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/_internal/utils.py", line 198, in run_and_report return func() File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/_internal/utils.py", line 347, in lambda: hydra.run( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 107, in run return run_job( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/hydra/core/utils.py", line 127, in run_job ret.return_value = task_function(task_cfg) File "run.py", line 96, in main train_loss = train(epoch, model, train_dataloader, optimizer, criterion, device, writer, cfg) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/deepke/relation_extraction/standard/tools/trainer.py", line 36, in train y_pred = model(x) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/deepke/relation_extraction/standard/models/LM.py", line 22, in forward a = self.bert(word, attention_mask=mask) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/transformers/modeling_bert.py", line 833, in forward encoder_outputs = self.encoder( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/transformers/modeling_bert.py", line 476, in forward layer_outputs = layer_module( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/transformers/modeling_bert.py", line 398, in forward self_attention_outputs = self.attention( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/transformers/modeling_bert.py", line 333, in forward self_outputs = self.self( File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/transformers/modeling_bert.py", line 240, in forward mixed_query_layer = self.query(hidden_states) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 87, in forward return F.linear(input, self.weight, self.bias) File "/root/anaconda3/envs/lian/lib/python3.8/site-packages/torch/nn/functional.py", line 1612, in linear output = input.matmul(weight.t()) RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling
cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)wandb: Waiting for W&B process to finish, PID 15885... (failed 1). wandb: You can sync this run to the cloud by running: wandb: wandb sync /data/sen/DeepKE/example/re/standard/logs/2022-04-19_11-17-16/wandb/offline-run-20220419_111718-2zdxarri wandb: Find logs at: ./logs/2022-04-19_11-17-16/wandb/offline-run-20220419_111718-2zdxarri/logs/debug.log wandb:
Environment (please complete the following information): 使用显卡为 NVIDIA GeForce RTX 3090
Screenshots
If applicable, add screenshots to help explain your problem.
![]()
Additional context
Add any other context about the problem here.
根据提醒信息和第一张图的报错推测您可能用错模型了,请检查 https://github.com/zjunlp/DeepKE/blob/main/example/re/standard/conf/config.yaml 里model是否为可选参数,transformers版本是否正确。
torch和transformers版本如下
import torch torch.version '1.5.0+cu101' torch.cuda.is_available() True import transformers transformers.version '3.4.0'
config.yaml中model参数设置是lm
3090显卡上torch1.5的版本过低了,可以试试1.10哈
3090显卡上torch1.5的版本过低了,可以试试1.10哈
太感谢了 问题解决了 torch版本改为1.8可以了
