mirror of
https://github.com/lightbroker/llmsecops-research.git
synced 2026-02-12 14:42:48 +00:00
use Python package approach to project structure
This commit is contained in:
3
.github/workflows/llmsecops-cicd.yml
vendored
3
.github/workflows/llmsecops-cicd.yml
vendored
@@ -36,7 +36,8 @@ jobs:
|
||||
|
||||
- name: Run REST API server
|
||||
run: |
|
||||
python ${{ github.workspace }}/tests/api/server.py &
|
||||
# python ${{ github.workspace }}/tests/api/server.py &
|
||||
python -m tests.api.server
|
||||
|
||||
- name: Test API call
|
||||
run: |
|
||||
|
||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/api/__init__.py
Normal file
0
tests/api/__init__.py
Normal file
@@ -1,11 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Add the parent folder (or any relative path)
|
||||
sys.path.append(os.path.abspath('./../llm'))
|
||||
|
||||
from phi3_language_model import Phi3LanguageModel
|
||||
from tests.llm.phi3_language_model import Phi3LanguageModel
|
||||
|
||||
|
||||
class ApiController:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
|
||||
from controller import ApiController
|
||||
from tests.api.controller import ApiController
|
||||
from wsgiref.simple_server import make_server
|
||||
|
||||
|
||||
|
||||
0
tests/llm/__init__.py
Normal file
0
tests/llm/__init__.py
Normal file
@@ -1,16 +1,16 @@
|
||||
# TODO: business logic for REST API interaction w/ LLM via prompt input
|
||||
|
||||
import onnxruntime_genai as og
|
||||
import argparse
|
||||
import onnxruntime_genai as og
|
||||
import os
|
||||
|
||||
|
||||
default_model_path = './cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4'
|
||||
|
||||
class Phi3LanguageModel:
|
||||
|
||||
def __init__(self, model_path=None):
|
||||
# configure ONNX runtime
|
||||
model_path = default_model_path if model_path == None else model_path
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
model_path = os.path.join(base_dir, "cpu_and_mobile", "cpu-int4-rtn-block-32-acc-level-4")
|
||||
config = og.Config(model_path)
|
||||
config.clear_providers()
|
||||
self.model = og.Model(config)
|
||||
|
||||
Reference in New Issue
Block a user