-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: The pointer[tensor] is null. #1605
Labels
bug
Something isn't working
Comments
要用mindspore2.3 |
复现代码提供完整的 |
数据类型有问题 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug/ 问题描述 (Mandatory / 必填)
GPU环境 TrOCR预训练模型微调 求梯度时报错 RuntimeError: The pointer[tensor] is null.
Ascend
/GPU
/CPU
) / 硬件环境:Software Environment / 软件环境 (Mandatory / 必填):
-- MindSpore version (e.g., 1.7.0.Bxxx) : MindSpore 2.2.14
-- Python version (e.g., Python 3.7.5) :Python 3.9.19
-- OS platform and distribution (e.g., Linux Ubuntu 16.04):ubuntu18.04
-- GCC/Compiler version (if compiled from source):7.5
Excute Mode / 执行模式 (Mandatory / 必填)(
PyNative
/Graph
):To Reproduce / 重现步骤 (Mandatory / 必填)
model<mindnlp.transformers.models.vision_encoder_decoder.modeling_vision_encoder_decoder.VisionEncoderDecoderModel object>
dataset<mindspore.dataset.engine.datasets.BatchDataset object >
运行代码
'''
for epoch in range(1):
# train
model.train()
train_loss = 0.0
for bacth in tqdm(eval_dataloader.create_dict_iterator()):
pixel_values = bacth['pixel_values']
labels = bacth['labels']
def compute_loss(pixel_values, labels):
outputs = model(pixel_values=pixel_values, labels=labels)
loss = outputs.loss
return loss
grad_fn = mindspore.value_and_grad(fn=compute_loss, weights=model.parameters())
loss, grads = grad_fn(pixel_values, labels)
optimizer.step(loss)
'''
Expected behavior / 预期结果 (Mandatory / 必填)
正常运行
Screenshots/ 日志 / 截图 (Mandatory / 必填)
If applicable, add screenshots to help explain your problem.
Additional context / 备注 (Optional / 选填)
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: