GenerationConfig validate both constraints and force_words_ids (#29163)
GenerationConfig validate both options for constrained decoding: constraints and force_words_ids
This commit is contained in:
@@ -156,6 +156,11 @@ class GenerationConfigTest(unittest.TestCase):
|
||||
# Impossible sets of contraints/parameters will raise an exception
|
||||
with self.assertRaises(ValueError):
|
||||
GenerationConfig(do_sample=False, num_beams=1, num_return_sequences=2)
|
||||
with self.assertRaises(ValueError):
|
||||
# dummy constraint
|
||||
GenerationConfig(do_sample=True, num_beams=2, constraints=["dummy"])
|
||||
with self.assertRaises(ValueError):
|
||||
GenerationConfig(do_sample=True, num_beams=2, force_words_ids=[[[1, 2, 3]]])
|
||||
|
||||
# Passing `generate()`-only flags to `validate` will raise an exception
|
||||
with self.assertRaises(ValueError):
|
||||
|
||||
Reference in New Issue
Block a user