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

Conformance test add validation with batch_size #2652

Closed

Conversation

kshpv
Copy link
Collaborator

@kshpv kshpv commented Apr 24, 2024

Changes

Add arbitrary batch_size for validation dataloader.

Reason for changes

Speed up validation

Related tickets

138556

Tests

Jobs

@github-actions github-actions bot added the NNCF PTQ Pull requests that updates NNCF PTQ label Apr 24, 2024
@kshpv
Copy link
Collaborator Author

kshpv commented Apr 25, 2024

jobs 372 and 373 with fixed host are running

@kshpv kshpv marked this pull request as ready for review April 29, 2024 07:53
@kshpv kshpv requested a review from a team as a code owner April 29, 2024 07:53
@kshpv kshpv requested a review from KodiaqQ April 29, 2024 08:03
@kshpv kshpv changed the title Conformance test add validation with bathc_size Conformance test add validation with batch_size Apr 29, 2024
@kshpv
Copy link
Collaborator Author

kshpv commented Apr 29, 2024

Based on results - median speed up per model is ~ 40%

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.06%. Comparing base (d10afcf) to head (03606b1).
Report is 8 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #2652       +/-   ##
============================================
- Coverage    46.80%   30.06%   -16.75%     
============================================
  Files          493      493               
  Lines        45445    45540       +95     
============================================
- Hits         21272    13692     -7580     
- Misses       24173    31848     +7675     

see 373 files with indirect coverage changes

Flag Coverage Δ
COMMON ?
ONNX ?
OPENVINO ?
TENSORFLOW 30.06% <ø> (?)

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

Components Coverage Δ
common 76.35% <ø> (+6.72%) ⬆️
torch 0.01% <ø> (-32.83%) ⬇️
tensorflow 93.74% <ø> (+93.74%) ⬆️
onnx 0.00% <ø> (-93.07%) ⬇️
openvino 0.00% <ø> (-94.19%) ⬇️
ptq 15.54% <ø> (-63.80%) ⬇️

@kshpv kshpv requested a review from KodiaqQ April 29, 2024 08:45
Comment on lines 252 to 253
"batch_size": 32,
"validation_batch_size": 1, # Validation is slower with batch_size > 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we have separate batch sizes for calibration & validation? If some models should be validated with the batch_size=1, they should be calibrated with the same batch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Make sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

set bs=1 for swin

@@ -122,13 +122,14 @@ def prepare_calibration_dataset(self):

def _validate(self):
val_dataset = datasets.ImageFolder(root=self.data_dir / "imagenet" / "val", transform=self.transform)
val_loader = torch.utils.data.DataLoader(val_dataset, batch_size=1, num_workers=2, shuffle=False)
val_loader = torch.utils.data.DataLoader(
val_dataset, batch_size=self.validation_batch_size, num_workers=2, shuffle=False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the 2 workers enough for the data loading with a batch more than 1?

@KodiaqQ KodiaqQ self-requested a review April 29, 2024 10:26
@kshpv kshpv force-pushed the conformance_bs_validation branch from bfe4e2f to 03606b1 Compare April 29, 2024 13:31
@kshpv
Copy link
Collaborator Author

kshpv commented Apr 29, 2024

job with updates for swin - 375

@kshpv
Copy link
Collaborator Author

kshpv commented May 2, 2024

Closing the PR since after obtaining the correct results on validation performance it was observed that there is no significant impact on performance with these changes

@kshpv kshpv closed this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NNCF PTQ Pull requests that updates NNCF PTQ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants