From 0eed862948906803f1d34819d9723d657f528946 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Fri, 3 May 2024 00:03:09 -0700 Subject: [PATCH] chore: remove demo deployment with modal --- .github/workflows/deploy-demo.yml | 38 --------------- experimental/demo/app.py | 78 ------------------------------- 2 files changed, 116 deletions(-) delete mode 100644 .github/workflows/deploy-demo.yml delete mode 100644 experimental/demo/app.py diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml deleted file mode 100644 index a6d3c7da9..000000000 --- a/.github/workflows/deploy-demo.yml +++ /dev/null @@ -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 diff --git a/experimental/demo/app.py b/experimental/demo/app.py deleted file mode 100644 index 17a7c195b..000000000 --- a/experimental/demo/app.py +++ /dev/null @@ -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") \ No newline at end of file