ykdai / BasicPBC

Official Implementation of "Learning Inclusion Matching for Animation Paint Bucket Colorization"
Other
233 stars 23 forks source link

what's the pytorch ,cuda and python version plz #4

Closed shawnl111 closed 5 months ago

shawnl111 commented 5 months ago

I'm training on torch2.2.1 and cuda11.8 on widows11

shawnl111 commented 5 months ago

probelm [(data["segment"] == ii + 1).sum() for ii in torch.arange(0, all_matches_origin[0].shape[0])[all_matches_origin[0] == indices0[0]]] RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

shawnl111 commented 5 months ago

in basicpbc_arch.py change

            # area_accuracy = torch.tensor(             #     [(data["segment"] == ii + 1).sum() for ii in torch.arange(0, all_matches_origin[0].shape[0])[all_matches_origin[0] == indices0[0]]]             # ).sum() / (weights.sum() * 1.0)

to indices_new = torch.arange(0, all_matches_origin[0].shape[0]).to(all_matches_origin[0].device) area_accuracy = torch.tensor([(data["segment"] == ii + 1).sum() for ii in indices_new[all_matches_origin[0] == indices0[0]]]).sum() / (weights.sum() * 1.0)

fixed it

torch.arange() will create tensors on CPU by default

dienachtderwelt commented 5 months ago

Hi! Thank you for your feedback. torch version 1.12.1, cuda version 12.2, python version 3.9.12.

dienachtderwelt commented 5 months ago

in basicpbc_arch.py change

            # area_accuracy = torch.tensor(             #     [(data["segment"] == ii + 1).sum() for ii in torch.arange(0, all_matches_origin[0].shape[0])[all_matches_origin[0] == indices0[0]]]             # ).sum() / (weights.sum() * 1.0)

to indices_new = torch.arange(0, all_matches_origin[0].shape[0]).to(all_matches_origin[0].device) area_accuracy = torch.tensor([(data["segment"] == ii + 1).sum() for ii in indices_new[all_matches_origin[0] == indices0[0]]]).sum() / (weights.sum() * 1.0)

fixed it

torch.arange() will create tensors on CPU by default

problem fixed. Thank you so much!