-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (136 loc) · 4.69 KB
/
Copy pathgraalpy-demo.yml
File metadata and controls
164 lines (136 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: GraalPy Demo Suite
on:
push:
paths:
- 'demos/graalpy/**'
- '.github/workflows/graalpy-demo.yml'
pull_request:
paths:
- 'demos/graalpy/**'
- '.github/workflows/graalpy-demo.yml'
permissions:
contents: read
concurrency:
group: graalpy-demo-${{ github.ref }}
cancel-in-progress: true
jobs:
graalpy-smoke-test:
name: GraalPy Smoke Test (basic embedding)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: graalvm-community
java-version: "25"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run GraalPy smoke test
run: ./gradlew :demos:graalpy:runtimeCheck --no-daemon
graalpy-cpython-llama:
name: CPython LLM Inference
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download model
run: |
mkdir -p ~/.llama/models
# Use a tiny model for CI (faster)
curl -L -o ~/.llama/models/Llama-3.2-1B-Instruct-f16.gguf \
"https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-f16.gguf"
- name: Install llama-cpp-python
run: |
cd demos/graalpy
python3 -m venv .venv
source .venv/bin/activate
pip install llama-cpp-python
- name: Run CPython LLM inference
run: |
cd demos/graalpy
source .venv/bin/activate
python3 llama_inference.py --prompt "Hello" --max-tokens 16
graalpy-llama-failure:
name: GraalPy LLM (expected failure)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: graalvm-community
java-version: "25"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up Python for venv
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download model
run: |
mkdir -p ~/.llama/models
curl -L -o ~/.llama/models/Llama-3.2-1B-Instruct-f16.gguf \
"https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-f16.gguf"
- name: Setup CPython venv for GraalPy demo
run: |
cd demos/graalpy
python3 -m venv .venv
source .venv/bin/activate
pip install llama-cpp-python
- name: Run GraalPy LLM demo (expected to fail)
continue-on-error: true
id: graalpy_llama
run: ./gradlew :demos:graalpy:llama --no-daemon
- name: Verify expected failure
run: |
if [ "${{ steps.graalpy_llama.outcome }}" == "failure" ]; then
echo "✅ GraalPy LLM failed as expected (ctypes struct limitation)"
exit 0
else
echo "❌ Unexpected: GraalPy LLM should have failed but succeeded"
exit 1
fi
graalpy-full-suite:
name: GraalPy Full Suite (run all demos)
runs-on: ubuntu-latest
needs: [graalpy-smoke-test, graalpy-cpython-llama]
steps:
- uses: actions/checkout@v4
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: graalvm-community
java-version: "25"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download model
run: |
mkdir -p ~/.llama/models
curl -L -o ~/.llama/models/Llama-3.2-1B-Instruct-f16.gguf \
"https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-f16.gguf"
- name: Setup Python venv
run: |
cd demos/graalpy
python3 -m venv .venv
source .venv/bin/activate
pip install llama-cpp-python
- name: Run full suite (runtimeCheck + llamaPython will pass, llama will fail)
continue-on-error: true
run: ./gradlew :demos:graalpy:run --no-daemon
- name: Summary
run: |
echo "GraalPy Demo Suite Complete:"
echo " ✅ runtimeCheck - Basic GraalPy embedding"
echo " ✅ llamaPython - CPython LLM inference"
echo " ❌ llama - GraalPy LLM (expected failure)"