Comments (7)
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.
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.
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.
from info-nce-pytorch.
from info-nce-pytorch.
这个想法听着可行,您可以试试看看效果。我感觉损失的设计还是要紧密结合任务,看infonce loss在您的任务中具体起什么作用。比如我是少样本的分类问题,希望通过对比学习更丰富的Latent representation,我的损失就是两个infonce和一个分类的交叉熵: total loss = ce_loss+αinfonce1+βinfonce2, α和β都是超参,调就可以了。我感觉多个损失联合优化时权重超参的设置对模型表现影响挺大的。
from info-nce-pytorch.
from info-nce-pytorch.
Related Issues (16)
- reduction mode HOT 1
- Contribute to PyTorch? HOT 2
- should I add parameters of InfoNCE to optimizer for optimizing? HOT 3
- Questions about codes for negative key is None HOT 10
- How to import info-nce-pytorch HOT 2
- [Issue] InfoCE rather than InfoNCE
- Question about input data
- i have one question for the part of code HOT 7
- Correspondance between query and negative_key HOT 2
- calculate similarity for 3-dim input HOT 1
- Do you have infoNCE loss function cpde HOT 1
- about loss parameter HOT 1
- multiple positive sampels per query HOT 4
- Minimizing this loss function will minimize or maximize mutual information? HOT 3
- Why do you use cross entropy ? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from info-nce-pytorch.