Skip to content
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

[CodeCamp2023-526] Kullback-Leibler divergence Loss implementation #3242

Merged
merged 9 commits into from
Aug 28, 2023

Conversation

zen0no
Copy link
Contributor

@zen0no zen0no commented Aug 2, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

It's OpenMMLab Codecamp task.

Modification

Implementd Kullback-Leibler divergence loss and also added tests for it.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Aug 2, 2023

CLA assistant check
All committers have signed the CLA.

@xiexinch xiexinch changed the base branch from main to dev-1.x August 4, 2023 08:26
@xiexinch
Copy link
Collaborator

xiexinch commented Aug 4, 2023

Hi @zen0no,
Thanks for your contribution!
Please fix the lint error.

@crazysteeaam
Copy link
Contributor

Hi @zen0no,
Could you please prefix the PR title with [CodeCamp2023-526]? Thank you!

@zen0no zen0no changed the title Kullback-Leibler divergence Loss implementation [CodeCamp2023-526] Kullback-Leibler divergence Loss implementation Aug 17, 2023
@zen0no
Copy link
Contributor Author

zen0no commented Aug 17, 2023

Hi @crazysteeaam,
I have a problem with lint. When I check all hooks with pre-commit on my local machine, it passes, but it fails on yapf test in circleci

Link for the problem in circleci: https://app.circleci.com/pipelines/github/open-mmlab/mmsegmentation/1751/workflows/0f284d64-9863-477b-a1c7-569668b4aa31/jobs/5655?invite=true#step-103-46

@OpenMMLab-Assistant-004

Hi @zen0no,

We'd like to express our appreciation for your valuable contributions to the mmsegmentation. Your efforts have significantly aided in enhancing the project's quality.
It is our pleasure to invite you to join our community thorugh Discord_Special Interest Group (SIG) channel. This is a great place to share your experiences, discuss ideas, and connect with other like-minded people. To become a part of the SIG channel, send a message to the moderator, OpenMMLab, briefly introduce yourself and mention your open-source contributions in the #introductions channel. Our team will gladly facilitate your entry. We eagerly await your presence. Please follow this link to join us: ​https://discord.gg/UjgXkPWNqA.

If you're on WeChat, we'd also love for you to join our community there. Just add our assistant using the WeChat ID: openmmlabwx. When sending the friend request, remember to include the remark "mmsig + Github ID".

Thanks again for your awesome contribution, and we're excited to have you as part of our community!

Comment on lines 67 to 68
loss = loss * self.temperature * self.temperature

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
loss = loss * self.temperature * self.temperature
loss = loss * self.temperature**2

@MODELS.register_module()
class KLDivLoss(nn.Module):

def __init__(self, temperature=1.0, reduction='mean'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might add type hints.

@xiexinch xiexinch merged commit 8233e64 into open-mmlab:dev-1.x Aug 28, 2023
8 of 10 checks passed
emily-lin pushed a commit to emily-lin/mmsegmentation that referenced this pull request Nov 18, 2023
…pen-mmlab#3242)

Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

It's OpenMMLab  Codecamp task.

## Modification

Implementd Kullback-Leibler divergence loss and also added tests for it.

## Checklist

1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
…pen-mmlab#3242)

Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

It's OpenMMLab  Codecamp task.

## Modification

Implementd Kullback-Leibler divergence loss and also added tests for it.

## Checklist

1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants