Code Monkey home page Code Monkey logo

Comments (10)

yanbeic avatar yanbeic commented on June 11, 2024

Hi,

The problem is caused by the ucf101_json.py, which is updated now.
Could you try with the new ucf101_json.py file? The problem should be resolved now.

Thanks.

from ccl.

Not-IITian avatar Not-IITian commented on June 11, 2024

Hi,

Thank you it fixed the previous issue. but now i get the following error:

No such file or directory: 'results/ucf51_ccl_ai/val.json

from ccl.

Not-IITian avatar Not-IITian commented on June 11, 2024

and this error during training:

File "main.py", line 569, in
main_worker(-1, opt)
File "main.py", line 516, in main_worker
train_ai_epoch(epoch=i, data_loader=train_loader, model=model, image_model=image_model,
File "/home/abhishek/abhi_scr/CCL/training.py", line 409, in train_ai_epoch
loss_vm = criterion_ct_iv(features, features_iv, targets) + criterion_ct_iv(features_iv, features, targets)
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/abhishek/abhi_scr/CCL/loss/nce_loss.py", line 34, in forward
log_pos_softmax = - torch.log(pred_softmax + EPISILON) * (1 - self_mask).float()
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/tensor.py", line 396, in rsub
return _C._VariableFunctions.rsub(self, other)
RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead.

from ccl.

yanbeic avatar yanbeic commented on June 11, 2024

Hi,
Have you trained and tested the model successfully?
After training, there will be three log files in the folder: train.log train_batch.log val.log.
After testing, there will be a json file: val.json.

You could probably check if these files are ready to see whether the training or testing is missing. It is likely that the training or testing has not been done that caused missing the val.json file.

from ccl.

yanbeic avatar yanbeic commented on June 11, 2024

For the training error, it is likely to be caused by pytorch version. which version is used? the default version is 1.1.0

from ccl.

yanbeic avatar yanbeic commented on June 11, 2024

and this error during training:

File "main.py", line 569, in
main_worker(-1, opt)
File "main.py", line 516, in main_worker
train_ai_epoch(epoch=i, data_loader=train_loader, model=model, image_model=image_model,
File "/home/abhishek/abhi_scr/CCL/training.py", line 409, in train_ai_epoch
loss_vm = criterion_ct_iv(features, features_iv, targets) + criterion_ct_iv(features_iv, features, targets)
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/abhishek/abhi_scr/CCL/loss/nce_loss.py", line 34, in forward
log_pos_softmax = - torch.log(pred_softmax + EPISILON) * (1 - self_mask).float()
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/tensor.py", line 396, in rsub
return _C._VariableFunctions.rsub(self, other)
RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead.

the nce_loss.py file is updated, which could probably allow working in a newer PyTorch version.

from ccl.

Not-IITian avatar Not-IITian commented on June 11, 2024

Many Thanks. the problem with pytorch version still persist but I should be able to fix it as we know it is becuase of pytorch version.

from ccl.

Not-IITian avatar Not-IITian commented on June 11, 2024

Training code runs after downgrading the pytorch to 1.1.0. thanks

from ccl.

bellos1203 avatar bellos1203 commented on June 11, 2024

and this error during training:

File "main.py", line 569, in
main_worker(-1, opt)
File "main.py", line 516, in main_worker
train_ai_epoch(epoch=i, data_loader=train_loader, model=model, image_model=image_model,
File "/home/abhishek/abhi_scr/CCL/training.py", line 409, in train_ai_epoch
loss_vm = criterion_ct_iv(features, features_iv, targets) + criterion_ct_iv(features_iv, features, targets)
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/abhishek/abhi_scr/CCL/loss/nce_loss.py", line 34, in forward
log_pos_softmax = - torch.log(pred_softmax + EPISILON) * (1 - self_mask).float()
File "/home/abhishek/.local/lib/python3.8/site-packages/torch/tensor.py", line 396, in rsub
return _C._VariableFunctions.rsub(self, other)
RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead.

Hi.
The error stems from the compatibility of boolean operation for each pytorch version.
For the newer version of Pytorch, we can simply change the lines of nce_loss.py code as follow to run.

Line 34
log_pos_softmax = - torch.log(pred_softmax + EPISILON) * (1 - self_mask.float())
to
log_pos_softmax = - torch.log(pred_softmax + EPISILON) * ((~self_mask).float())

and

Line 36
log_softmax = log_pos_softmax.sum(1) / (1 - self_mask).sum(1).float() + log_neg_softmax.sum(1) / self_mask.sum(1).float()
to
log_softmax = log_pos_softmax.sum(1) / (~self_mask).sum(1).float() + log_neg_softmax.sum(1) / self_mask.sum(1).float()

Please correct me if anything wrong :)

from ccl.

yanbeic avatar yanbeic commented on June 11, 2024

Thanks for pointing it out. It looks correct to me.

from ccl.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.