Skip to content

Commit 0fb1900

Browse files
committed
whoops
1 parent c946bea commit 0fb1900

File tree

2 files changed

+17
-356
lines changed

2 files changed

+17
-356
lines changed

src/transformers/generation/utils.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,22 +2565,23 @@ def generate(
25652565

25662566
elif generation_mode == GenerationMode.CONSTRAINED_BEAM_SEARCH:
25672567
logger.warning_once(
2568-
"Constrained Beam Search is scheduled to be moved to a `custom_generate` repository in v4.55.0. "
2569-
"To prevent loss of backward compatibility, add `trust_remote_code=True` to your `generate` call."
2570-
)
2571-
2572-
# 11. prepare beam search scorer
2573-
2574-
# # 12. run beam search
2575-
# result = self._constrained_beam_search(
2576-
# input_ids,
2577-
# constrained_beam_scorer=constrained_beam_scorer,
2578-
# logits_processor=prepared_logits_processor,
2579-
# stopping_criteria=prepared_stopping_criteria,
2580-
# generation_config=generation_config,
2581-
# synced_gpus=synced_gpus,
2582-
# **model_kwargs,
2583-
# )
2568+
"Constrained Beam Search was moved to a `custom_generate` repository: https://hf.co/transformers-community/constrained-beam-search. "
2569+
"To prevent loss of backward compatibility, add `custom_generate='transformers-community/constrained-beam-search'` "
2570+
"to your `generate` call before v4.62.0."
2571+
)
2572+
if not trust_remote_code:
2573+
raise ValueError(
2574+
"Constrained Beam Search requires `trust_remote_code=True` in your `generate` call, since "
2575+
"it loads https://hf.co/transformers-community/constrained-beam-search."
2576+
)
2577+
return GenerationMixin.generate(
2578+
self,
2579+
inputs,
2580+
custom_generate="transformers-community/constrained-beam-search",
2581+
generation_config=generation_config,
2582+
trust_remote_code=trust_remote_code,
2583+
**kwargs,
2584+
)
25842585

25852586
# Convert to legacy cache format if requested
25862587
if (

tests/generation/test_beam_search.py

Lines changed: 0 additions & 340 deletions
This file was deleted.

0 commit comments

Comments
 (0)