Skip to content

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #282

@lincit

Description

@lincit

When Starting training for epochs, a RuntimeError happened.

Using torch 1.13.1 CUDA:0 (NVIDIA GeForce GTX 1650, 4095MB)
...
Epoch gpu_mem box obj cls total targets img_size
0%| | 0/8985 [00:05<?, ?it/s]
Traceback (most recent call last):
File "D:/browser/cgan/yolor/train.py", line 537, in
train(hyp, opt, device, tb_writer, wandb)
File "D:/browser/cgan/yolor/train.py", line 288, in train
loss, loss_items = compute_loss(pred, targets.to(device), model) # loss scaled by batch_size
File "D:\browser\cgan\yolor\utils\loss.py", line 66, in compute_loss
tcls, tbox, indices, anchors = build_targets(p, targets, model) # targets
File "D:\browser\cgan\yolor\utils\loss.py", line 149, in build_targets
a, t = at[j], t.repeat(na, 1, 1)[j] # filter
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

Please help me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions