-
Notifications
You must be signed in to change notification settings - Fork 197
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
Feat (examples): add support for Stable Diffusion XL #909
Conversation
# Workaround to expose `in_features` attribute from the Hook Wrapper | ||
for m in pipe.unet.modules(): | ||
if isinstance(m, KwargsForwardHook) and hasattr(m.module, 'in_features'): | ||
m.in_features = m.module.in_features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@costigt-dev This (and similarly, line 129-131) is why I need the wrapper to expose the attributes of the wrapped module.
In this case, the wrapping is only temporary so I need to keep some sort of reference of wrapper vs wrapped
parser.add_argument( | ||
'--weight-quant-granularity', | ||
type=str, | ||
default='per_group', | ||
default='per_channel', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain a bit of context why this changes from per group to per channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have more robust support for per_channel quantization, including export representation.
We can export per_group quantized network but we're still defining the best way to represent that quantization style.
if args.export_target == 'torchscript': | ||
if args.weight_quant_granularity == 'per_group': | ||
export_manager = BlockQuantProxyLevelManager | ||
else: | ||
export_manager = TorchQCDQManager | ||
export_manager.change_weight_export(export_weight_q_node=True) | ||
export_manager.change_weight_export(export_weight_q_node=args.export_weight_q_node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the value from args always resolve to True/False type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there are mostly input and argument changes in this PR my only real question would be - have you run it or tested it to double check there isn't any clash with arguments? I'd like to give it a run myself (with supervision) since it's a hot topic demo but I don't want to hold up the PR, so I'm hitting 'approve'.
Great to see some improvements to comments in tricky code and notes on PR to add context!
I asked a couple of "put me in context here" questions, but I don't see any code that looks like it could be a bug. I suggest a bit of background info in PR descriptions would be good for next PRs.
Missing:
Possibly Learned Round but it could be very slowTorchscript export is deprecated since it is not used and difficult to make compatible with SD-XL.
More investigations are needed to fix it in case it is required.