-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add knowledge_distillation_tutorial #2514
Add knowledge_distillation_tutorial #2514
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2514
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit cafd91e with merge base e7c86fd (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Hi @AlexandrosChrtn! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
❌ Deploy Preview for pytorch-tutorials-preview failed.
|
@svekars Hello! I get this when deploying, looks related to recent changes in requirements.txt
|
@AlexandrosChrtn if you are referring to the Netlify error, it can be safely ignored for now. GitHub Actions checks are the ones we are looking at. |
Can you please add a better description for this tutorial describing how the PyTorch community benefits from this tutorial? |
@svekars Added a short description with bullets. Let me know if you need anything else! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
]) | ||
|
||
# Data preprocessing for CIFAR-10 | ||
transform_test = transforms.Compose([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the same as train one?
soft_targets = nn.functional.softmax(teacher_logits / T, dim=-1) | ||
soft_prob = nn.functional.log_softmax(student_logits / T, dim=-1) | ||
|
||
# Calculate the soft targets loss. Scaled by T**2 as suggested by the authors of the paper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which paper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update.
That sounds good to me cc @svekars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much, @AlexandrosChrtn. I added some editorial suggestions. A couple of things, in addition to that:
- Can you some headings that would better break your tutorial to sections (I made some suggestions in my review)
- Please break lines at 79 symbols where possible so that it's easier to edit in the future.
Let me know if you have any questions.
import torchvision.transforms as transforms | ||
import torchvision.datasets as datasets | ||
|
||
# Ignore warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an explanation to the comment why we ignore them
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | ||
|
||
###################################################################### | ||
# CIFAR-10 is a popular image dataset with 10 classes. Our objective is to predict one of the following classes for each input image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a heading 2 here?
Also, make sure to check the html output here and fix the spellcheck by enclosing CosineLoss in double backticks (``). |
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Co-authored-by: Svetlana Karslioglu <[email protected]>
Thanks everyone for the insightful suggestions! @svekars I think I fixed everything based on your proposals, except for the conclusion part, where it feels repetitive to state everything the user learned, becuase we do so in the beginning, however I can still add a few lines if you think it's best. I added sections and removed the lines about filtering warnings. The only reason they were there at the first place is because I saw them in other tutorials (I speculate people add them because of deprecation warnings due to version mismatches and what not). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final cleanup
Editorial clean up
* Add knowledge_distillation_tutorial --------- Co-authored-by: Svetlana Karslioglu <[email protected]>
Includes a Knowledge distillation tutorial.
From this tutorial one can learn: