@@ -752,4 +752,56 @@ jobs:
752
752
./et-build/cmake-out/runner_et ${PWD}/stories15M.pte -z ${MODEL_DIR}/tokenizer.bin -i "${PROMPT}" > ${PWD}/output_et
753
753
cat ${PWD}/output_et
754
754
755
+ echo "Tests complete."
756
+ runner-aoti :
757
+ name : test-runner-aoti (${{ matrix.platform }}, ${{ matrix.model_name }})
758
+ needs : gather-models-cpu
759
+ strategy :
760
+ matrix : ${{ fromJSON(needs.gather-models-cpu.outputs.models) }}
761
+ fail-fast : false
762
+ runs-on : ${{ matrix.runner }}
763
+ env :
764
+ TORCHCHAT_ROOT : ${{ github.workspace }}
765
+ REPO_NAME : ${{ matrix.repo_name }}
766
+ steps :
767
+ - name : Checkout repo
768
+ uses : actions/checkout@v3
769
+ - name : Setup Python
770
+ uses : actions/setup-python@v4
771
+ with :
772
+ python-version : ' 3.11'
773
+ - name : Print machine info
774
+ run : |
775
+ echo "$(uname -a)"
776
+ - name : Install dependencies
777
+ run : |
778
+ pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
779
+ pip install -r requirements.txt
780
+ pip list
781
+
782
+ cd ${TORCHCHAT_ROOT}/runner-aoti
783
+ cmake -Bbuild -DCMAKE_PREFIX_PATH=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'`
784
+ cmake --build build
785
+ cd ..
786
+ - name : Download checkpoint
787
+ run : |
788
+ mkdir -p checkpoints/stories15M
789
+ pushd checkpoints/stories15M
790
+ wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.pt
791
+ wget https://github.com/karpathy/llama2.c/raw/master/tokenizer.model
792
+ wget https://github.com/karpathy/llama2.c/raw/master/tokenizer.bin
793
+ popd
794
+ - name : Run inference
795
+ run : |
796
+ export MODEL_DIR=${PWD}/checkpoints/stories15M
797
+ export PROMPT="Once upon a time in a land far away"
798
+
799
+ python torchchat.py generate --checkpoint-path ${MODEL_DIR}/stories15M.pt --temperature 0 --prompt "${PROMPT}" > ${PWD}/output_eager
800
+ cat ${PWD}/output_eager
801
+
802
+ python torchchat.py export --checkpoint-path ${MODEL_DIR}/stories15M.pt --output-dso-path /tmp/model.so
803
+
804
+ ./runner-aoti/build/run /tmp/model.so -z ${MODEL_DIR}/tokenizer.bin -i "${PROMPT}" > ${PWD}/output_aoti
805
+ cat ${PWD}/output_aoti
806
+
755
807
echo "Tests complete."
0 commit comments