-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from Gregory-Pereira/fix-whispercpp-ms-docs-a…
…nd-make update whipser ms scripts and docs
- Loading branch information
Showing
4 changed files
with
119 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -4,19 +4,25 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
# paths: | ||
# - ./model_servers/llamacpp_python/** | ||
# - .github/workflows/model_servers.yaml | ||
paths: | ||
- ./model_servers/ | ||
- .github/workflows/model_servers.yaml | ||
push: | ||
branches: | ||
- main | ||
# paths: | ||
# - ./model_servers/llamacpp_python/** | ||
# - .github/workflows/model_servers.yaml | ||
paths: | ||
- ./model_servers/ | ||
- .github/workflows/model_servers.yaml | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository_owner }}/model_servers | ||
# Image Repo Migration variables | ||
NEW_REGISTRY: quay.io | ||
NEW_REGISTRY_USER: ai-lab+ghrobot | ||
NEW_IMAGE_NAME_LLAMA: quay.io/ai-lab/model_servers/llamacpp_python | ||
IMAGE_NAME_WHISPER: quay.io/ai-lab/model_servers/whispercpp | ||
|
||
|
||
jobs: | ||
build-and-push-image: | ||
|
@@ -78,3 +84,47 @@ jobs: | |
image: ${{ steps.build_image.outputs.image }} | ||
tags: ${{ steps.build_image.outputs.tags }} | ||
registry: ${{ env.REGISTRY }} | ||
build-and-push-image-whispercpp: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
services: | ||
registry: | ||
image: registry:2.8.3 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- name: Build Image Whispercpp | ||
id: build_image_whisper | ||
uses: redhat-actions/[email protected] | ||
working-directory: ./model_servers/whispercpp/ | ||
run: make build | ||
|
||
- name: Download model Whispercpp | ||
working-directory: ./model_servers/whispercpp/ | ||
run: make download-model-whisper-small | ||
|
||
- name: Login to container registry | ||
if: > | ||
(github.event_name == 'push' || github.event_name == 'schedule') && | ||
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.NEW_REGISTRY }} | ||
username: ${{ env.NEW_REGISTRY_USER }} | ||
password: ${{ secrets.AILAB_GHROBOT_TOKEN }} # THIS NEEDS TO BE CREATED | ||
|
||
- name: Push image | ||
id: push_image | ||
if: > | ||
(github.event_name == 'push' || github.event_name == 'schedule') && | ||
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
uses: redhat-actions/[email protected] | ||
with: | ||
image: ${{ steps.build_image_whisper.outputs.image }} | ||
tags: ${{ steps.build_image_whisper.outputs.tags }} | ||
registry: ${{ env.NEW_REGISTRY }} | ||
|
This file contains 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,47 @@ | ||
PORT := 8001 | ||
APP := whispercpp | ||
IMAGE := quay.io/ai-lab/model_servers/$(APP):latest | ||
CUDA_IMAGE := quay.io/ai-lab/model_servers/$(APP)_cuda:latest | ||
VULKAN_IMAGE :=quay.io/ai-lab/model_servers/$(APP)_vulkan:latest | ||
|
||
# ----- MODEL OPTIONS ----- | ||
|
||
WHISPER_SMALL_MODEL_NAME := ggml-small.bin | ||
WHISPER_SMALL_MODEL_URL := https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin | ||
|
||
WHISPER_BASE_MODEL_NAME := ggml-base.en.bin | ||
WHISPER_BASE_MODEL_URL := https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin | ||
|
||
SELECTED_MODEL_NAME := $(or $(SELECTED_MODEL),$(WHISPER_SMALL_MODEL_NAME)) | ||
|
||
# --- END MODEL OPTIONS --- | ||
|
||
MODELS_PATH := /app/models | ||
|
||
BIND_MOUNT_OPTIONS := ro | ||
OS := $(shell uname -s) | ||
ifeq ($(OS),Linux) | ||
BIND_MOUNT_OPTIONS := Z,ro | ||
endif | ||
|
||
.PHONY: all | ||
all: build download-model-whisper-small run | ||
|
||
.PHONY: build | ||
build: | ||
podman build -t $(IMAGE) . -f Containerfile | ||
|
||
.PHONY: download-model-whisper-small | ||
download-model-whisper-small: | ||
cd ../../models && \ | ||
curl -s -S -L -f $(WHISPER_SMALL_MODEL_URL) -z $(WHISPER_SMALL_MODEL_NAME) -o $(WHISPER_SMALL_MODEL_NAME).tmp && mv -f $(WHISPER_SMALL_MODEL_NAME).tmp $(WHISPER_SMALL_MODEL_NAME) 2>/dev/null || rm -f $(WHISPER_SMALL_MODEL_NAME).tmp $(WHISPER_SMALL_MODEL_NAME) | ||
|
||
.PHONY: download-model-whisper-base | ||
download-model-whisper-base: | ||
cd ../../models && \ | ||
curl -s -S -L -f $(WHISPER_BASE_MODEL_URL) -z $(WHISPER_BASE_MODEL_NAME) -o $(WHISPER_BASE_MODEL_NAME).tmp && mv -f $(WHISPER_BASE_MODEL_NAME).tmp $(WHISPER_BASE_MODEL_NAME) 2>/dev/null || rm -f $(WHISPER_BASE_MODEL_NAME).tmp $(WHISPER_BASE_MODEL_NAME) | ||
|
||
.PHONY: run | ||
run: | ||
cd ../../models && \ | ||
podman run -d --rm -it -p $(PORT):$(PORT) -v ./$(SELECTED_MODEL_NAME):$(MODELS_PATH)/$(SELECTED_MODEL_NAME):$(BIND_MOUNT_OPTIONS) -e HOST=0.0.0.0 -e MODEL_PATH=$(MODELS_PATH)/$(SELECTED_MODEL_NAME) -e PORT=$(PORT) $(IMAGE) |
This file contains 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 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#! bin/bash | ||
#!/bin/bash | ||
|
||
./server -tr --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} | ||
|