Update pipeline.py
Browse files- pipeline.py +2 -3
pipeline.py
CHANGED
@@ -76,10 +76,9 @@ class PreTrainedPipeline():
|
|
76 |
self.tokenizer = AutoTokenizer.from_pretrained("Lin0He/text-summary-gpt2-short")
|
77 |
self.model = AutoModelForCausalLM.from_pretrained("Lin0He/text-summary-gpt2-short")
|
78 |
|
79 |
-
|
80 |
-
def __call__(self, data:Dict[Any, Any]) -> Dict[Any, Any]:
|
81 |
# process input
|
82 |
inputs = data.pop("inputs", data)
|
83 |
# process input text
|
84 |
prediction = model_infer(self.model, self.tokenizer, inputs+"TL;DR")
|
85 |
-
return {"text": prediction}
|
|
|
76 |
self.tokenizer = AutoTokenizer.from_pretrained("Lin0He/text-summary-gpt2-short")
|
77 |
self.model = AutoModelForCausalLM.from_pretrained("Lin0He/text-summary-gpt2-short")
|
78 |
|
79 |
+
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
|
80 |
# process input
|
81 |
inputs = data.pop("inputs", data)
|
82 |
# process input text
|
83 |
prediction = model_infer(self.model, self.tokenizer, inputs+"TL;DR")
|
84 |
+
return [{"text": prediction}]
|