Create unified script and workflow for llama-fast models validationin #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: executorch | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
gather-models: | |
runs-on: ubuntu-22.04 | |
outputs: | |
models: ${{ steps.gather-models.outputs.models }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'false' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Extract the list of models to test | |
id: gather-models | |
run: | | |
set -eux | |
PYTHONPATH="${PWD}" python ./scripts/gather_test_models.py | |
test-models-mobile-linux: | |
name: test-models-mobile-linux | |
needs: gather-models | |
strategy: | |
matrix: ${{ fromJSON(needs.gather-models.outputs.models) }} | |
runs-on: "32-core-ubuntu" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Print machine info | |
run: | | |
uname -a | |
if [ $(uname -s) == Linux ]; then | |
cat /proc/cpuinfo | grep name | head -n 1 | cut -d ':' -f2 # CPU brand string (model name) | |
cat /proc/cpuinfo | grep physical id | wc -l # Number of physical cores | |
fi | |
- name: Install ExecuTorch | |
run: | | |
export LLAMA_FAST_ROOT=${PWD} | |
bash ${LLAMA_FAST_ROOT}/scripts/install_et.sh | |
- name: Download checkpoints | |
run: | | |
CHECKPOINT_NAME = ${{ matrix.checkpoint_name }} | |
pushd ${LLAMA_FAST_ROOT} | |
mkdir -p checkpoints/${CHECKPOINT_NAME} | |
cd checkpoints/${CHECKPOINT_NAME} | |
for resource in ${{ matrix.resource }} | |
do | |
wget $resource | |
done | |
popd | |
- name: Run inference | |
run: | | |
pushd ${LLAMA_FAST_ROOT} | |
export CHECKPOINT_PATH=${LLAMA_FAST_ROOT}/checkpoints/${CHECKPOINT_NAME}/${CHECKPOINT_NAME}.pt | |
export MODEL_NAME=${CHECKPOINT_NAME} | |
python generate.py --checkpoint-path ${CHECKPOINT_PATH} --temperature 0 > ${PWD}/output_eager | |
cat ${PWD}/output_eager | |
python export.py --checkpoint-path ${CHECKPOINT_PATH} --output-pte-path ${PWD}/${MODEL_NAME}.pte | |
python generate.py --checkpoint-path ${CHECKPOINT_PATH} --temperature 0 --pte-path ${PWD}/${MODEL_NAME}.pte > ${PWD}/output_et | |
cat ${PWD}/output_et | |
echo "Tests complete." | |
test-models-mobile-macos-m1: | |
name: test-models-mobile-macos-m1 | |
needs: gather-models | |
strategy: | |
matrix: ${{ fromJSON(needs.gather-models.outputs.models) }} | |
runs-on: "macos-m1-12" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Print machine info | |
run: | | |
uname -a | |
if [ $(uname -s) == Darwin ]; then | |
sysctl machdep.cpu.brand_string | |
sysctl machdep.cpu.core_count | |
fi | |
- name: Install ExecuTorch | |
run: | | |
export LLAMA_FAST_ROOT=${PWD} | |
bash ${LLAMA_FAST_ROOT}/scripts/install_et.sh | |
- name: Download checkpoints | |
run: | | |
CHECKPOINT_NAME = ${{ matrix.checkpoint_name }} | |
pushd ${LLAMA_FAST_ROOT} | |
mkdir -p checkpoints/${CHECKPOINT_NAME} | |
cd checkpoints/${CHECKPOINT_NAME} | |
for resource in ${{ matrix.resource }} | |
do | |
wget $resource | |
done | |
popd | |
- name: Run inference | |
run: | | |
pushd ${LLAMA_FAST_ROOT} | |
export CHECKPOINT_PATH=${LLAMA_FAST_ROOT}/checkpoints/${CHECKPOINT_NAME}/${CHECKPOINT_NAME}.pt | |
export MODEL_NAME=${CHECKPOINT_NAME} | |
python generate.py --checkpoint-path ${CHECKPOINT_PATH} --temperature 0 > ${PWD}/output_eager | |
cat ${PWD}/output_eager | |
python export.py --checkpoint-path ${CHECKPOINT_PATH} --output-pte-path ${PWD}/${MODEL_NAME}.pte | |
python generate.py --checkpoint-path ${CHECKPOINT_PATH} --temperature 0 --pte-path ${PWD}/${MODEL_NAME}.pte > ${PWD}/output_et | |
cat ${PWD}/output_et | |
echo "Tests complete." |