Skip to content

Conversation

@supriyar
Copy link
Contributor

@supriyar supriyar commented Jul 29, 2020

Stack from ghstack:

Summary:
Adds a new observer that emits a warning if the range of tensor is beyond fp16 range. This will be further used in graph mode quantization to insert the cast to fp16 ops in the graph

Test Plan:
python test/test_quantizaton.py TestObserver.test_fp16_observer

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D22849222

Summary:
Adds a new observer that emits a warning if the range of tensor is beyond fp16 range. This will be further used in graph mode quantization to insert the cast to fp16 ops in the graph

Test Plan:
python test/test_quantizaton.py TestObserver.test_fp16_observer

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@dr-ci
Copy link

dr-ci bot commented Jul 29, 2020

💊 CI failures summary and remediations

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


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 10 times.

Summary:
Adds a new observer that emits a warning if the range of tensor is beyond fp16 range. This will be further used in graph mode quantization to insert the cast to fp16 ops in the graph

Test Plan:
python test/test_quantizaton.py TestObserver.test_fp16_observer

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
super(HistogramObserver, self)._load_from_state_dict(state_dict, prefix, local_metadata, strict,
missing_keys, unexpected_keys, error_msgs)

class Fp16Observer(ObserverBase):
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to be the same as min max observer except for the warning, can we just use min max observer and put warning somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have calculate_qparams and other methods defined for this observer. Also, feel that from user standpoint it might be better to separate this from MinMax observer since that actually observes the values to calculate the qparams. I can add a docblock to better explain the usage of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, since we just use min_val/max_val for warning, can we remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we can remove the warning then we can just use NoOp observer for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having the warning is useful for users to know if their weight values might be getting saturated and it can tell them that they might need to update the model. So users can just insert the observers and run the model to check for potential overflow issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

can this be done during convert though? we only have one user facing API quantize_dynamic_jit

supriyar added 2 commits July 30, 2020 11:53
Summary:
Adds a new observer that emits a warning if the range of tensor is beyond fp16 range. This will be further used in graph mode quantization to insert the cast to fp16 ops in the graph

Test Plan:
python test/test_quantizaton.py TestObserver.test_fp16_observer

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
Adds a new observer that emits a warning if the range of tensor is beyond fp16 range. This will be further used in graph mode quantization to insert the cast to fp16 ops in the graph

Test Plan:
python test/test_quantizaton.py TestObserver.test_fp16_observer

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D22849222](https://our.internmc.facebook.com/intern/diff/D22849222)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 8c5bf10.

@facebook-github-bot facebook-github-bot deleted the gh/supriyar/152/head branch August 4, 2020 14:15
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.

6 participants