mirror of
https://github.com/katanemo/plano.git
synced 2026-05-15 11:02:39 +02:00
model server build (#127)
* first commit to have model_server not be dependent on Docker * making changes to fix the docker-compose file for archgw to set DNS_V4 and minor fixes with the build * additional fixes for model server to be separated out in the build * additional fixes for model server to be separated out in the build * fix to get model_server to be built as a separate python process. TODO: fix the embeddings logs after cli completes * fixing init to pull tempfile using the tempfile python package --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-261.local>
This commit is contained in:
parent
7d21359f5b
commit
b60ceb9168
21 changed files with 3390 additions and 154 deletions
|
|
@ -2,6 +2,14 @@ import numpy as np
|
|||
from concurrent.futures import ThreadPoolExecutor
|
||||
import time
|
||||
import torch
|
||||
import pkg_resources
|
||||
import yaml
|
||||
|
||||
def load_yaml_config(file_name):
|
||||
# Load the YAML file from the package
|
||||
yaml_path = pkg_resources.resource_filename('app', file_name)
|
||||
with open(yaml_path, 'r') as yaml_file:
|
||||
return yaml.safe_load(yaml_file)
|
||||
|
||||
|
||||
def split_text_into_chunks(text, max_words=300):
|
||||
|
|
@ -21,7 +29,6 @@ def split_text_into_chunks(text, max_words=300):
|
|||
def softmax(x):
|
||||
return np.exp(x) / np.exp(x).sum(axis=0)
|
||||
|
||||
|
||||
class PredictionHandler:
|
||||
def __init__(self, model, tokenizer, device, task="toxic", hardware_config="cpu"):
|
||||
self.model = model
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue