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

Add from_model_name in Engine #3129

Merged
merged 4 commits into from
Mar 15, 2024
Merged

Add from_model_name in Engine #3129

merged 4 commits into from
Mar 15, 2024

Conversation

harimkang
Copy link
Contributor

Summary

Fix CVS-135466

It is not easy or possible to launch the model training using Python API with the given 1) data_root, 2) model_name, 3) task_type, 4) configuration overridings

So for now, Add Engine.from_model_name classmethod.

from otx.engine import Engine

model_name = "efficientnet_b0_light"
data_root = "tests/assets/classification_dataset"
task_type = "MULTI_CLASS_CLS"

overriding = {
    "data.config.train_subset.batch_size": 2,
}

engine = Engine.from_model_name(
    model_name=model_name,
    data_root=data_root,
    task=task_type,
    work_dir="otx-workspace-test-1",
    **overriding,
)

assert engine.datamodule.config.train_subset.batch_size == 2

However, we're still having trouble overriding the configuration provided by Auto-configuration without using from_config or from_model_name, so 'll be thinking about how to improve this.

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) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

@github-actions github-actions bot added TEST Any changes in tests OTX 2.0 labels Mar 15, 2024
src/otx/engine/engine.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.01%. Comparing base (692ab44) to head (389f67f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3129      +/-   ##
===========================================
+ Coverage    61.55%   62.01%   +0.45%     
===========================================
  Files          259      259              
  Lines        15278    15289      +11     
===========================================
+ Hits          9405     9481      +76     
+ Misses        5873     5808      -65     
Flag Coverage Δ
py310 62.00% <100.00%> (+0.44%) ⬆️
py311 62.01% <100.00%> (+0.45%) ⬆️

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.

@harimkang harimkang enabled auto-merge (squash) March 15, 2024 06:11
@harimkang harimkang merged commit fc2a3a5 into openvinotoolkit:develop Mar 15, 2024
15 checks passed
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