-
Notifications
You must be signed in to change notification settings - Fork 5
ai: add shimmy as alternative LLM backend #5
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
Open
awdemos
wants to merge
1
commit into
OrangeLab-space:main
Choose a base branch
from
awdemos:add-shimmy-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Shimmy | ||
|
|
||
| | | | | ||
| | ------------ | ---------------------------------------------- | | ||
| | Homepage | https://github.com/Michael-A-Kuykendall/shimmy | | ||
| | Source | https://github.com/Michael-A-Kuykendall/shimmy | | ||
| | Docker Image | ghcr.io/michael-a-kuykendall/shimmy | | ||
| | Endpoints | `https://shimmy.<domain>/` | | ||
|
|
||
| Shimmy is an OpenAI-compatible API server for GGUF models written in Rust. It auto-discovers models and supports CPU and GPU inference (CUDA, Vulkan, OpenCL, MLX). | ||
|
|
||
| ```sh | ||
| # (Optional) Use CPU-only mode (default when no GPU operator installed) | ||
| pulumi config set shimmy:gpu "" | ||
|
|
||
| # (Recommended) Or enable GPU support (requires installing the appropriate operator first) | ||
| # pulumi config set nvidia-gpu-operator:enabled true | ||
| # pulumi config set shimmy:gpu nvidia | ||
| # or | ||
| # pulumi config set amd-gpu-operator:enabled true | ||
| # pulumi config set shimmy:gpu amd | ||
|
|
||
| # (Optional) Increase volume size for bigger models (default: 50Gi) | ||
| pulumi config set shimmy:storageSize "100Gi" | ||
|
|
||
| # (Optional) Override shimmy image tag (default: latest) | ||
| pulumi config set shimmy:image "latest" | ||
|
|
||
| # Enable Shimmy | ||
| pulumi config set shimmy:enabled true | ||
| pulumi up | ||
| ``` | ||
|
|
||
| Models will be stored on local Longhorn volume with no replication across nodes. | ||
|
|
||
| ## Usage | ||
|
|
||
| Shimmy provides an OpenAI-compatible API on port 11434. Configure your tools to use the endpoint: | ||
|
|
||
| ```sh | ||
| # Get the endpoint | ||
| pulumi stack output --json | jq -r '.ai.endpoints.shimmy' | ||
|
|
||
| # For OpenAI-compatible tools, append /v1/ to the URL | ||
| # Example: https://shimmy.yourdomain.com/v1/chat/completions | ||
| ``` | ||
|
|
||
| ## Models | ||
|
|
||
| Shimmy auto-discovers GGUF models from the `/app/models` directory. Add models by: | ||
|
|
||
| 1. Downloading GGUF files to the models volume | ||
| 2. Models are automatically detected and available via the API | ||
|
|
||
| Find GGUF models at: | ||
|
|
||
| - Hugging Face: https://huggingface.co/models?library=gguf | ||
| - TheBloke quantizations: https://huggingface.co/TheBloke | ||
|
|
||
| ## GPU Support | ||
|
|
||
| - **CPU-only**: Set `shimmy:gpu ""` or leave unset (default) | ||
| - **NVIDIA**: Install nvidia-gpu-operator, set `shimmy:gpu nvidia` | ||
| - **AMD**: Install amd-gpu-operator, set `shimmy:gpu amd` | ||
|
|
||
| Shimmy auto-detects GPU backends (CUDA, Vulkan, OpenCL, MLX). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import * as pulumi from '@pulumi/pulumi'; | ||
| import { Application } from '@orangelab/application'; | ||
| import { config } from '@orangelab/config'; | ||
|
|
||
| export class Shimmy extends pulumi.ComponentResource { | ||
| public readonly endpointUrl?: string; | ||
| public readonly serviceUrl?: string; | ||
|
|
||
| private readonly app: Application; | ||
|
|
||
| constructor( | ||
| private name: string, | ||
| opts?: pulumi.ResourceOptions, | ||
| ) { | ||
| super('orangelab:ai:Shimmy', name, {}, opts); | ||
|
|
||
| const hostname = config.require(name, 'hostname'); | ||
|
|
||
| this.app = new Application(this, name).addStorage(); | ||
|
|
||
| if (this.app.storageOnly) return; | ||
|
|
||
| const httpEndpointInfo = this.app.network.getHttpEndpointInfo(); | ||
| const amdGpu = this.app.gpu === 'amd'; | ||
| const gfxVersion = config.get(this.name, 'HSA_OVERRIDE_GFX_VERSION'); | ||
| const amdTargets = config.get(this.name, 'HCC_AMDGPU_TARGETS'); | ||
|
|
||
| const imageTag = config.get(this.name, 'image') ?? 'latest'; | ||
| const commandArgs = ['serve', '--bind', '0.0.0.0:11434']; | ||
| if (!this.app.gpu) { | ||
| commandArgs.push('--gpu-backend', 'cpu'); | ||
| } else { | ||
| commandArgs.push('--gpu-backend', 'auto'); | ||
| } | ||
|
|
||
| this.app.addDeployment({ | ||
| ports: [{ name: 'http', port: 11434 }], | ||
| volumeMounts: [{ mountPath: '/app/models' }], | ||
| commandArgs, | ||
| image: `ghcr.io/michael-a-kuykendall/shimmy:${imageTag}`, | ||
| resources: { | ||
| requests: { memory: '512Mi' }, | ||
| limits: { memory: '2Gi' }, | ||
| }, | ||
| env: { | ||
| RUST_LOG: this.app.debug ? 'debug' : 'info', | ||
| SHIMMY_PORT: '11434', | ||
| SHIMMY_HOST: '0.0.0.0', | ||
| SHIMMY_BASE_GGUF: '/app/models', | ||
| HSA_OVERRIDE_GFX_VERSION: amdGpu && gfxVersion ? gfxVersion : undefined, | ||
| HCC_AMDGPU_TARGETS: amdGpu && amdTargets ? amdTargets : undefined, | ||
|
Collaborator
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. standard AMD driver vars, handled in containers.ts whenever |
||
| }, | ||
| healthChecks: true, | ||
| }); | ||
|
|
||
| this.endpointUrl = httpEndpointInfo.url; | ||
| this.serviceUrl = `http://${hostname}.shimmy:11434`; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
not needed anymore, just needs
<app>:image(shimmy:image=ghcr.io/michael-a-kuykendall/shimmy:latest) added to Pulumi.yaml