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 python-level structured config #205

Merged
merged 25 commits into from
Oct 27, 2023
Merged

Conversation

deepkyu
Copy link
Contributor

@deepkyu deepkyu commented Oct 26, 2023

Description

Please include a summary in English, of the changes in this pull request. If it closes an issue, please mention it here.

Closes: #203

You should link at least one existing issue for PR. Before your create a PR, please check to see if there is an issue for this change.
PRs from forked repository not accepted.

Change(s)

  • Add python-level structured config which is 100% compatible with the current yaml configuration
    • User can train the model manipulating with pythonic configuration
    • Backward-support: netspresso-train **yaml_files on CLI interface also works
    • Pythonic configuration can be also exported to yaml files when saving experiment log

from netspresso_trainer.cfg import ClassificationResNetModelConfig, ExampleBeansDataset
"""
Declare dataset config (Use an example dataset provided from the module)
"""
example_dataset = ExampleBeansDataset
example_dataset.metadata.custom_cache_dir = "./data/huggingface"
"""
Declare model config
"""
example_model = ClassificationResNetModelConfig()
# ### If you try to train torch.fx model from PyNetsPresso, use this block instead
# example_model = ClassificationResNetModelConfig(checkpoint=None)
# example_model.fx_model_checkpoint = "classification_resnet50_best_fx.pt"
# ###
"""
Declare trainer config
"""
cfg = TrainerConfig(
task='classification',
auto=True,
data=ExampleBeansDataset,
model=example_model
)
"""
Update major field values considering the spec of training machine
"""
cfg.batch_size = 64
cfg.epochs = 5
train(cfg, log_level='INFO')

Changelog

If you PR to dev branch, please add a brief summary of the change to the Upcoming Release section of the CHANGELOG.md file and include a link to the PR (formatted in markdown) and a link to your github profile.

For example,

- Added a new feature by `@myusername` in [PR 2023](https://github.com/Nota-NetsPresso/netspresso-trainer/pull/2023)

Code Formatting

If you PR to either master or dev branch, you should follow the code linting process. Please check your code with lint_check.sh in ./scripts directory.
For more information, please read the contribution guide in CONTRIBUTING.md.

@deepkyu deepkyu linked an issue Oct 26, 2023 that may be closed by this pull request
2 tasks
@deepkyu deepkyu requested a review from Only-bottle October 26, 2023 07:13
@deepkyu deepkyu marked this pull request as ready for review October 26, 2023 07:22
@deepkyu deepkyu requested a review from illian01 as a code owner October 26, 2023 07:22
Copy link
Collaborator

@illian01 illian01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your great works. 👍
I found minor mismatch. Please check the comment.

train.py Outdated Show resolved Hide resolved
@deepkyu deepkyu requested a review from illian01 October 26, 2023 08:20
Copy link
Collaborator

@illian01 illian01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@deepkyu deepkyu assigned Only-bottle and unassigned illian01 Oct 26, 2023
@deepkyu deepkyu merged commit fb4cc3e into dev Oct 27, 2023
2 checks passed
@deepkyu deepkyu deleted the 203-improve-easy-to-use-features branch October 27, 2023 08:20
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 this pull request may close these issues.

[Sprint] Improve easy-to-use features
3 participants