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 Simple Integration test (CLI - 'otx train') #2695

Merged
merged 4 commits into from
Dec 6, 2023
Merged

Add Simple Integration test (CLI - 'otx train') #2695

merged 4 commits into from
Dec 6, 2023

Conversation

harimkang
Copy link
Contributor

@harimkang harimkang commented Dec 5, 2023

Summary

  • Add CLI Integration Test using recipes
    • 1 epochs training with all recipes
    • Currently, only classification and detection work
  • Add Classification test assets dataset: tests/assets/classification_dataset
  • Add trainer.device=auto setting
  • Add tox integration-test
  • Add integration test into CI
  • Fix install issue of case without 'version.json' in '/cuda/'

How to test

  • TOX test
    tox -vv -e integration-test

  • Local Test
    python -m pytest tests/integration/cli/test_cli.py

image

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 BUILD OTX 2.0 labels Dec 5, 2023
@harimkang harimkang marked this pull request as ready for review December 5, 2023 06:05
jaegukhyun
jaegukhyun previously approved these changes Dec 5, 2023
Copy link
Contributor

@sungmanc sungmanc left a comment

Choose a reason for hiding this comment

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

LGTM

@jaegukhyun jaegukhyun requested a review from wonjuleee December 5, 2023 08:12
Copy link
Collaborator

@kprokofi kprokofi left a comment

Choose a reason for hiding this comment

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

In general, LGTM. But it might be worth extending the tests by 2 epochs instead of 1 to make sure that any processes between epochs also work.
What do you think?

@harimkang
Copy link
Contributor Author

In general, LGTM. But it might be worth extending the tests by 2 epochs instead of 1 to make sure that any processes between epochs also work. What do you think?

I think it's a good idea, but for now I'll merge this PR for another task model recipe integration test and create a new PR after we discuss it together.

@harimkang harimkang merged commit ef7fdfb into openvinotoolkit:v2 Dec 6, 2023
6 checks passed
Comment on lines +49 to +55
process = await asyncio.create_subprocess_exec(
*cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
env=environ,
**kwargs,
)
Copy link
Contributor

@vinnamkim vinnamkim Dec 6, 2023

Choose a reason for hiding this comment

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

I do not want to spawn a separate process for the integration test. This is because it makes a developer harder to debug if a problem is found during the integration test. Please replace it with executing the CLI Python function in the main process.

Comment on lines +53 to +55
"trainer.max_epochs=1",
"trainer.check_val_every_n_epoch=1",
"trainer=auto",
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than manually overriding at the variable level, consider to override this https://github.com/openvinotoolkit/training_extensions/blob/v2/src/otx/config/debug/default.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment. I will create a PR to reflect your comments. I have a question regarding this comment. I want to create a config file called debug/intg_test.yaml and want to apply it to test.
Can you tell me what args should be added to override the config in this debug folder in the cli?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that you need to add debug optional field to TrainConfig as same as recipe.
image
Then, it might be working by adding argument +debug=intg_test. This is exactly same with what we do with +recipe=???.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I'll give it a try.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to make sure that CI would work whether the test was using cpu or gpu, so I thought using the auto provided by lightning for the test would be appropriate. What do you think? This too can be modified as per your suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that possible by giving trainer=cpu or trainer=gpu explicitly outside? If you set it as auto, then it seems not traceable which device we used for the tests.

Copy link
Contributor Author

@harimkang harimkang Dec 6, 2023

Choose a reason for hiding this comment

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

For test, yes i understand, I'm going to modify it in intg-test to gpu for now. Do you want to remove this file?
I guess auto might be a good option for the user as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then, let it leave as is. However, the decision for which device will be used should be explicit in the tests. This is what I only concern.

@harimkang
Copy link
Contributor Author

@vinnamkim I create next PR #2701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUILD TEST Any changes in tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants