mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
parent
67acb07e9e
commit
a9912d2fca
@ -132,8 +132,12 @@ class TextGenerationPipeline(Pipeline):
|
||||
if return_full_text is not None and return_type is None:
|
||||
if return_text is not None:
|
||||
raise ValueError("`return_text` is mutually exclusive with `return_full_text`")
|
||||
if return_tensors is not None:
|
||||
raise ValueError("`return_full_text` is mutually exclusive with `return_tensors`")
|
||||
return_type = ReturnType.FULL_TEXT if return_full_text else ReturnType.NEW_TEXT
|
||||
if return_tensors is not None and return_type is None:
|
||||
if return_text is not None:
|
||||
raise ValueError("`return_text` is mutually exclusive with `return_tensors`")
|
||||
return_type = ReturnType.TENSORS
|
||||
if return_type is not None:
|
||||
postprocess_params["return_type"] = return_type
|
||||
|
@ -203,6 +203,10 @@ class TextGenerationPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseM
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
outputs = text_generator("test", return_full_text=True, return_text=True)
|
||||
with self.assertRaises(ValueError):
|
||||
outputs = text_generator("test", return_full_text=True, return_tensors=True)
|
||||
with self.assertRaises(ValueError):
|
||||
outputs = text_generator("test", return_text=True, return_tensors=True)
|
||||
|
||||
# Empty prompt is slighly special
|
||||
# it requires BOS token to exist.
|
||||
|
Loading…
Reference in New Issue
Block a user