Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -7,7 +7,7 @@ class CustomModelHandler:
|
|
7 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
self.load_model()
|
9 |
|
10 |
-
|
11 |
self.tokenizer = AutoTokenizer.from_pretrained(self.model_name_or_path, trust_remote_code=True)
|
12 |
self.model = AutoModelForCausalLM.from_pretrained(
|
13 |
self.model_name_or_path,
|
@@ -27,4 +27,4 @@ handler = CustomModelHandler("microsoft/Phi-3-vision-128k-instruct")
|
|
27 |
|
28 |
# Example prediction function
|
29 |
def predict(input_text):
|
30 |
-
return handler.predict(input_text)
|
|
|
7 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
self.load_model()
|
9 |
|
10 |
+
def load_model(self):
|
11 |
self.tokenizer = AutoTokenizer.from_pretrained(self.model_name_or_path, trust_remote_code=True)
|
12 |
self.model = AutoModelForCausalLM.from_pretrained(
|
13 |
self.model_name_or_path,
|
|
|
27 |
|
28 |
# Example prediction function
|
29 |
def predict(input_text):
|
30 |
+
return handler.predict(input_text)
|