Skip to content

Adding multiweight support to Quantized InceptionV3 #4850

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

Merged

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 3, 2021

Fixes partially #4674

Verified with:

python -u train_quantization.py --test-only --weights ImageNet1K_FBGEMM_TFV1 --model inception_v3 --device cpu

cc @bjuncek

@facebook-github-bot
Copy link

facebook-github-bot commented Nov 3, 2021

💊 CI failures summary and remediations

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


  • 1/1 failures introduced in this PR

1 failure not recognized by patterns:

Job Step Action
CircleCI binary_linux_conda_py3.9_cu111 packaging/build_conda.sh 🔁 rerun

1 job timed out:

  • binary_linux_conda_py3.9_cu111

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 force-pushed the prototype/quantinception_multiweight branch from beefef4 to aa1adfb Compare November 3, 2021 17:08
Copy link
Contributor Author

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Few comments to assist review:

progress: bool = True,
quantize: bool = False,
**kwargs: Any,
) -> "QuantizableInception3":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving the builder on the bottom of the page to use proper typing.

progress: bool = True,
quantize: bool = False,
**kwargs: Any,
) -> QuantizableInception3:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No review, just copy-paste.

@@ -28,11 +28,11 @@ class Inception3Weights(Weights):
)


def inception_v3(weights: Optional[Inception3Weights] = None, progress: bool = True, **kwargs: Any) -> Inception3:
def inception_v3(weights: Optional[InceptionV3Weights] = None, progress: bool = True, **kwargs: Any) -> Inception3:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The naming is inconsistent. The model class is called Inception3, while the mode builder inception_v3. It's unclear how we should name the weights. Following the convention from ResNets this should have been Inception_V3 which is ugly. I propose not to spend more time on this now and tackle it at #4652. I've already added a reference for this issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree! Lets tackle it in the cleanup

quantize_model(model, backend)

if weights is not None:
if quantize and not original_aux_logits:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Special handling needed here. See original implementation.

@datumbox datumbox requested a review from jdsgomes November 3, 2021 17:11
Copy link
Contributor

@jdsgomes jdsgomes left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -28,11 +28,11 @@ class Inception3Weights(Weights):
)


def inception_v3(weights: Optional[Inception3Weights] = None, progress: bool = True, **kwargs: Any) -> Inception3:
def inception_v3(weights: Optional[InceptionV3Weights] = None, progress: bool = True, **kwargs: Any) -> Inception3:
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree! Lets tackle it in the cleanup

@datumbox datumbox merged commit 1cbd9cd into pytorch:main Nov 3, 2021
@datumbox datumbox deleted the prototype/quantinception_multiweight branch November 3, 2021 18:19
@datumbox datumbox linked an issue Nov 4, 2021 that may be closed by this pull request
6 tasks
facebook-github-bot pushed a commit that referenced this pull request Nov 8, 2021
Summary:
* Moving builder to the bottom to use proper typing.

* Renaming weights.

* Adding quantizated inception builder.

* Correct meta info.

* Fix linter.

* Removing init_weights to avoid exposing it on the class.

Reviewed By: kazhang

Differential Revision: D32216665

fbshipit-source-id: 11dcacf95db067ab08a93408600f2b01e1b7367b
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
* Moving builder to the bottom to use proper typing.

* Renaming weights.

* Adding quantizated inception builder.

* Correct meta info.

* Fix linter.

* Removing init_weights to avoid exposing it on the class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-pretrained weights: Add model builders for Quantization
3 participants