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

[Relax][Training] Loss functions #112

Merged
merged 17 commits into from
Jan 31, 2023

Conversation

SiriusNEO
Copy link
Contributor

@SiriusNEO SiriusNEO commented Jan 25, 2023

This PR introduces loss functions for relax training and provides a tool append_loss which enables user to append a loss after a forward function.

About the append_loss, some previous discussions can be found in #111.

Currently support:

  • L1Loss
  • MSELoss
  • CrossEntropyLoss

@SiriusNEO SiriusNEO marked this pull request as draft January 25, 2023 13:57
@SiriusNEO SiriusNEO changed the title [WIP][Relax][Training] Some loss functions [WIP][Relax][Training] Loss functions Jan 26, 2023
@SiriusNEO SiriusNEO changed the title [WIP][Relax][Training] Loss functions [Relax][Training] Loss functions Jan 27, 2023
@SiriusNEO SiriusNEO marked this pull request as ready for review January 27, 2023 20:17
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/__init__.py Outdated Show resolved Hide resolved
python/tvm/relax/training/utils.py Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
tests/python/relax/test_training_utils.py Show resolved Hide resolved
python/tvm/relax/training/_ffi_api.py Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
src/relax/training/utils.h Outdated Show resolved Hide resolved
src/relax/training/utils.h Outdated Show resolved Hide resolved
tests/python/relax/test_training_loss.py Outdated Show resolved Hide resolved
tests/python/relax/test_training_loss.py Outdated Show resolved Hide resolved
tests/python/relax/test_training_utils.py Outdated Show resolved Hide resolved
python/tvm/relax/__init__.py Outdated Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/optimizer.py Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
python/tvm/relax/training/loss.py Outdated Show resolved Hide resolved
src/relax/training/utils.h Outdated Show resolved Hide resolved
python/tvm/relax/training/utils.py Show resolved Hide resolved
tests/python/relax/test_utils.py Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
src/relax/training/utils.cc Outdated Show resolved Hide resolved
@MasterJH5574 MasterJH5574 merged commit 38ac587 into mlc-ai:relax Jan 31, 2023
MasterJH5574 pushed a commit that referenced this pull request Jan 31, 2023
This PR introduces loss functions for relax training and provides a tool
`append_loss` which enables user to append a loss after a forward
function.

About the `append_loss`, some previous discussions can be found in
#111.

Currently support:
-  L1Loss
-  MSELoss
- CrossEntropyLoss
@MasterJH5574
Copy link
Member

Thanks folks. Keep up with great works!

MasterJH5574 pushed a commit that referenced this pull request Feb 8, 2023
The pattern field of the match shape can define variables,
as a result, we need to add DefEqual and Hash here.

Added a regression testcase.

Lesson: we would benefit from more testcases
with check_save_roundtrip checks(like this one) for more relax example.

Additional change:
- Redirected TVMScript printer to be able to print relax fragements useful for debugging.
MasterJH5574 pushed a commit that referenced this pull request Feb 8, 2023
This PR introduces loss functions for relax training and provides a tool
`append_loss` which enables user to append a loss after a forward
function.

About the `append_loss`, some previous discussions can be found in
#111.

Currently support:
-  L1Loss
-  MSELoss
- CrossEntropyLoss
spectrometerHBH pushed a commit to spectrometerHBH/relax that referenced this pull request Feb 9, 2023
The pattern field of the match shape can define variables,
as a result, we need to add DefEqual and Hash here.

Added a regression testcase.

Lesson: we would benefit from more testcases
with check_save_roundtrip checks(like this one) for more relax example.

Additional change:
- Redirected TVMScript printer to be able to print relax fragements useful for debugging.
MasterJH5574 pushed a commit that referenced this pull request Feb 12, 2023
This PR introduces loss functions for relax training and provides a tool
`append_loss` which enables user to append a loss after a forward
function.

About the `append_loss`, some previous discussions can be found in
#111.

Currently support:
-  L1Loss
-  MSELoss
- CrossEntropyLoss
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.

4 participants