Comments (4)
I was wondering if the multiplication of T square is really helpful? Because if T=20, the soft loss will dominate the total loss. And there is no need to add extra softmax for the hard target as it is already embedded in nn.functional.cross_entropy. @lhyfst
from knowledge-distillation-pytorch.
As @erichhhhho pointed out, it's indeed no need to manually add extra softmax. From the reference paper, it looks like T^2 is only required when using BOTH hard/soft targets.
from knowledge-distillation-pytorch.
Thank you, everybody! So, why does the first part of the KD loss function in distill_mnist.py multiply 2?
https://github.com/peterliht/knowledge-distillation-pytorch/blob/e4c40132fed5a45e39a6ef7a77b15e5d389186f8/mnist/distill_mnist.py#L96-L97
from knowledge-distillation-pytorch.
Thank you, everybody! So, why does the first part of the KD loss function in distill_mnist.py multiply 2?
As per distiller KD_Loss is effectively the following equation:
α * kl_divergence + β * cross_entropy
And Hinton et al. 2015 originally used a weighted average, i.e. α = 1 - β
, but this is not strictly necessary. α and β can also be arbitrary and don't need to sum to 1. In this particular MNIST example, the relationship is α = 2 * (1 - β)
, maybe they were experimenting with a stronger reliance on kl_div.
from knowledge-distillation-pytorch.
Related Issues (20)
- 'Tensor' object is not callable HOT 1
- Error Cuda HOT 1
- missing training log for base cnn
- Box folder HOT 6
- I see the fitnets for reference HOT 2
- I think I couldn't prove how cnn_distill has highter performance than base_cnn. HOT 1
- How to train my own dataset HOT 1
- Box Folder HOT 2
- Computing teacher outpouts is called only onece? HOT 1
- teacher model in eval() mode but still update gradients? HOT 1
- boxed folder HOT 3
- in mnist folder,why teacher_mnist and stdudent_mnist do not contain the softmax? HOT 3
- Requirements.txt is outdated? HOT 5
- Why student use log_softmax(), while teacher use softmax() ?
- Are the distilled student models available for download?
- About "reduction" built in KLDivLoss
- no module named torch._dynamo
- regression problem can use this method? HOT 2
- Is student net really learn what teacher output? HOT 8
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 knowledge-distillation-pytorch.