Update handler.py
Browse files- handler.py +6 -4
handler.py
CHANGED
@@ -94,12 +94,14 @@ class EndpointHandler():
|
|
94 |
|
95 |
max_new_tokens=5
|
96 |
do_sample=False
|
97 |
-
topk=
|
98 |
base_lambda=1.
|
|
|
99 |
inputs = query.pop("inputs", query)
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
103 |
inputs = self.tokenizer(inputs, return_tensors="pt").to("cuda")
|
104 |
with torch.no_grad():
|
105 |
outputs = self.model(**inputs)
|
|
|
94 |
|
95 |
max_new_tokens=5
|
96 |
do_sample=False
|
97 |
+
topk=5
|
98 |
base_lambda=1.
|
99 |
+
|
100 |
inputs = query.pop("inputs", query)
|
101 |
+
# if isinstance(inputs, str):
|
102 |
+
# inputs = [inputs]
|
103 |
+
if not inputs.endswith("<cite>"):
|
104 |
+
inputs += "<cite>"
|
105 |
inputs = self.tokenizer(inputs, return_tensors="pt").to("cuda")
|
106 |
with torch.no_grad():
|
107 |
outputs = self.model(**inputs)
|