|
|
from typing import Dict, Any, List |
|
|
import random |
|
|
from unsloth import FastLanguageModel |
|
|
import torch |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EndpointHandler: |
|
|
def __init__(self, path=""): |
|
|
self.model, self.tokenizer = FastLanguageModel.from_pretrained( |
|
|
model_name = path, |
|
|
max_seq_length = max_seq_length, |
|
|
dtype = dtype, |
|
|
load_in_4bit = load_in_4bit |
|
|
) |
|
|
|
|
|
pass |
|
|
|
|
|
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = [] |
|
|
|
|
|
random_float = random.random() |
|
|
result.append({"label": "hello, world", "score": 0.99}) |
|
|
return {"predictions": result} |
|
|
|
|
|
|