Use FutureWarning to deprecate (#6111)
This commit is contained in:
@@ -823,7 +823,7 @@ class AlbertForMaskedLM(AlbertPreTrainedModel):
|
|||||||
if "masked_lm_labels" in kwargs:
|
if "masked_lm_labels" in kwargs:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The `masked_lm_labels` argument is deprecated and will be removed in a future version, use `labels` instead.",
|
"The `masked_lm_labels` argument is deprecated and will be removed in a future version, use `labels` instead.",
|
||||||
DeprecationWarning,
|
FutureWarning,
|
||||||
)
|
)
|
||||||
labels = kwargs.pop("masked_lm_labels")
|
labels = kwargs.pop("masked_lm_labels")
|
||||||
assert kwargs == {}, f"Unexpected keyword arguments: {list(kwargs.keys())}."
|
assert kwargs == {}, f"Unexpected keyword arguments: {list(kwargs.keys())}."
|
||||||
|
|||||||
@@ -1466,7 +1466,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin):
|
|||||||
"use `padding='max_length'` to pad to a max length. In this case, you can give a specific "
|
"use `padding='max_length'` to pad to a max length. In this case, you can give a specific "
|
||||||
"length with `max_length` (e.g. `max_length=45`) or leave max_length to None to pad to the "
|
"length with `max_length` (e.g. `max_length=45`) or leave max_length to None to pad to the "
|
||||||
"maximal input size of the model (e.g. 512 for Bert).",
|
"maximal input size of the model (e.g. 512 for Bert).",
|
||||||
DeprecationWarning,
|
FutureWarning,
|
||||||
)
|
)
|
||||||
if max_length is None:
|
if max_length is None:
|
||||||
padding_strategy = PaddingStrategy.LONGEST
|
padding_strategy = PaddingStrategy.LONGEST
|
||||||
@@ -1492,7 +1492,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin):
|
|||||||
"`truncation='only_first'` (will only truncate the first sentence in the pairs) "
|
"`truncation='only_first'` (will only truncate the first sentence in the pairs) "
|
||||||
"`truncation='only_second'` (will only truncate the second sentence in the pairs) "
|
"`truncation='only_second'` (will only truncate the second sentence in the pairs) "
|
||||||
"or `truncation='longest_first'` (will iteratively remove tokens from the longest sentence in the pairs).",
|
"or `truncation='longest_first'` (will iteratively remove tokens from the longest sentence in the pairs).",
|
||||||
DeprecationWarning,
|
FutureWarning,
|
||||||
)
|
)
|
||||||
truncation_strategy = TruncationStrategy(old_truncation_strategy)
|
truncation_strategy = TruncationStrategy(old_truncation_strategy)
|
||||||
elif truncation is not False:
|
elif truncation is not False:
|
||||||
|
|||||||
Reference in New Issue
Block a user