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

Adding custom metrics #1103

Open
AmitMY opened this issue Jan 24, 2024 · 3 comments · May be fixed by #1104
Open

Adding custom metrics #1103

AmitMY opened this issue Jan 24, 2024 · 3 comments · May be fixed by #1104

Comments

@AmitMY
Copy link

AmitMY commented Jan 24, 2024

There are four metrics available here https://github.com/sign-language-processing/signwriting-evaluation that I would like to report.
How can I add custom metrics? (I would like to optimize for one of the metrics)

@mjdenkowski
Copy link
Contributor

Hi Amit,

Sockeye's loss functions are implemented in loss.py. You could use an existing loss function (e.g., MSELoss as a template for creating your own. You could also trace instances of MSELoss through the code to see where and how loss functions are connected into the training logic.

If your metrics require decoding, you could add them to the checkpoint decoder's decode_and_evaluate method (after BLEU, chrF, etc.). These metrics will be reported for every checkpoint but Sockeye does not currently support optimizing them directly.

Best,
Michael

@AmitMY
Copy link
Author

AmitMY commented Jan 24, 2024

By optimizing in my case I meant early-stopping. I'll try to add to the decode and evaluate and see if I can then early stop on those

@mjdenkowski
Copy link
Contributor

You should be able to add your metric as a choice for --optimized-metric to enable using it for early stopping. One approach would be to do this first (add the name of your metric), start a training run with a tiny model, and see where it hits an error since your metric isn't yet implemented. This can identify where the next code change would be needed to support your metric.

@AmitMY AmitMY linked a pull request Feb 10, 2024 that will close this issue
7 tasks
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 a pull request may close this issue.

2 participants