Skip to content

Update torchao usage for XPU and CPU#45560

Merged
stevhliu merged 1 commit intohuggingface:mainfrom
jiqing-feng:torchao
Apr 22, 2026
Merged

Update torchao usage for XPU and CPU#45560
stevhliu merged 1 commit intohuggingface:mainfrom
jiqing-feng:torchao

Conversation

@jiqing-feng
Copy link
Copy Markdown
Contributor

Update torchao quantization doc to align with latest torchao API changes.

Changes

  • XPU int4: Removed manual Int4XPULayout and ZeroPointDomain setup — Int4WeightOnlyConfig now handles these internally.
  • CPU int4: Replaced deprecated Int4WeightOnlyOpaqueTensorConfig with PrototypeInt4WeightOnlyConfig.
  • .to() fix: Split .to(device, dtype) into .to(device).to(dtype) to avoid incorrect casting.

Why

torchao updated its APIs: XPU int4 config now auto-handles layout/zero-point internally, CPU int4 config was renamed and moved to a new module path. The .to() chaining fix ensures device placement and dtype casting are applied correctly.

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@jiqing-feng jiqing-feng marked this pull request as ready for review April 22, 2026 03:11
@github-actions github-actions Bot requested a review from stevhliu April 22, 2026 03:12
@jiqing-feng
Copy link
Copy Markdown
Contributor Author

jiqing-feng commented Apr 22, 2026

Hi @stevhliu . Would you please review the PR? Thanks!

Copy link
Copy Markdown
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

thanks for updating!

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu stevhliu added this pull request to the merge queue Apr 22, 2026
Merged via the queue into huggingface:main with commit b00b7c0 Apr 22, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants