vanillaer / CPL-ICML2024

[ICML 2024] Offical code repo for ICML2024 paper "Candidate Pseudolabel Learning: Enhancing Vision-Language Models by Prompt Tuning with Unlabeled Data"
10 stars 0 forks source link

Fix: Frequent "RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)" Errors #1

Open Chrisqcwx opened 1 month ago

Chrisqcwx commented 1 month ago

Description

I've encountered multiple instances of the following error while using the source code: "RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)"

Details:

First Occurrence:

To resolve this, I made a modification at line 187, which temporarily fixed the issue.

Next Occurrence:

ITD6P)A~2Q(AM(K%8 RA17G

Concern:

There may be other similar errors throughout the codebase. Could you please review and fix these issues?

Thank you for your assistance!

vanillaer commented 1 month ago

Hi @Chrisqcwx,

Thank you for bringing this to our attention with the CPL project. Actually, I didn't encounter the problem you mentioned. I can confirm that the code operates smoothly when following the instructions provided in the README.md, as this has been thoroughly tested.

It's possible that the issue you're experiencing is related to a different version of PyTorch/CUDA. I'm sharing a linkthat might shed some light on this matter. One way to solve this problem is to keep the verions of the packages the same as those listed in the requirements.txt.