Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:


jobs:
test_coverage:
test_vllm_coverage:
runs-on: ParallelHoss

steps:
Expand All @@ -25,12 +25,45 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -e .
pip install -e .[vllm]
pip install -r requirements-dev.txt

- name: Run tests
run: |
coverage run --source=genlm/backend -m pytest --benchmark-disable --ignore=tests/test_mlx.py
coverage run --source=genlm/backend -m pytest --benchmark-disable --ignore=tests/test_mlx.py --ignore=tests/test_sgl.py
coverage json --omit "*/test*"
coverage report --omit "*/test*"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.json
slug: genlm/genlm-backend

test_sgl_coverage:
runs-on: ParallelHoss

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v4
with:
python-version: 3.11.5
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install -U pip
pip install -e .[sgl]
pip install -r requirements-dev.txt

- name: Run tests
run: |
coverage run --source=genlm/backend -m pytest tests/test_sgl.py
coverage json --omit "*/test*"
coverage report --omit "*/test*"

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ jobs:
python-version: 3.11.5
cache: 'pip'

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false

- name: Install dependencies
run: |
python -m pip install -U pip
Expand Down
4 changes: 4 additions & 0 deletions genlm/backend/llm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from genlm.backend.llm.hf import AsyncTransformer
from genlm.backend.llm.base import AsyncLM, MockAsyncLM
from genlm.backend.llm.mlx import AsyncMlxLM
from genlm.backend.llm.sgl import AsyncSGLTransformer

import torch

Expand Down Expand Up @@ -36,6 +37,8 @@ def load_model_by_name(name, backend=None, llm_opts=None):
return MockAsyncLM.from_name(name, **llm_opts)
elif backend == "mlx":
return AsyncMlxLM.from_name(name, **llm_opts)
elif backend == "sgl":
return AsyncSGLTransformer.from_name(name, **llm_opts)
else:
raise ValueError(f"Invalid backend: {backend}")

Expand All @@ -46,5 +49,6 @@ def load_model_by_name(name, backend=None, llm_opts=None):
"AsyncVirtualLM",
"AsyncTransformer",
"AsyncMlxLM",
"AsyncSGLTransformer",
"MockAsyncLM",
]
Loading