Skip to content

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Jan 27, 2022

Due to the breaking changes introduced at pytorch/pytorch#70009 and pytorch/pytorch#71956, TorchVision needs to make changes on the quantization code. This PR should make adjustments in a BC manner.

Before merging:

  • CI needs to pass. Waiting for the PyTorch nightly to include the PR with the above changes.
  • Verify Reference Scripts:
    • QAT training
    • PTQ training
    • Accuracy for ResNet18
    • Accuracy for MobileNetV2
    • Accuracy for MobileNetV3 Large model

cc @jerryzh168

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jan 27, 2022

💊 CI failures summary and remediations

As of commit 3880b53 (more details on the Dr. CI page):


  • 2/2 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See GitHub Actions build CodeQL / build (1/1)

Step: "Build TorchVision" (full log | diagnosis details | 🔁 rerun)

2022-02-02T10:27:08.1513828Z ##[error]Process completed with exit code 1.
2022-02-02T10:27:08.0119076Z     self.finalize_options()
2022-02-02T10:27:08.0119591Z   File "/home/runner/.local/lib/python3.8/site-packages/setuptools/command/develop.py", line 52, in finalize_options
2022-02-02T10:27:08.0119987Z     easy_install.finalize_options(self)
2022-02-02T10:27:08.0120551Z   File "/home/runner/.local/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 276, in finalize_options
2022-02-02T10:27:08.0120938Z     self._fix_install_dir_for_user_site()
2022-02-02T10:27:08.0121520Z   File "/home/runner/.local/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 382, in _fix_install_dir_for_user_site
2022-02-02T10:27:08.0121900Z     self.create_home_path()
2022-02-02T10:27:08.0122566Z   File "/home/runner/.local/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1338, in create_home_path
2022-02-02T10:27:08.0123011Z     if path.startswith(home) and not os.path.isdir(path):
2022-02-02T10:27:08.0123448Z AttributeError: 'int' object has no attribute 'startswith'
2022-02-02T10:27:08.1513828Z ##[error]Process completed with exit code 1.
2022-02-02T10:27:08.1607791Z Post job cleanup.
2022-02-02T10:27:08.2747632Z [command]/usr/bin/git version
2022-02-02T10:27:08.2799435Z git version 2.35.1
2022-02-02T10:27:08.2831752Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2022-02-02T10:27:08.2878204Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2022-02-02T10:27:08.3229793Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2022-02-02T10:27:08.3265871Z http.https://github.com/.extraheader
2022-02-02T10:27:08.3276092Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2022-02-02T10:27:08.3320673Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2022-02-02T10:27:08.3850888Z Cleaning up orphan processes

1 failure not recognized by patterns:

Job Step Action
CircleCI cmake_macos_cpu curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
sh conda.sh -b
source $HOME/miniconda3/bin/activate
conda install -yq conda-build cmake
packaging/build_cmake.sh
🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@datumbox datumbox added the module: models.quantization Issues related to the quantizable/quantized models label Jan 27, 2022
@datumbox datumbox requested a review from jerryzh168 January 27, 2022 17:01
# Quantized Classification
model = M.quantization.mobilenet_v3_large(pretrained=False, quantize=False)
model.fuse_model()
model.fuse_model(is_qat=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

would you like to use fuse_model and fuse_model_qat or the flag?

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. Apologies, I'm not sure I follow. Could you clarify?

Copy link
Contributor

@jerryzh168 jerryzh168 left a comment

Choose a reason for hiding this comment

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

Looks good I think, thanks for updating the APIs!

@datumbox datumbox added the other if you have no clue or if you will manually handle the PR in the release notes label Feb 2, 2022
@datumbox datumbox marked this pull request as ready for review February 2, 2022 10:56
@datumbox datumbox merged commit 8a16e12 into pytorch:main Feb 2, 2022
@datumbox datumbox deleted the quant_models/is_qat_changes branch February 2, 2022 10:57
facebook-github-bot pushed a commit that referenced this pull request Feb 4, 2022
Summary:
* Add is_qat support using a method getter

* Switch to an internal _fuse_modules

* Fix linter.

* Pass is_qat=False on PTQ

* Fix bug on ra_sampler flag.

* Set is_qat=True for QAT

Reviewed By: kazhang

Differential Revision: D33995922

fbshipit-source-id: 4a7578ea54892e57189773d45533323c7636e5a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/default cla signed module: models.quantization Issues related to the quantizable/quantized models other if you have no clue or if you will manually handle the PR in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants