GithubHelp home page GithubHelp logo

Comments (7)

RElbers avatar RElbers commented on June 8, 2024

Are you sure that you want self.c_contrastive to be a Parameter? It will also get the gradient of the loss, unless you set requires_grad=False in the constructor. Minimizing the loss will minimize self.c_contrastive, causing it to become negative.

from info-nce-pytorch.

evelynlee999 avatar evelynlee999 commented on June 8, 2024

Yeah, I want it be a weight of InfoNce and can participate in training to get the best result. I'll give it try. Thanks a lot.

from info-nce-pytorch.

Yuntian9708 avatar Yuntian9708 commented on June 8, 2024

For joint loss, I set weights of infonce loss or other loss I used as hyperparameter, instead of a parameter during optimizing. In my opinion, setting hyperparameter is a good way.

from info-nce-pytorch.

evelynlee999 avatar evelynlee999 commented on June 8, 2024

from info-nce-pytorch.

evelynlee999 avatar evelynlee999 commented on June 8, 2024

from info-nce-pytorch.

Yuntian9708 avatar Yuntian9708 commented on June 8, 2024

这个想法听着可行,您可以试试看看效果。我感觉损失的设计还是要紧密结合任务,看infonce loss在您的任务中具体起什么作用。比如我是少样本的分类问题,希望通过对比学习更丰富的Latent representation,我的损失就是两个infonce和一个分类的交叉熵: total loss = ce_loss+αinfonce1+βinfonce2, α和β都是超参,调就可以了。我感觉多个损失联合优化时权重超参的设置对模型表现影响挺大的。

from info-nce-pytorch.

evelynlee999 avatar evelynlee999 commented on June 8, 2024

from info-nce-pytorch.

Related Issues (16)

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.