Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xyyimian committed Aug 21, 2024
1 parent 6f4aefc commit 2b30a91
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive # This will clone the repository with all its submodules
fetch-depth: 0 # This fetches all history so you can access any version of the submodules


- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify the Python version you want

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build pytest
- name: Build DLL
run: |
pip install -e .
- name: Run tests
run: |
python -m pytest tests
4 changes: 2 additions & 2 deletions tests/test_text_generation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from nexa.gguf.llama import llama
from tests.utils import download_model

from nexa.gguf.lib_utils import is_gpu_available
# Constants
TINY_LLAMA_URL = "https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_0.gguf"
OUTPUT_DIR = os.getcwd()
Expand All @@ -12,7 +12,7 @@ def init_llama_model(verbose=False, n_gpu_layers=-1, chat_format=None, embedding
return llama.Llama(
model_path=MODEL_PATH,
verbose=verbose,
n_gpu_layers=n_gpu_layers,
n_gpu_layers=n_gpu_layers if is_gpu_available() else 0,
chat_format=chat_format,
embedding=embedding,
)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from nexa.gguf.llama import llama
from nexa.gguf.llama.llama_chat_format import NanoLlavaChatHandler
from tests.utils import download_model
from nexa.gguf.lib_utils import is_gpu_available

def image_to_base64_data_uri(file_path):
"""
Expand Down Expand Up @@ -31,7 +32,7 @@ def test_image_generation():
model_path=model_path,
chat_handler=chat_handler,
n_ctx=2048, # n_ctx should be increased to accommodate the image embedding
n_gpu_layers=-1, # Uncomment to use GPU acceleration
n_gpu_layers=-1 if is_gpu_available() else 0, # Uncomment to use GPU acceleration
verbose=False,
)
output = llm.create_chat_completion(
Expand Down

0 comments on commit 2b30a91

Please sign in to comment.