Skip to content

Commit 582afb6

Browse files
committed
feat(ci): test lookup on cpu without neuronx
This is to veirfy that, disregarding what it is done with commands, it is always possible to install optimum neuron without the neuronx extra and run the cache lookup command.
1 parent bdbd0d1 commit 582afb6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Optimum Neuron / Cache Lookup on CPU
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "pyproject.toml"
8+
- "optimum/**.py"
9+
- ".github/workflows/test_cpu_lookup.yml"
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- "pyproject.toml"
14+
- "optimum/**.py"
15+
- ".github/workflows/test_cpu_lookup.yml"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
test-cpu-compilation:
23+
name: Run CPU Compilation Tests
24+
runs-on: ubuntu-22.04
25+
env:
26+
MODEL_ID: Qwen/Qwen3-0.6B
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Setup Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: "3.11"
34+
- name: Install Neuronx runtime
35+
uses: ./.github/actions/install_neuronx_runtime
36+
- name: Prepare virtual environment
37+
uses: ./.github/actions/prepare_venv
38+
- name: Install optimum-neuron
39+
uses: ./.github/actions/install_optimum_neuron
40+
- name: Setup PATH
41+
run: echo "/home/ubuntu/.local/bin" >> $GITHUB_PATH
42+
- name: Export sample model and synchronize cache
43+
run: |
44+
source aws_neuron_venv_pytorch/bin/activate
45+
HF_TOKEN=${{ secrets.HF_TOKEN_OPTIMUM_NEURON_CI }} \
46+
optimum-cli export neuron -m $MODEL_ID /tmp/exported-$MODEL_ID \
47+
--batch_size 4 --sequence_length 4096 --tensor_parallel_size 2 --instance_type trn1
48+
HF_TOKEN=${{secrets.HF_TOKEN_OPTIMUM_NEURON_CACHE}} \
49+
optimum-cli neuron cache synchronize
50+
- name: Setup new virtual environment without neuronx
51+
run: |
52+
python3 -m venv on-no-neuronx
53+
source on-no-neuronx/bin/activate
54+
pip install torch==2.8.0 torchvision~=0.23 --index-url https://download.pytorch.org/whl/cpu
55+
pip install .
56+
- name: Run lookup test
57+
run: |
58+
source on-no-neuronx/bin/activate
59+
HF_TOKEN=${{secrets.HF_TOKEN_OPTIMUM_NEURON_CACHE}} \
60+
optimum-cli neuron cache lookup $MODEL_ID

0 commit comments

Comments
 (0)