Skip to content

Commit 44b5e41

Browse files
committed
Upgrading to catch only the specific error caused by new version of transformers package
1 parent 3dd0076 commit 44b5e41

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bigcode_eval/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,12 @@ def complete_code(
305305
num_return_sequences=batch_size,
306306
**gen_kwargs,
307307
)
308-
except ValueError:
308+
except ValueError as e:
309309
# When the length of input_ids == max_length, the generation is the same as the input
310-
generated_tokens = inputs
310+
if str(e).startswith(f"Input length of input_ids is {inputs.shape[1]}, but `max_length` is set to {gen_kwargs['max_length']}"):
311+
generated_tokens = inputs
312+
else:
313+
raise e
311314

312315
# each task is generated batch_size times
313316
generated_tasks = batch["task_id"].repeat(batch_size)

0 commit comments

Comments
 (0)