Skip to content

Unify llama generate utils#3318

Merged
liangan1 merged 1 commit intopytorch:mainfrom
guangyey:guangyey/1st
Dec 29, 2025
Merged

Unify llama generate utils#3318
liangan1 merged 1 commit intopytorch:mainfrom
guangyey:guangyey/1st

Conversation

@guangyey
Copy link
Copy Markdown
Contributor

@guangyey guangyey commented Nov 10, 2025

Motivation

Unify llama generate utils via torch.accelerator APIs.

cc @albanD

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Nov 10, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3318

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:

✅ You can merge normally! (1 Unrelated Failure)

As of commit b7156ec with merge base 415e0e8 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-cla meta-cla 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 Nov 10, 2025
Copy link
Copy Markdown

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Sounds good to me.
But I'll let an ao maintainer accept the PR

Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 left a comment

Choose a reason for hiding this comment

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

looks good, as long as it works

if torch.xpu.is_available()
else "cpu"
)
default_device = acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe spell out the arg of current_accelerator to be clearer https://docs.pytorch.org/docs/stable/generated/torch.accelerator.current_accelerator.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jerryzh168 Done.

@guangyey
Copy link
Copy Markdown
Contributor Author

@pytorchbot label "topic: improvement"

@pytorch-bot pytorch-bot bot added the topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) label Nov 18, 2025
@guangyey
Copy link
Copy Markdown
Contributor Author

The CI workflow needs to be triggered.

@guangyey
Copy link
Copy Markdown
Contributor Author

@jerryzh168 I rebase this PR to the latest main already. Could you help re-trigger the CI.

@guangyey
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 mandatory check(s) are pending/not yet run. The first few are:

  • Facebook CLA Check

Dig deeper by viewing the pending checks on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: superuser

@jerryzh168
Copy link
Copy Markdown
Contributor

@guangyey we can't use pytorchbot here to merge the PR. we just click the button to merge

@xiaowangintel xiaowangintel added the ciflow/xpu label used to trigger xpu CI jobs label Dec 24, 2025
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Dec 24, 2025

To add the ciflow label ciflow/xpu please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@pytorch-bot pytorch-bot bot removed the ciflow/xpu label used to trigger xpu CI jobs label Dec 24, 2025
@xiaowangintel xiaowangintel added the ciflow/xpu label used to trigger xpu CI jobs label Dec 24, 2025
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Dec 24, 2025

To add the ciflow label ciflow/xpu please first approve the workflows that are awaiting approval (scroll to the bottom of this page).

This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows.

@pytorch-bot pytorch-bot bot removed the ciflow/xpu label used to trigger xpu CI jobs label Dec 24, 2025
@guangyey
Copy link
Copy Markdown
Contributor Author

Thanks, @jerryzh168. I’ll reach out to the Intel team to re-trigger the CI and land the PR once all checks are green.

@guangyey
Copy link
Copy Markdown
Contributor Author

The failure is irrelevant to this PR. The same failure can be found in https://github.com/pytorch/ao/actions/runs/20529844203/job/58979473220 that already landed in #3548

File "/opt/conda/envs/venv/lib/python3.10/site-packages/torchao/dtypes/nf4tensor.py", line 940, in __torch_dispatch__
    raise NotImplementedError(
NotImplementedError: NF4Tensor dispatch: attempting to run _c10d_functional._wrap_tensor_autograd.default, this is not supported

To execute this test, run the following from the base repo dir:
    python test/dtypes/test_nf4.py TestComm.test_comm

@liangan1
Copy link
Copy Markdown
Collaborator

Double confirmed, the UT fail is not related to this PR. Merged.

@liangan1 liangan1 merged commit f981d92 into pytorch:main Dec 29, 2025
20 of 21 checks passed
@guangyey
Copy link
Copy Markdown
Contributor Author

Thanks for your help!

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. topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants