akshitac8 / tfvaegan

[ECCV 2020] Official Pytorch implementation for "Latent Embedding Feedback and Discriminative Features for Zero-Shot Classification". SOTA results for ZSL and GZSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot run zero-shot-actions

0xMarsRover opened this issue · comments

Hi Askshita,

I cannot run the task of zero-shot-actions. Some configurations are not clear in the codes. Fo example, opt.zsl_dec and opt.use_mult_rep are not defined in config.py. And, I am confused on these two files: classifier.py and classifier_entropy.py. Some variables are not defined as well. Can you check and update this repo?

Many thanks.

Hello @kaiqiangh
Thank you for letting me know the errors. I have updated the zero-shot actions files. Let me know if the error persists.

Thanks for your updates!

It solves the major errors, but I still get one more error.

for val_gzsl() in classifier_entropy.py file, the error comes from the codes below:
seen_mask = torch.Tensor(np.array(entropy)) < thresh

Error: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

I am running your codes in Colab. I am not sure the variable of "entropy" would be computed in CPU or GPU. It seems like "entropy" should be ran in cpu, but why this variable was put in gpu? I also tried to modify codes by:
seen_mask = torch.Tensor(np.array(entropy), device=device=torch.device('cpu')) < thresh

It does not work as well. Anu tips? Thanks!

Also, the same error comes from the codes below (in the same file)
acc_per_class += torch.sum((test_label[idx] == predicted_label[idx])*mask[idx]) / torch.sum(idx)

Hello @kaiqiangh, Did you made any other GPU related changes in the code?

Hi,

No, I did not change anything. I just used the updated codes by you. I am running it in Colab. It may be a reason

Hi @kaiqiangh,

If your code is fully on GPU even while running on colab you shouldn't face this type of issue. Let me know if the issue still persists I can have a look at your colab notebbok.

Regards,
Akshita

Thanks for your reply. Sorry to check this message so late.

Yes, I am running in Colab with GPU setting, but got the error below

File "/content/gzsl/zero-shot-actions/classifier_entropy.py", line 195, in compute_per_class_acc_gzsl acc_per_class += torch.sum((test_label[idx] == predicted_label[idx])*mask[idx]) / torch.sum(idx) RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Could you please have a look at it? Thanks.

By the way, this error only occurred when enabling "gzsl_od". (It works fine when enabling "zsl"). I think the problem is only about some calculations for variables in the file of "classifier_entropy.py"

Hi @kaiqiangh. Can you share your colab notebook link. So that I look clearly at what is happening?

Thanks. It has been solved. Just put a variable to be computed on CPU, then it works.