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

Fix: Dataset infos() can be broken if a transform not redefining infos() is stacked on the top #1101

Conversation

vinnamkim
Copy link
Contributor

@vinnamkim vinnamkim commented Jul 17, 2023

Summary

  • Ticket no. 115725
  • Fix: Dataset infos() can be broken if a transform not redefining infos() is stacked on the top
  • Enhance the StreamDatasetStorage transform tests added in Implement StreamDatasetStorage and StreamDataset #1077.
  • Test call_count as well in the tests to validate stacked transforms.

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 the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT 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: MIT

 - Add call_count to StreamDatasetStorage transform tests

Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
@vinnamkim vinnamkim added the ENHANCE Enhancement of existing features label Jul 17, 2023
@vinnamkim vinnamkim added this to the 1.4.0 milestone Jul 17, 2023
@vinnamkim vinnamkim changed the title Add call_count Add call_count to StreamDatasetStorage transform tests Jul 17, 2023
@vinnamkim vinnamkim marked this pull request as ready for review July 17, 2023 08:03
@vinnamkim vinnamkim requested review from a team as code owners July 17, 2023 08:03
@vinnamkim vinnamkim requested review from jihyeonyi and removed request for a team July 17, 2023 08:03
Copy link
Contributor

@wonjuleee wonjuleee left a comment

Choose a reason for hiding this comment

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

Don't we need to have DatasetStorageTest to compare them?

@vinnamkim
Copy link
Contributor Author

Don't we need to have DatasetStorageTest to compare them?

tests/unit/components/test_dataset_storage.py has the tests to validate StreamDatasetStorage behave as we expect. DatasetStorage has been used as the core of other components, so that our many existing tests have been tested DatasetStorage I think.

@wonjuleee
Copy link
Contributor

Don't we need to have DatasetStorageTest to compare them?

tests/unit/components/test_dataset_storage.py has the tests to validate StreamDatasetStorage behave as we expect. DatasetStorage has been used as the core of other components, so that our many existing tests have been tested DatasetStorage I think.

Partially agree. In my opinion, it was definitely tested in terms of functional, but it was not for performance. Your test for StreamDatasetStorage looks like related to performance (how many times an iterator called) and how it operated internally. If you agree, let me prepare the tests for DatasetStorage with similar shape in another PR. Please give me your opinion on this.

Moreover, we may need to evaluate the quality of operations in terms of time and memory consumption in the future.

@vinnamkim
Copy link
Contributor Author

vinnamkim commented Jul 18, 2023

Don't we need to have DatasetStorageTest to compare them?

tests/unit/components/test_dataset_storage.py has the tests to validate StreamDatasetStorage behave as we expect. DatasetStorage has been used as the core of other components, so that our many existing tests have been tested DatasetStorage I think.

Partially agree. In my opinion, it was definitely tested in terms of functional, but it was not for performance. Your test for StreamDatasetStorage looks like related to performance (how many times an iterator called) and how it operated internally. If you agree, let me prepare the tests for DatasetStorage with similar shape in another PR. Please give me your opinion on this.

Moreover, we may need to evaluate the quality of operations in terms of time and memory consumption in the future.

No, tests/unit/components/test_dataset_storage.py was 100% designed for the functional. The reason why we confirm how many the __iter__() of extractor is called is that we want to confirm that StreamDatasetStorage behaves in a stream manner (to test its functional, not performance). If it is DatasetStorage, __iter__().call_count always remains one although we stack any number of transforms (because of automatic caching).

To test the performance, I think that the unit test is not right place for it. Unit tests are aim to test the functionality of small components as possible. Therefore, there should exist pass or fail always. However, the performance test can be easily flaky by many variable factors (machine status, network status, ...). In my opinion, performance tests usually are conducted periodically and produce a report rather than testing pass/fail like as we do in NNCF.

@wonjuleee
Copy link
Contributor

Don't we need to have DatasetStorageTest to compare them?

tests/unit/components/test_dataset_storage.py has the tests to validate StreamDatasetStorage behave as we expect. DatasetStorage has been used as the core of other components, so that our many existing tests have been tested DatasetStorage I think.

Partially agree. In my opinion, it was definitely tested in terms of functional, but it was not for performance. Your test for StreamDatasetStorage looks like related to performance (how many times an iterator called) and how it operated internally. If you agree, let me prepare the tests for DatasetStorage with similar shape in another PR. Please give me your opinion on this.
Moreover, we may need to evaluate the quality of operations in terms of time and memory consumption in the future.

No, tests/unit/components/test_dataset_storage.py was 100% designed for the functional. The reason why we confirm how many the __iter__() of extractor is called is that we want to confirm that StreamDatasetStorage behaves in a stream manner (to test its functional, not performance). If it is DatasetStorage, __iter__().call_count always remains one although we stack any number of transforms (because of automatic caching).

To test the performance, I think that the unit test is not right place for it. Unit tests are aim to test the functionality of small components as possible. Therefore, there should exist pass or fail always. However, the performance test can be easily flaky by many variable factors (machine status, network status, ...). In my opinion, performance tests usually are conducted periodically and produce a report rather than testing pass/fail like as we do in NNCF.

I don't think it is functional. I think we should run StreamDatasetStorage with other components (such as merge, transform, etc) and should check the same expected results for the functional tests.

@vinnamkim vinnamkim added the BUG Something isn't working label Jul 18, 2023
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
@vinnamkim vinnamkim changed the title Add call_count to StreamDatasetStorage transform tests Fix: Dataset infos() can be broken if a transform not redefining infos() is stacked on the top Jul 18, 2023
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
@vinnamkim
Copy link
Contributor Author

vinnamkim commented Jul 18, 2023

I don't think it is functional. I think we should run StreamDatasetStorage with other components (such as merge, transform, etc) and should check the same expected results for the functional tests.

We exactly have been doing that by parametrizing Dataset and StreamDataset for the importer and exporter tests (yes, not for merge, but transform is did in this test, tests/unit/components/test_dataset_storage.py, but for the DatasetStorage level, not for Dataset level still). However, I mean that this test is aimed to prove it's core mechanism (no caching and streaming) and behaviors.

@vinnamkim vinnamkim merged commit 144489e into openvinotoolkit:releases/1.4.0 Jul 18, 2023
@vinnamkim vinnamkim deleted the hotfix/add-call-count-for-transform-tests branch July 18, 2023 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working ENHANCE Enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants