"docs/vscode:/vscode.git/clone" did not exist on "8ac29fe0905c3f7f04963ef22c4f61e59ee1004a"
Unverified Commit a5be9541 authored by David del Río Medina's avatar David del Río Medina Committed by GitHub
Browse files

Replace assertion with ValueError exception (#14006)

parent cc360649
......@@ -84,9 +84,11 @@ class FlaxLogitsProcessorList(list):
for processor in self:
function_args = inspect.signature(processor.__call__).parameters
if len(function_args) > 3:
assert all(
arg in kwargs for arg in list(function_args.keys())[2:]
), f"Make sure that all the required parameters: {list(function_args.keys())} for {processor.__class__} are passed to the logits processor."
if not all(arg in kwargs for arg in list(function_args.keys())[2:]):
raise ValueError(
f"Make sure that all the required parameters: {list(function_args.keys())} for "
f"{processor.__class__} are passed to the logits processor."
)
scores = processor(input_ids, scores, cur_len, **kwargs)
else:
scores = processor(input_ids, scores, cur_len)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment