Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate: v4.42 deprecations 🧹🧹 #31956

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 4 additions & 63 deletions src/transformers/generation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2221,8 +2221,8 @@ def _dola_decoding(
stopping_criteria: StoppingCriteriaList,
generation_config: GenerationConfig,
synced_gpus: bool,
streamer: Optional["BaseStreamer"] = None,
logits_warper: Optional[LogitsProcessorList] = None,
streamer: "BaseStreamer",
logits_warper: LogitsProcessorList,
**model_kwargs,
) -> Union[GenerateNonBeamOutput, torch.LongTensor]:
r"""
Expand Down Expand Up @@ -2821,34 +2821,6 @@ def _contrastive_search(
else:
return input_ids

def _greedy_search(
self,
input_ids: torch.LongTensor,
logits_processor: LogitsProcessorList,
stopping_criteria: StoppingCriteriaList,
generation_config: GenerationConfig,
synced_gpus: bool,
streamer: Optional["BaseStreamer"],
**model_kwargs,
) -> Union[GenerateNonBeamOutput, torch.LongTensor]:
r"""
Deprecated. Use `._sample()` instead, passing the same arguments.
"""

logger.warning_once(
"Calling `._greedy_search()` directly is deprecated and will be removed in v4.42. Use `._sample()` "
"instead, passing the same arguments."
)
return self._sample(
input_ids=input_ids,
logits_processor=logits_processor,
stopping_criteria=stopping_criteria,
generation_config=generation_config,
synced_gpus=synced_gpus,
streamer=streamer,
**model_kwargs,
)

def _sample(
self,
input_ids: torch.LongTensor,
Expand All @@ -2857,7 +2829,7 @@ def _sample(
generation_config: GenerationConfig,
synced_gpus: bool,
streamer: Optional["BaseStreamer"],
logits_warper: Optional[LogitsProcessorList] = None,
logits_warper: LogitsProcessorList,
**model_kwargs,
) -> Union[GenerateNonBeamOutput, torch.LongTensor]:
r"""
Expand Down Expand Up @@ -3056,7 +3028,6 @@ def _temporary_reorder_cache(self, past_key_values, beam_idx):
past_key_values.reorder_cache(beam_idx)
return past_key_values

# TODO (joao, v4.42): remove default for `logits_warper`
def _beam_search(
self,
input_ids: torch.LongTensor,
Expand All @@ -3065,7 +3036,7 @@ def _beam_search(
stopping_criteria: StoppingCriteriaList,
generation_config: GenerationConfig,
synced_gpus: bool,
logits_warper: Optional[LogitsProcessorList] = None,
logits_warper: LogitsProcessorList,
**model_kwargs,
) -> Union[GenerateBeamOutput, torch.LongTensor]:
r"""
Expand Down Expand Up @@ -3345,36 +3316,6 @@ def _beam_search(
else:
return sequence_outputs["sequences"]

def _beam_sample(
self,
input_ids: torch.LongTensor,
beam_scorer: BeamScorer,
logits_processor: LogitsProcessorList,
stopping_criteria: StoppingCriteriaList,
logits_warper: LogitsProcessorList,
generation_config: GenerationConfig,
synced_gpus: bool,
**model_kwargs,
) -> Union[GenerateBeamOutput, torch.LongTensor]:
r"""
Deprecated. Use `._beam_search()` instead, passing the same arguments.
"""

logger.warning_once(
"Calling `._beam_sample()` directly is deprecated and will be removed in v4.42. Use `._beam_search()` "
"instead, passing the same arguments."
)
return self._beam_search(
input_ids=input_ids,
beam_scorer=beam_scorer,
logits_processor=logits_processor,
stopping_criteria=stopping_criteria,
logits_warper=logits_warper,
generation_config=generation_config,
synced_gpus=synced_gpus,
**model_kwargs,
)

def _group_beam_search(
self,
input_ids: torch.LongTensor,
Expand Down
8 changes: 0 additions & 8 deletions src/transformers/models/llava/configuration_llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.
"""Llava model configuration"""

import warnings

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
Expand Down Expand Up @@ -96,12 +94,6 @@ def __init__(
f"Got: {vision_feature_select_strategy}"
)

if "vocab_size" in kwargs:
warnings.warn(
"The `vocab_size` argument is deprecated and will be removed in v4.42, since it can be inferred from the `text_config`. Passing this argument has no effect",
FutureWarning,
)

self.vision_feature_select_strategy = vision_feature_select_strategy
self.vision_feature_layer = vision_feature_layer

Expand Down
Loading