Skip to content

Add _get_dummy_inputs_for_model helper for quantization tests#13540

Closed
jiqing-feng wants to merge 5 commits into
huggingface:mainfrom
jiqing-feng:torchao-fix-input-dtype
Closed

Add _get_dummy_inputs_for_model helper for quantization tests#13540
jiqing-feng wants to merge 5 commits into
huggingface:mainfrom
jiqing-feng:torchao-fix-input-dtype

Conversation

@jiqing-feng
Copy link
Copy Markdown
Contributor

What does this PR do?

Introduces _get_dummy_inputs_for_model(model) helper in both QuantizationTesterMixin and QuantizationCompileTesterMixin to automatically cast floating-point input tensors to the model's parameter dtype, preventing dtype mismatches during quantized model inference.

@github-actions github-actions Bot added tests size/S PR with diff < 50 LOC and removed size/S PR with diff < 50 LOC labels Apr 22, 2026
Introduce helper that casts floating-point input tensors to the model's
parameter dtype, preventing dtype mismatches during quantized model inference.
@jiqing-feng jiqing-feng force-pushed the torchao-fix-input-dtype branch from 0bf81b5 to adffdbd Compare April 22, 2026 01:55
@github-actions github-actions Bot added size/M PR with diff < 200 LOC and removed size/S PR with diff < 50 LOC labels Apr 22, 2026
@github-actions github-actions Bot added size/M PR with diff < 200 LOC and removed size/M PR with diff < 200 LOC labels Apr 22, 2026
@github-actions github-actions Bot added size/S PR with diff < 50 LOC and removed size/M PR with diff < 200 LOC labels Apr 22, 2026
@github-actions github-actions Bot added size/S PR with diff < 50 LOC and removed size/S PR with diff < 50 LOC labels Apr 28, 2026
@jiqing-feng
Copy link
Copy Markdown
Contributor Author

Hi @sayakpaul . Would you please review this PR? Thanks!

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

We should be able to leverage the self.torch_dtype property for this stuff. Refer to #13481

@jiqing-feng
Copy link
Copy Markdown
Contributor Author

Yes, right. Close this PR as no longer needed.

@jiqing-feng jiqing-feng deleted the torchao-fix-input-dtype branch May 27, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants