Skip to content

Commit

Permalink
Merge pull request #12 from Josh-XT/add-stt
Browse files Browse the repository at this point in the history
Add Local Voice Functionality
  • Loading branch information
Josh-XT authored Jan 26, 2024
2 parents 8065489 + 8037065 commit 7fcf691
Show file tree
Hide file tree
Showing 27 changed files with 1,023 additions and 487 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
models/*
62 changes: 62 additions & 0 deletions .github/workflows/publish-docker-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Dev - Build and Test

on:
push:
branches-ignore:
- main
workflow_dispatch:

jobs:
build_and_push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: "Dockerfile"
platforms: "linux/amd64"
tag_name: "cpu-dev"
- dockerfile: "cuda.Dockerfile"
platforms: "linux/amd64"
tag_name: "cuda-dev"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract GitHub info
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^a-zA-Z0-9._-]/-/g')" >> $GITHUB_ENV
echo "GITHUB_USER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
id: extract_branch

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.GITHUB_USER }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
push: true
tags: |
ghcr.io/${{ env.GITHUB_USER }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}
ghcr.io/${{ env.GITHUB_USER }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ env.BRANCH_NAME }}
ghcr.io/${{ env.GITHUB_USER }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ env.BRANCH_NAME }}-${{ github.sha }}
test-local-llm:
uses: josh-xt/AGiXT/.github/workflows/operation-test-with-jupyter.yml@main
with:
notebook: tests/tests.ipynb
image: ghcr.io/josh-xt/local-llm:cpu-dev
port: "8091"
additional-python-dependencies: openai requests
needs: build_and_push
28 changes: 17 additions & 11 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Docker image
name: Build and Test

on:
push:
Expand All @@ -13,17 +13,24 @@ jobs:
strategy:
matrix:
include:
- llamacpp_image: "python:3-slim-bullseye"
platforms: "linux/amd64,linux/arm64/v8"
- dockerfile: "Dockerfile"
platforms: "linux/amd64"
tag_name: "cpu"
- llamacpp_image: "nvidia/cuda:12.1.1-devel-ubuntu22.04"
- dockerfile: "cuda.Dockerfile"
platforms: "linux/amd64"
tag_name: "cuda"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract GitHub info
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^a-zA-Z0-9._-]/-/g')" >> $GITHUB_ENV
echo "GITHUB_USER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
id: extract_branch

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -37,7 +44,7 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ env.GITHUB_USER }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
Expand All @@ -48,19 +55,18 @@ jobs:
platforms: ${{ matrix.platforms }}
push: true
tags: |
${{ vars.DOCKERHUB_USERNAME }}/local-llm:${{ matrix.tag_name }}
${{ vars.DOCKERHUB_USERNAME }}/local-llm:${{ matrix.tag_name }}-${{ github.sha }}
ghcr.io/josh-xt/local-llm:${{ matrix.tag_name }}
ghcr.io/josh-xt/local-llm:${{ matrix.tag_name }}-${{ github.sha }}
build-args: |
LLAMACPP_IMAGE=${{ matrix.llamacpp_image }}
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ github.sha }}
ghcr.io/${{ env.GITHUB_USER }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}
ghcr.io/${{ env.GITHUB_USER }}/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ github.sha }}
- name: Docker Hub Description
uses: peter-evans/[email protected]
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ vars.DOCKERHUB_USERNAME }}/local-llm

test-local-llm:
uses: josh-xt/AGiXT/.github/workflows/operation-test-with-jupyter.yml@main
with:
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
__pycache__/
models/*
models/*
build
*.egg*
xttsv2_2.0.2
whispercpp
outputs/*
36 changes: 14 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
ARG LLAMACPP_IMAGE="nvidia/cuda:12.1.1-devel-ubuntu22.04"
FROM ${LLAMACPP_IMAGE}

# We need to set the host to 0.0.0.0 to allow outside access
ENV HOST 0.0.0.0

RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y git build-essential \
python3 python3-pip gcc wget \
ocl-icd-opencl-dev opencl-headers clinfo \
libclblast-dev libopenblas-dev \
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
FROM ubuntu:22.04
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y git build-essential gcc g++ portaudio19-dev ffmpeg libportaudio2 libasound-dev python3 python3-pip gcc wget ocl-icd-opencl-dev opencl-headers clinfo libclblast-dev libopenblas-dev && \
apt-get install -y gcc-10 g++-10 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 && \
ln -s /usr/bin/python3 /usr/bin/python && \
pip install --upgrade pip && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV HOST 0.0.0.0
COPY . .

# setting build related env vars
ENV CUDA_DOCKER_ARCH=all
ENV LLAMA_CUBLAS=1

# Install depencencies
RUN python3 -m pip install --upgrade pip cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context
RUN python3 -m pip install -r requirements.txt

RUN pip install --no-cache-dir -r requirements.txt
RUN python3 local_llm/CTTS.py
RUN python3 local_llm/STT.py
EXPOSE 8091
RUN chmod +x start.sh
ENTRYPOINT ["/app/start.sh"]
ENTRYPOINT ["sh", "-c", "./start.sh"]
Loading

0 comments on commit 7fcf691

Please sign in to comment.