This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Custom metrics from compute_loss
in TGA
#4905
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mojtaba-komeili
changed the title
Custom metrics for loss values in TGA
Custom metrics from Dec 2, 2022
compute_loss
in TGA
mojtaba-komeili
commented
Dec 2, 2022
@@ -34,7 +34,7 @@ | |||
from parlai.utils.misc import warn_once | |||
from parlai.utils.io import PathManager | |||
import parlai.utils.logging as logging | |||
from parlai.core.metrics import Metric, SumMetric, AverageMetric, FairseqBleuMetric | |||
from parlai.core.metrics import SumMetric, AverageMetric, FairseqBleuMetric |
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.
This is just for the lint error.
* cat or concat * back to cat * Only add the metric if it is not None * lint
* zero3 init commit * minor cleanup: * handle mpeval * remove fairscale dependence * fsdp avail * update reqs * better reqs * autoformat * autofromat
klshuster
reviewed
Dec 5, 2022
@@ -715,6 +715,12 @@ def _encoder_input(self, batch): | |||
""" | |||
return self._model_input(batch) | |||
|
|||
def custom_loss_metrics(self, batch, loss_per_token): |
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.
super nit: can we call this something more related to what it's doing?
e.g., compute_per_token_metrics
?
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2. - [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases) - [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2) --- updated-dependencies: - dependency-name: decode-uri-component dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…o compute-loss * 'compute-loss' of github.com:facebookresearch/ParlAI: lint added the custom_loss_metrics
seperated -> separated
* delay loading of ngram blocking codde * tga
…rlAI into compute-loss * 'compute-loss' of https://github.com/facebookresearch/ParlAI: added the custom_loss_metrics lint added the custom_loss_metrics
Rebase added some unwanted changes to this PR. Closing it and opening a new clean one. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Patch description
The
compute_loss
function in TGA generates theloss_per_token
values but they are not accessible from outside this method. This PR adds a handle for calculating custom metrics that requireloss_per_token
. The added method (custom_loss_metrics
) can be overridden by its children to work with theloss_per_token
andbatch
for generating custom metrics.