-
Notifications
You must be signed in to change notification settings - Fork 211
Add support for ${MODEL_ID} macro #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,6 +49,7 @@ macros: | |||||||||||||
| # - required | ||||||||||||||
| # - each key is the model's ID, used in API requests | ||||||||||||||
| # - model settings have default values that are used if they are not defined here | ||||||||||||||
| # - the model's ID is available in the ${MODEL_ID} macro, also available in macros defined above | ||||||||||||||
| # - below are examples of the various settings a model can have: | ||||||||||||||
| # - available model settings: env, cmd, cmdStop, proxy, aliases, checkEndpoint, ttl, unlisted | ||||||||||||||
| models: | ||||||||||||||
|
|
@@ -148,12 +149,12 @@ models: | |||||||||||||
| cmd: llama-server --port ${PORT} -m Llama-3.2-1B-Instruct-Q4_K_M.gguf -ngl 0 | ||||||||||||||
|
|
||||||||||||||
| # Docker example: | ||||||||||||||
| # container run times like Docker and Podman can be used reliably with a | ||||||||||||||
| # a combination of cmd and cmdStop. | ||||||||||||||
| # container runtimes like Docker and Podman can be used reliably with | ||||||||||||||
| # a combination of cmd, cmdStop, and ${MODEL_ID} | ||||||||||||||
| "docker-llama": | ||||||||||||||
|
Comment on lines
+152
to
154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid suggesting ${MODEL_ID} for container names; many model IDs are not Docker/Podman-safe. Model IDs can contain '/', ':' (e.g., author/model:variant), which are invalid in container names. Recommend ${PORT} (numeric, unique per model using it) for names and stopping commands. This is a documentation/runtime correctness fix; MODEL_ID remains trusted input per project learnings. Apply this diff: - # container runtimes like Docker and Podman can be used reliably with
- # a combination of cmd, cmdStop, and ${MODEL_ID}
+ # container runtimes like Docker and Podman can be used with cmd/cmdStop.
+ # NOTE: prefer ${PORT} for container names; ${MODEL_ID} may contain '/' or ':' and won't be a valid container name.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| proxy: "http://127.0.0.1:${PORT}" | ||||||||||||||
| cmd: | | ||||||||||||||
| docker run --name dockertest | ||||||||||||||
| docker run --name ${MODEL_ID} | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use a PORT-based container name to ensure validity across all model IDs. Prevents failures when MODEL_ID contains invalid characters for container names. Apply this diff: - docker run --name ${MODEL_ID}
+ docker run --name llama-${PORT}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| --init --rm -p ${PORT}:8080 -v /mnt/nvme/models:/models | ||||||||||||||
| ghcr.io/ggml-org/llama.cpp:server | ||||||||||||||
| --model '/models/Qwen2.5-Coder-0.5B-Instruct-Q4_K_M.gguf' | ||||||||||||||
|
|
@@ -167,7 +168,7 @@ models: | |||||||||||||
| # - on POSIX systems: a SIGTERM signal is sent | ||||||||||||||
| # - on Windows, calls taskkill to stop the process | ||||||||||||||
| # - processes have 5 seconds to shutdown until forceful termination is attempted | ||||||||||||||
| cmdStop: docker stop dockertest | ||||||||||||||
| cmdStop: docker stop ${MODEL_ID} | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Align cmdStop with the PORT-based container name. Keeps start/stop symmetric and robust to arbitrary model IDs. Apply this diff: - cmdStop: docker stop ${MODEL_ID}
+ cmdStop: docker stop llama-${PORT}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| # groups: a dictionary of group settings | ||||||||||||||
| # - optional, default: empty dictionary | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Clarify where ${MODEL_ID} expands (cmd/cmdStop only).
As implemented, ${MODEL_ID} is substituted in model.cmd and model.cmdStop (not in proxy or checkEndpoint). Update the comment to avoid implying broader scope.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents