Commit ·
8c26326
1
Parent(s): 3dfb844
hardcoded model
Browse files- handler.py +4 -3
handler.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
|
|
| 1 |
from typing import Dict, List, Any
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 3 |
|
| 4 |
|
| 5 |
class EndpointHandler():
|
| 6 |
def __init__(self, path=""):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
self.pipe = pipeline("text-generation", model=
|
| 10 |
|
| 11 |
def __call__(self, data:Dict[str, Any]) :
|
| 12 |
messages = data.pop("messages", None)
|
|
|
|
| 1 |
+
import torch
|
| 2 |
from typing import Dict, List, Any
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 4 |
|
| 5 |
|
| 6 |
class EndpointHandler():
|
| 7 |
def __init__(self, path=""):
|
| 8 |
+
model = AutoModelForCausalLM.from_pretrained("hyperspaceai/hyperEngine_phi3_128k", device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
|
| 10 |
+
self.pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 11 |
|
| 12 |
def __call__(self, data:Dict[str, Any]) :
|
| 13 |
messages = data.pop("messages", None)
|