chore: remove demo deployment with modal

This commit is contained in:
Meng Zhang 2024-05-03 00:03:09 -07:00
parent 24cebc11a7
commit 0eed862948
2 changed files with 0 additions and 116 deletions

View File

@ -1,38 +0,0 @@
name: Deploy to demo.tabbyml.com
on:
workflow_dispatch:
release:
types: [ published ]
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Modal
run: |
python -m pip install --upgrade pip
pip install modal
- name: Write image version
run: |
TABBY_IMAGE=tabbyml/tabby:${GITHUB_REF_NAME#v}
echo image $TABBY_IMAGE
echo "TABBY_IMAGE=$TABBY_IMAGE" >> $GITHUB_ENV
- name: Deploy job
run: |
cd experimental/demo && modal deploy app.py

View File

@ -1,78 +0,0 @@
import os
from modal import Image, Stub, gpu, asgi_app, Volume, Secret
IMAGE_NAME = os.environ.get("TABBY_IMAGE", "tabbyml/tabby")
image = (
Image.from_registry(
IMAGE_NAME,
add_python="3.11",
)
.dockerfile_commands("ENTRYPOINT []")
.pip_install("asgi-proxy-lib")
)
stub = Stub("tabby-demo-server", image=image)
volume = Volume.from_name("tabby-demo-server-volume", create_if_missing=True)
@stub.function(
concurrency_limit=1,
allow_concurrent_inputs=100,
container_idle_timeout=600*2,
timeout=600,
volumes = {"/data": volume},
_allow_background_volume_commits=True,
secrets=[Secret.from_name("deepseek-openapi-key")]
)
@asgi_app()
def entry():
import json
import socket
import subprocess
import time
import os
from asgi_proxy import asgi_proxy
env = os.environ.copy()
env["TABBY_DISABLE_USAGE_COLLECTION"] = "1"
env["TABBY_WEBSERVER_DEMO_MODE"] = "1"
chat_model = dict(
kind="openai-chat",
model_name="deepseek-coder",
api_endpoint="https://api.deepseek.com/v1",
api_key=env.get("OPENAI_API_KEY", ""),
)
launcher = subprocess.Popen(
[
"/opt/tabby/bin/tabby-cpu",
"serve",
"--port",
"8000",
"--chat-device",
"experimental-http"
"--chat-model",
json.dumps(chat_model),
],
env=env
)
# Poll until webserver at 127.0.0.1:8000 accepts connections before running inputs.
def tabby_ready():
try:
socket.create_connection(("127.0.0.1", 8000), timeout=1).close()
return True
except (socket.timeout, ConnectionRefusedError):
# Check if launcher webserving process has exited.
# If so, a connection can never be made.
retcode = launcher.poll()
if retcode is not None:
raise RuntimeError(f"launcher exited unexpectedly with code {retcode}")
return False
while not tabby_ready():
time.sleep(1.0)
print("Tabby server ready!")
return asgi_proxy("http://localhost:8000")