Skip to content

Conversation

@jackzhxng
Copy link
Contributor

Summary

Add an ExportedProgram runner for TorchTune Llama.

Test plan

# Download resources
tune download meta-llama/Llama-3.2-11B-Vision-Instruct --output-dir /tmp/Llama-3.2-11B-Vision-Instruct

# Export model
python -m examples.models.llama.export_llama --model llama3_2_vision --checkpoint /tmp/Llama-3.2-11B-Vision-Instruct/original/consolidated.pth --params examples/models/llama3_2_vision/text_decoder/params/demo_config.json  --metadata '{"append_eos_to_prompt": 0, "get_bos_id":128000, "get_eos_ids":[128009, 128001], "get_n_bos": 0, "get_n_eos": 0}' --output_name="llama3_2_vision.pt2" -d fp32 --verbose --max_seq_length 64 --export_only -kv

# Run ExportedProgram
python -m examples.models.llama3_2_vision.runner.exported --model llama3_2_vision --pt2 llama3_2_vision.pt2  --tokenizer /tmp/Llama-3.2-11B-Vision-Instruct/original/tokenizer.model --prompt "How many calories are in bread?" --params examples/models/llama3_2_vision/text_decoder/params/demo_config.json --max_seq_length 64 -kv

Output:

The number of calories in bread can vary greatly depending on the type of bread, its ingredients, and its size. Here are the approximate calorie counts for different types of bread:                                                                                                        
White bread: 80-100 calories per slice

@jackzhxng jackzhxng added the release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava label Nov 19, 2024
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 19, 2024

🔗 Helpful Links

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

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:

✅ No Failures

As of commit d595735 with merge base 711f1c2 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 19, 2024
@facebook-github-bot
Copy link
Contributor

@dvorjackz has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@jackzhxng jackzhxng force-pushed the jz/export_runner branch 3 times, most recently from 2210565 to 8328ce1 Compare November 20, 2024 21:39
Summary:
Add an `ExportedProgram` runner for TorchTune Llama.


Test Plan:
```
# Download resources
tune download meta-llama/Llama-3.2-11B-Vision-Instruct --output-dir /tmp/Llama-3.2-11B-Vision-Instruct

# Export model
python -m examples.models.llama.export_llama --model llama3_2_vision --checkpoint /tmp/Llama-3.2-11B-Vision-Instruct/original/consolidated.pth --params examples/models/llama3_2_vision/text_decoder/params/demo_config.json  --metadata '{"append_eos_to_prompt": 0, "get_bos_id":128000, "get_eos_ids":[128009, 128001], "get_n_bos": 0, "get_n_eos": 0}' --output_name="llama3_2_vision.pt2" -d fp32 --verbose --max_seq_length 64 --export_only -kv

# Run ExportedProgram
python -m examples.models.llama3_2_vision.runner.exported --model llama3_2_vision --pt2 llama3_2_vision.pt2  --tokenizer /tmp/Llama-3.2-11B-Vision-Instruct/original/tokenizer.model --prompt "How many calories are in bread?" --params examples/models/llama3_2_vision/text_decoder/params/demo_config.json --max_seq_length 64 -kv
```

Output:
```
The number of calories in bread can vary greatly depending on the type of bread, its ingredients, and its size. Here are the approximate calorie counts for different types of bread:                                                                                                        
White bread: 80-100 calories per slice
```

Differential Revision: D66186052

Pulled By: dvorjackz
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66186052

@jackzhxng jackzhxng merged commit a93e716 into main Nov 21, 2024
43 checks passed
@jackzhxng jackzhxng deleted the jz/export_runner branch November 21, 2024 00:11
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. fb-exported release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants