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

Refactor optimizer and lr scheduler part #3216

Conversation

vinnamkim
Copy link
Contributor

@vinnamkim vinnamkim commented Mar 27, 2024

Summary

  • Ticket no. 135933

  • This PR aims to remove the custom code in src/otx/cli/cli.py which is hardly coupled with OTXModel.

  • To do this, change type optimizer and scheduler typings from

    optimizer: list[OptimizerCallable] | OptimizerCallable = DefaultOptimizerCallable,
    scheduler: list[LRSchedulerCallable] | LRSchedulerCallable = DefaultSchedulerCallable,

    to

    optimizer: OptimizerCallable = DefaultOptimizerCallable,
    scheduler: LRSchedulerCallable | LRSchedulerListCallable = DefaultSchedulerCallable,

    This is to remove the list[OptimizerCallable] and list[LRSchedulerCallable] typings. The reason for this is that I faced this issue, [Question] Is it possible to change the init_args of list elements with giving ActionConfigFile omni-us/jsonargparse#478, after removing add_list_type_arguments() from src/otx/cli/cli.py.

  • According to this type change, it is required to implement LinearWarmupSchedulerCallable newly to incorporate the linear warmup scheduler with the other main scheduler.

  • LinearWarmupSchedulerCallable and OTXModel.lr_scheduler_step() will solve this problem, Fix multiple lr scheduler (warmup scheduler) & Add adaptive_patience to the lr scheduler #3035 (comment)

How to test

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added e2e tests for validation.
  • I have added the description of my changes into CHANGELOG in my target branch (e.g., CHANGELOG in develop).​
  • I have updated the documentation in my target branch accordingly (e.g., documentation in develop).
  • I have linked related issues.

License

  • I submit my code changes under the same Apache License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

@github-actions github-actions bot added TEST Any changes in tests OTX 2.0 labels Mar 27, 2024
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 71.15385% with 45 lines in your changes are missing coverage. Please review.

Project coverage is 73.48%. Comparing base (2277ec5) to head (6ed3430).
Report is 2 commits behind head on develop.

Files Patch % Lines
src/otx/core/model/base.py 62.50% 12 Missing ⚠️
src/otx/engine/hpo/hpo_api.py 11.11% 8 Missing ⚠️
src/otx/core/metrics/types.py 58.33% 5 Missing ⚠️
src/otx/engine/utils/auto_configurator.py 79.16% 5 Missing ⚠️
src/otx/algo/anomaly/openvino_model.py 0.00% 3 Missing ⚠️
src/otx/algo/classification/otx_dino_v2.py 50.00% 2 Missing ⚠️
src/otx/core/schedulers/warmup_schedulers.py 93.75% 2 Missing ⚠️
src/otx/algo/action_classification/movinet.py 0.00% 1 Missing ⚠️
src/otx/algo/classification/efficientnet_v2.py 0.00% 1 Missing ⚠️
src/otx/algo/detection/rtmdet.py 0.00% 1 Missing ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3216      +/-   ##
===========================================
+ Coverage    70.30%   73.48%   +3.18%     
===========================================
  Files          178      179       +1     
  Lines        15162    15232      +70     
===========================================
+ Hits         10659    11193     +534     
+ Misses        4503     4039     -464     
Flag Coverage Δ
py310 73.48% <71.15%> (+3.18%) ⬆️
py311 73.48% <71.15%> (+3.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Co-authored-by: Harim Kang <harim.kang@intel.com>
@harimkang harimkang added this to the 2.1.0 milestone Mar 29, 2024
@vinnamkim vinnamkim merged commit 375e89e into openvinotoolkit:develop Mar 29, 2024
15 checks passed
@vinnamkim vinnamkim deleted the refactor-optimizer-and-lr-scheduler branch March 29, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TEST Any changes in tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants