Skip to content

Commit 66c135c

Browse files
authored
Update instrumentation test docs (#10173)
CI won't test this due to OOM. Now we rely on local instrumentation test.
1 parent 1c098fb commit 66c135c

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

examples/demo-apps/android/LlamaDemo/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,33 @@ Ensure you have the following functions in your callback class that you provided
141141

142142
```
143143

144+
## Instrumentation Test
145+
You can run the instrumentation test for sanity check. The test loads a model pte file and tokenizer.bin file
146+
under `/data/local/tmp/llama`.
147+
148+
### Model preparation
149+
Go to ExecuTorch root,
150+
```sh
151+
curl -C - -Ls "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt" --output stories110M.pt
152+
curl -C - -Ls "https://raw.githubusercontent.com/karpathy/llama2.c/master/tokenizer.model" --output tokenizer.model
153+
# Create params.json file
154+
touch params.json
155+
echo '{"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000}' > params.json
156+
python -m examples.models.llama.export_llama -c stories110M.pt -p params.json -d fp16 -n stories110m_h.pte -kv
157+
python -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
158+
```
159+
### Push model
160+
```sh
161+
adb mkdir -p /data/local/tmp/llama
162+
adb push stories110m_h.pte /data/local/tmp/llama
163+
adb push tokenizer.bin /data/local/tmp/llama
164+
```
165+
166+
### Run test
167+
Go to `examples/demo-apps/android/LlamaDemo`,
168+
```sh
169+
./gradlew connectedAndroidTest
170+
```
171+
144172
## Reporting Issues
145173
If you encountered any bugs or issues following this tutorial please file a bug/issue here on [Github](https://github.com/pytorch/executorch/issues/new).
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -eu
9+
10+
BASEDIR=$(dirname "$0")
11+
pushd "$BASEDIR"/../../../../
12+
curl -C - -Ls "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt" --output stories110M.pt
13+
curl -C - -Ls "https://raw.githubusercontent.com/karpathy/llama2.c/master/tokenizer.model" --output tokenizer.model
14+
# Create params.json file
15+
touch params.json
16+
echo '{"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000}' > params.json
17+
python -m examples.models.llama.export_llama -c stories110M.pt -p params.json -d fp16 -n stories110m_h.pte -kv
18+
python -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
19+
20+
adb mkdir -p /data/local/tmp/llama
21+
adb push stories110m_h.pte /data/local/tmp/llama
22+
adb push tokenizer.bin /data/local/tmp/llama
23+
popd
24+
25+
pushd "$BASEDIR"
26+
./gradlew connectedAndroidTest
27+
popd
28+

0 commit comments

Comments
 (0)