繁体   English   中英

我在 google colab 上运行我的代码。 我收到 RuntimeError: CUDA 错误:设备端断言已触发。错误显示为 torch.manual_seed(seed)

[英]I am running my code on google colab. Am getting RuntimeError: CUDA error: device-side assert triggered.Error is showing for torch.manual_seed(seed)

import random
total_steps = 1
seed = 42
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)

下面是在 () 4 random.seed(seed) 5 np.random.seed(seed) ----> 6 torch.manual_seed(seed) 7 torch.cuda 中获取 RuntimeError Traceback (most recent call last) 的错误。 manual_seed_all(种子) 8 tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

3 frames
/usr/local/lib/python3.7/dist-packages/torch/cuda/random.py in cb()
    109         for i in range(device_count()):
    110             default_generator = torch.cuda.default_generators[i]
--> 111             default_generator.manual_seed(seed)
    112 
    113     _lazy_call(cb, seed_all=True)

RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

请检查device_count()的 output。 您可以使用超出范围的索引。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM