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

Update params to allow choosing best model for FT #1015

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

VipulMascarenhas
Copy link
Member

Description

This PR adds two parameters to allow user to choose the best finetuned model.
When load_best_model_at_end parameter is set as True, the best model is chosen using lowest validation loss by default. User can also customize other metrics like accuracy/rouge by using the parameter metric_for_best_model if needed.

Parameters

  1. Model from last epoch is used
--ft_parameters '{"batch_size": 1, "epochs": 4}'
  1. Best model is used based on default metric, i.e. validation loss
--ft_parameters '{"batch_size": 1, "epochs": 4, "load_best_model_at_end": true}'
  1. Best model is used based on custom metric, i.e. accuracy
--ft_parameters '{"batch_size": 1,  "epochs": 4, "load_best_model_at_end": true, "metric_for_best_model": "accuracy"}'

Unit Tests

> python -m pytest -q tests/unitary/with_extras/aqua/*
=========================================== test session starts ============================================
platform darwin -- Python 3.8.19, pytest-7.4.4, pluggy-1.0.0
rootdir: /Users/user/workspace/git/accelerated-data-science
configfile: pytest.ini
plugins: Faker-26.0.0, cov-5.0.0, anyio-4.2.0, xdist-3.6.1
collected 255 items

tests/unitary/with_extras/aqua/test_cli.py ............................                              [  5%]
tests/unitary/with_extras/aqua/test_common_handler.py ...                                            [  6%]
tests/unitary/with_extras/aqua/test_config.py .                                                      [  7%]
tests/unitary/with_extras/aqua/test_decorator.py ..........                                          [ 10%]
tests/unitary/with_extras/aqua/test_deployment.py .....................                              [ 19%]
tests/unitary/with_extras/aqua/test_deployment_handler.py .....s......                               [ 23%]
tests/unitary/with_extras/aqua/test_evaluation.py .............................                      [ 35%]
tests/unitary/with_extras/aqua/test_evaluation_handler.py ......                                     [ 37%]
tests/unitary/with_extras/aqua/test_evaluation_service_config.py .....................               [ 45%]
tests/unitary/with_extras/aqua/test_finetuning.py ........                                           [ 49%]
tests/unitary/with_extras/aqua/test_finetuning_handler.py .....                                      [ 50%]
tests/unitary/with_extras/aqua/test_global.py ...                                                    [ 52%]
tests/unitary/with_extras/aqua/test_handlers.py .................                                    [ 58%]
tests/unitary/with_extras/aqua/test_model.py ..........................                              [ 69%]
tests/unitary/with_extras/aqua/test_model_handler.py ...................                             [ 76%]
tests/unitary/with_extras/aqua/test_ui.py ................                                           [ 82%]
tests/unitary/with_extras/aqua/test_ui_handler.py ...............                                    [ 88%]
tests/unitary/with_extras/aqua/test_ui_websocket_handler.py ....                                     [ 90%]
tests/unitary/with_extras/aqua/test_utils.py ...........

===================================== 254 passed, 1 skipped in 51.81s ======================================

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 27, 2024
darenr
darenr previously approved these changes Nov 27, 2024
Copy link

📌 Cov diff with main:

Coverage-100%

📌 Overall coverage:

Coverage-58.46%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants