Skip to content

Push torchtune install deeper in generate._gen_model_input and undo import order change for etmodel #1542

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

Jack-Khuu
Copy link
Contributor

@Jack-Khuu Jack-Khuu commented May 12, 2025

Follow up patch from #1539 which was meant to make torchtune an optional import


Tested with:

Success only when torchtune installed

python torchchat.py generate llama3.2-11B --prompt "What's in this image?" --image-prompt assets/dog.jpg --num-samples 3

Success regardless of torchtune install

python3 torchchat.py generate llama3.1-base --prompt "Once upon a time,"

Copy link

pytorch-bot bot commented May 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/1542

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

❌ 1 New Failure, 1 Cancelled Job, 2 Unrelated Failures

As of commit e56ed4b with merge base 98a5ac7 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following jobs 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.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 12, 2025
Copy link
Contributor

@zhenyan-zhang-meta zhenyan-zhang-meta left a comment

Choose a reason for hiding this comment

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

LGTM with comments. Can land after signal pass.

Comment on lines +1062 to +1063
# For llama::sdpa_with_kv_cache.out, preprocess ops
from executorch.extension.llm.custom_ops import custom_ops # no-qa
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: what's the difference this change made?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the original order prior to the other PR
We preserve the order due to how extension libraries interact (we want custom_ops to overwrite potential conflicts)

@@ -911,6 +904,14 @@ def _gen_model_input(
return encoded, None

# Llama 3.2 11B
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that everything below is for llama 3.2 11b? If so good to go, otherwise we need an if-else.

Will we in the future have more possibilities here in this func? If so, we list them with an if-else or switch-case chain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup everything below is 11B.
If there's more models that require casing this function as a whole should get refactored at that time

@Jack-Khuu Jack-Khuu merged commit d59a88d into main May 12, 2025
68 of 72 checks passed
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 Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants