Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -25,7 +25,7 @@ class SweetCommander():
|
|
25 |
|
26 |
def __init__(self, path="") -> None:
|
27 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
28 |
-
self.model = ORTModelForCausalLM.from_pretrained(path
|
29 |
self.star_line = "***********************************************************"
|
30 |
|
31 |
def __call__(self, user_name, user_input):
|
@@ -36,7 +36,7 @@ class SweetCommander():
|
|
36 |
)
|
37 |
print(self.star_line)
|
38 |
print(prompt)
|
39 |
-
input_ids = self.tokenizer(prompt + "\nAlice Gate:", return_tensors = "pt")
|
40 |
encoded_output = self.model.generate(
|
41 |
input_ids["input_ids"],
|
42 |
max_new_tokens = 50,
|
|
|
25 |
|
26 |
def __init__(self, path="") -> None:
|
27 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
28 |
+
self.model = ORTModelForCausalLM.from_pretrained(path, provider = "CUDAExecutionProvider")
|
29 |
self.star_line = "***********************************************************"
|
30 |
|
31 |
def __call__(self, user_name, user_input):
|
|
|
36 |
)
|
37 |
print(self.star_line)
|
38 |
print(prompt)
|
39 |
+
input_ids = self.tokenizer(prompt + "\nAlice Gate:", return_tensors = "pt").to("cuda")
|
40 |
encoded_output = self.model.generate(
|
41 |
input_ids["input_ids"],
|
42 |
max_new_tokens = 50,
|