Skip to content

Verbosity control for export #2690

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

Closed
wants to merge 1 commit into from
Closed

Verbosity control for export #2690

wants to merge 1 commit into from

Conversation

mikekgfb
Copy link

Summary: Verbosity control for export

Reviewed By: kimishpatel

Differential Revision: D55374748

Summary: Verbosity control for export

Reviewed By: kimishpatel

Differential Revision: D55374748
Copy link

pytorch-bot bot commented Mar 26, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/2690

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 63395e9 with merge base cde514c (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55374748

Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

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

Ok as-is, but left some suggestions for improving clarity.

Comment on lines +61 to +67
def set_verbosity(val):
global verbosity_setting
verbosity_setting = val


def verbose_export():
return verbosity_setting
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to clarify the type here. And along with it, verbosity_setting: bool = False above.

Suggested change
def set_verbosity(val):
global verbosity_setting
verbosity_setting = val
def verbose_export():
return verbosity_setting
def set_verbosity(val: bool):
global verbosity_setting
verbosity_setting = val
def verbose_export() -> bool:
return verbosity_setting

@@ -46,6 +46,7 @@
logging.basicConfig(level=logging.INFO, format=FORMAT)

pkg_name = __name__
verbosity_setting = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be good to make this clearly internal, though I don't know if anyone imports this file.

Suggested change
verbosity_setting = None
_verbosity_setting = None

@@ -46,6 +46,7 @@
logging.basicConfig(level=logging.INFO, format=FORMAT)

pkg_name = __name__
verbosity_setting = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way for a user to override this, or is it effectively hard-disabled for now?

@@ -240,7 +250,8 @@ def quantize(
from torchao.quantization.quant_api import Int8DynActInt4WeightQuantizer

model = Int8DynActInt4WeightQuantizer(precision=torch_dtype).quantize(model)
print("quantized model:", model)
if verbose_export():
Copy link
Contributor

Choose a reason for hiding this comment

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

If the idea is to guard all prints with this, consider adding a custom print function like log_export() that does it internally to simplify the call sites.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in dfeadab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants