pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
2.21k stars 368 forks source link

Add exported program runner #6969

Closed dvorjackz closed 1 day ago

dvorjackz commented 2 days ago

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
pytorch-bot[bot] commented 2 days ago

:link: Helpful Links

:test_tube: 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.

:heavy_exclamation_mark: 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

:white_check_mark: No Failures

As of commit d595735f345564da55b04c92a0e35bc13648eb8a with merge base 711f1c23d32acd798dabf0028b31e8fcb2c2487f (image): :green_heart: Looks good so far! There are no failures yet. :green_heart:

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

facebook-github-bot commented 2 days ago

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

facebook-github-bot commented 1 day ago

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