Skip to content

Conversation

shewu-quic
Copy link
Collaborator

Summary:

  • Refactor custom annotation for R3
  • Fix warning message in quantization
  • Add phi-4-mini setting into README
  • Fixed segmemtation fault when run the model with sharding
  • Add a test case for phi-4 in test_qnn_delegate.py
  • Add new parameter "group_size" in llama.py to set block size in block quantization

Sample Script

python examples/qualcomm/oss_scripts/llama/llama.py -b build-android -s ${SERIAL_NUM} -m ${SOC_MODEL} \ 
--ptq 16a4w_block --group_size 16 --checkpoint consolidated.00.pth --params params.json --num_sharding 4 \
--tokenizer_model tokenizer.model --decoder_model phi_4_mini --model_mode hybrid --prefill_ar_len 128 \ 
--max_seq_len 1024 --prompt "I would like to learn python, could you teach me with a simple example?"

Result

Stats with QNN2.37.0 on SM8750
Accuracy: 10.82
Token Rate: 22.727273
Results:
--prompt "I would like to learn python, could you teach me with a simple example?"

<|user|>I would like to learn python, could you teach me with one simple program?<|end|><|assistant|>Of course! Let's get started with a simple Python program. We'll create a simple program that asks for your name and then greets you.

```python
# Ask for the user's name
name = input("Please enter your name: ")

# Greet the user
print(f"Hello, {name}! Welcome to the world of Python.")

To run this program, you would need to copy the code into a Python environment (like an IDE or a Python interpreter). When you run the program, it will prompt you to enter your name, and then it will greet you by name. Enjoy learning Python!<|end|>


## Test plan
Added E2E test to test_qnn_delegate.py

cc: @haowhsu-quic 

Summary:

- Refactor custom annotation for R3
- Fix warning message in quantization
- Add phi-4-mini setting into README
- Fixed segmemtation fault when run the model with sharding
- Add a test case for phi-4 in test_qnn_delegate.py
- Add new parameter "group_size" in llama.py to set block size in block
  quantization
@shewu-quic shewu-quic requested a review from cccclai as a code owner August 21, 2025 06:42
Copy link

pytorch-bot bot commented Aug 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13573

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

❌ 2 New Failures

As of commit fc31b75 with merge base 3dac421 (image):

NEW FAILURES - The following jobs have failed:

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 Aug 21, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@shewu-quic
Copy link
Collaborator Author

Hi @cccclai ,
This PR is to add phi-4-mini setting into README and fix some minor issue.
Could you please help to take a look? Thanks!

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this in D80711106.

Copy link
Contributor

@cccclai cccclai 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, thank you!

@cccclai cccclai merged commit b743cc1 into pytorch:main Aug 25, 2025
103 of 107 checks passed
agrima1304 pushed a commit to agrima1304/executorch that referenced this pull request Aug 26, 2025
…torch#13573)

Summary:

- Refactor custom annotation for R3
- Fix warning message in quantization
- Add phi-4-mini setting into README
- Fixed segmemtation fault when run the model with sharding
- Add a test case for phi-4 in test_qnn_delegate.py
- Add new parameter "group_size" in llama.py to set block size in block
quantization

## Sample Script
```
python examples/qualcomm/oss_scripts/llama/llama.py -b build-android -s ${SERIAL_NUM} -m ${SOC_MODEL} \ 
--ptq 16a4w_block --group_size 16 --checkpoint consolidated.00.pth --params params.json --num_sharding 4 \
--tokenizer_model tokenizer.model --decoder_model phi_4_mini --model_mode hybrid --prefill_ar_len 128 \ 
--max_seq_len 1024 --prompt "I would like to learn python, could you teach me with a simple example?"
```

## Result
Stats with QNN2.37.0 on SM8750
Accuracy: 10.82
Token Rate: 22.727273
Results:
--prompt "I would like to learn python, could you teach me with a simple
example?"
```
<|user|>I would like to learn python, could you teach me with one simple program?<|end|><|assistant|>Of course! Let's get started with a simple Python program. We'll create a simple program that asks for your name and then greets you.

```python
# Ask for the user's name
name = input("Please enter your name: ")

# Greet the user
print(f"Hello, {name}! Welcome to the world of Python.")
```

To run this program, you would need to copy the code into a Python environment (like an IDE or a Python interpreter). When you run the program, it will prompt you to enter your name, and then it will greet you by name. Enjoy learning Python!<|end|>
```

## Test plan
Added E2E test to test_qnn_delegate.py

cc: @haowhsu-quic
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants