Skip to content

Commit 83dafd1

Browse files
committed
Adding CPU and GPU variant
1 parent 3fe5b9d commit 83dafd1

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

ai-model/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
# Introduction
22

33
This is an example on how to run an AI model with [Ollama](https://ollama.com/)
4+
5+
## Running the AI model on the CPU
6+
7+
Just run the `runner.py` and use the `usage_scenario_cpu.yml`
8+
9+
## Running the AI model on the GPU
10+
11+
You must have the NVIDIA docker container provider installed and also a GPU on your system installed.
12+
13+
See https://hub.docker.com/r/ollama/ollama for details.
14+
15+
Then run the `runner.py` and use the `usage_scenario_gpu.yml` with the `--allow-unsafe` flag to mount the GPU into the containers.

ai-model/usage_scenario.yml renamed to ai-model/usage_scenario_cpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: AI model
33
author: Arne Tarara <[email protected]>
4-
description: Run an inference with a small AI model
4+
description: Run an inference with a small AI model on the CPU
55

66
compose-file: !include compose.yml
77

ai-model/usage_scenario_gpu.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: AI model
3+
author: Arne Tarara <[email protected]>
4+
description: Run an inference with a small AI model on the GPU
5+
6+
compose-file: !include compose.yml
7+
8+
services:
9+
gcb-ai-model:
10+
docker-run-args:
11+
- --gpus=all
12+
13+
flow:
14+
- name: Download gemma3-1b
15+
container: gcb-ai-model
16+
commands:
17+
- type: console
18+
command: ollama pull gemma3:1b
19+
read-notes-stdout: true
20+
log-stdout: true
21+
22+
- name: Load gemma3-1b into memory
23+
container: gcb-ai-model
24+
commands:
25+
- type: console
26+
command: ollama run gemma3:1b ""
27+
read-notes-stdout: true
28+
log-stdout: true
29+
30+
- name: Run Inference on gemma3-1b
31+
container: gcb-ai-model
32+
commands:
33+
- type: console
34+
command: ollama run gemma3:1b "Tell me a long joke?"
35+
read-notes-stdout: true
36+
log-stdout: true

0 commit comments

Comments
 (0)