-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: upload Docker image to GHCR on Git tag
Co-authored-by: croumegous <[email protected]>
- Loading branch information
Showing
12 changed files
with
167 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.git | ||
|
||
.github | ||
tests | ||
|
||
data | ||
|
||
.env* | ||
.gitignore |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
package: | ||
name: Build container images | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: docker/setup-buildx-action@v2 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
flavor: | | ||
latest=true | ||
- uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
platforms: linux/amd64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
secrets: | | ||
"HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }}" |
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 |
---|---|---|
|
@@ -152,4 +152,6 @@ dmypy.json | |
# Cython debug symbols | ||
cython_debug/ | ||
|
||
.vscode/ | ||
.vscode/ | ||
models/ | ||
data/ |
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,25 @@ | ||
FROM python:3.10-slim-buster | ||
|
||
RUN apt-get update && apt-get install -y curl | ||
|
||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
RUN mv /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
||
WORKDIR /app | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
COPY poetry.lock pyproject.toml README.md /app/ | ||
|
||
COPY ./nlu nlu | ||
|
||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install | ||
|
||
RUN --mount=type=secret,id=HUGGING_FACE_HUB_TOKEN \ | ||
export HUGGING_FACE_HUB_TOKEN=$(cat /run/secrets/HUGGING_FACE_HUB_TOKEN) \ | ||
&& python nlu/load_models.py | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["uvicorn", "nlu.app:app", "--host", "0.0.0.0", "--port", "8080"] |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: "3" | ||
|
||
services: | ||
surrealdb: | ||
image: surrealdb/surrealdb:latest | ||
container_name: surrealdb | ||
restart: unless-stopped | ||
command: start --pass root file:/data/database.db | ||
ports: | ||
- 8000:8000 | ||
volumes: | ||
- ./data:/data | ||
|
||
api-server: | ||
depends_on: | ||
- surrealdb | ||
image: ghcr.io/polyxia-org/nlu:latest | ||
container_name: api-server | ||
ports: | ||
- 8080:8080 | ||
env_file: | ||
- .env.template | ||
environment: | ||
DATABASE_URL: ws://surrealdb:8000/rpc |
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from transformers import pipeline | ||
from sentence_transformers import SentenceTransformer | ||
from transformers import ( | ||
AutoModelForTokenClassification, | ||
AutoTokenizer, | ||
TokenClassificationPipeline, | ||
pipeline, | ||
) | ||
|
||
# Intent classifier | ||
model_name_intent = "joeddav/xlm-roberta-large-xnli" | ||
intent_classifier = pipeline("zero-shot-classification", model=model_name_intent) | ||
|
||
# Sentence similarity | ||
model_name_sim = "paraphrase-multilingual-mpnet-base-v2" | ||
model_sentence_similarity = SentenceTransformer(model_name_sim) | ||
|
||
# NER Extractor | ||
model_name_ner = "qanastek/XLMRoberta-Alexa-Intents-NER-NLU" | ||
tokenizer_ner = AutoTokenizer.from_pretrained(model_name_ner) | ||
model_ner = AutoModelForTokenClassification.from_pretrained(model_name_ner) | ||
predict_ner = TokenClassificationPipeline(model=model_ner, tokenizer=tokenizer_ner) |
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