-
Notifications
You must be signed in to change notification settings - Fork 19
59 lines (52 loc) · 2.3 KB
/
deploy-modal.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Deploy Modal
on:
workflow_dispatch:
inputs:
model_name:
required: true
description: Specify model supported by sentence-transformers such as intfloat/e5-large-v2, sentence-transformers/all-MiniLM-L6-v2, sentence-transformers/all-mpnet-base-v2
cpu:
description: Specify a floating-point number of CPU cores, default to 2.0.
memory:
description: Specify minimum memory size required, default to 2048 MB.
timeout:
description: Specify execution timeout, default to 600 seconds.
keep_warm:
description: Specify to keep number of containers warm and running at all times, default to 1.
normalize_embeddings:
description: Normalize embeddings enabled by default. Disable it by specify "0" or "False"
verbose:
description: Verbose logging disabled by default. Enabled it by specify any value, otherwise leave it blank
jobs:
deploy:
runs-on: ubuntu-latest
env:
MODAL_USERNAME: ${{ secrets.MODAL_USERNAME }}
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
MODEL: ${{ github.event.inputs.model_name }}
CPU: ${{ github.event.inputs.cpu || '2.0' }}
MEMORY: ${{ github.event.inputs.memory || '2048' }}
TIMEOUT: ${{ github.event.inputs.timeout || '600' }}
KEEP_WARM: ${{ github.event.inputs.keep_warm || '1' }}
NORMALIZE_EMBEDDINGS: ${{ github.event.inputs.normalize_embeddings || '1' }}
VERBOSE: ${{ github.event.inputs.verbose }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python packages
run: pip install modal-client
- name: Set APP_NAME variable
run: |
APP_NAME=$(echo "${{ github.event.inputs.model_name }}" | cut -d'/' -f2 | tr '.' '-')
echo "APP_NAME=${APP_NAME}" >> $GITHUB_ENV
- name: Deploy FastAPI app
run: HOME=$(pwd) modal deploy open.text.embeddings.server.modal
- name: Test FastAPI app
run: >
APP=$(echo "${{ github.event.inputs.model_name }}" | cut -d'/' -f2 | tr '.' '-')
echo "https://${{ secrets.MODAL_USERNAME }}--$APP_NAME/v1/embeddings"