@@ -139,11 +139,12 @@ model produces sensible text.
139139## Build the runner
140140
141141``` bash
142- make gemma4_31b-cuda # Linux — CUDA backend
143- make gemma4_31b-mlx # macOS — MLX backend (Apple Silicon )
142+ make gemma4_31b-cuda # Linux — CUDA runner + serving worker
143+ make gemma4_31b-mlx # macOS — MLX runner (serving later )
144144```
145145
146- The binary lands at ` cmake-out/examples/models/gemma4_31b/gemma4_31b_runner ` .
146+ The CUDA build also produces
147+ ` cmake-out/examples/models/gemma4_31b/gemma4_31b_worker ` .
147148
148149## Run the .pte
149150
@@ -162,3 +163,29 @@ Pass `--raw_prompt` to skip template wrapping for pre-formatted input.
162163
163164For benchmarking, add ` --cuda_graph ` to capture the decode method in a CUDA
164165graph (decode is fully static — ` T=1 ` ).
166+
167+ ## Serving
168+
169+ The CUDA OpenAI-compatible server is a Python control plane plus a C++ model worker.
170+ The worker owns the ExecuTorch model and speaks the shared JSONL protocol used by
171+ the generic LLM server.
172+
173+ ``` bash
174+ LD_LIBRARY_PATH=$CONDA_PREFIX /lib:$LD_LIBRARY_PATH \
175+ python -m executorch.examples.models.gemma4_31b.serve \
176+ --model-path ./gemma4_31b_exports/model.pte \
177+ --data-path ./gemma4_31b_exports/aoti_cuda_blob.ptd \
178+ --tokenizer-path ./gemma4_31b_int4/tokenizer.json \
179+ --hf-tokenizer ./gemma4_31b_int4 \
180+ --model-id gemma4-31b \
181+ --max-sessions 1
182+ ```
183+
184+ The launcher defaults to the Hermes ` <tool_call>{...}</tool_call> ` parser. Use
185+ ` --tool-parser qwen ` or ` --tool-parser none ` if the model/template you are
186+ testing emits a different tool-call format.
187+
188+ Named sessions and warm resume require worker capacity above one. CUDA exports
189+ with ` get_mutable_buffer_metadata ` can use per-session mutable rebinding and
190+ advertise ` --max-sessions > 1 ` ; older exports fail closed to a single scratch
191+ session. MLX serving is intentionally left for a later change.
0 commit comments