mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Fixed log messages
that are resulting in TypeError due to too many arguments (#32017)
* Fixed log messages that are resulting in TypeErrors due to too many arguments. * Removed un-necessary imports.
This commit is contained in:
parent
691586b0dc
commit
72fb02c47d
@ -484,7 +484,7 @@ def main():
|
||||
label_to_id = {i: label_name_to_id[label_list[i]] for i in range(num_labels)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels: {sorted(label_list)}."
|
||||
"\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -428,7 +428,7 @@ def main():
|
||||
label_to_id = {i: int(label_name_to_id[label_list[i]]) for i in range(num_labels)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels: {sorted(label_list)}."
|
||||
"\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -370,7 +370,7 @@ def main():
|
||||
label_to_id = {i: label_name_to_id[label_list[i]] for i in range(num_labels)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels: {sorted(label_list)}."
|
||||
"\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -417,7 +417,7 @@ def main():
|
||||
label_to_id = {l: i for i, l in enumerate(label_list)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(model.config.label2id.keys())}, dataset labels:"
|
||||
f" {sorted(label_list)}.\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -458,7 +458,7 @@ def main():
|
||||
label_to_id = {l: i for i, l in enumerate(label_list)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(model.config.label2id.keys())}, dataset labels:"
|
||||
f" {sorted(label_list)}.\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -326,7 +326,7 @@ def main():
|
||||
label_to_id = {i: int(label_name_to_id[label_list[i]]) for i in range(num_labels)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels: {sorted(label_list)}."
|
||||
"\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -374,7 +374,7 @@ def main():
|
||||
label_to_id = label_name_to_id # Use the model's labels
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels:"
|
||||
f" {sorted(label_list)}.\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
"""BEiT model configuration"""
|
||||
|
||||
import warnings
|
||||
from collections import OrderedDict
|
||||
from typing import Mapping
|
||||
|
||||
@ -21,13 +22,9 @@ from packaging import version
|
||||
|
||||
from ...configuration_utils import PretrainedConfig
|
||||
from ...onnx import OnnxConfig
|
||||
from ...utils import logging
|
||||
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
|
||||
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
class BeitConfig(BackboneConfigMixin, PretrainedConfig):
|
||||
r"""
|
||||
This is the configuration class to store the configuration of a [`BeitModel`]. It is used to instantiate an BEiT
|
||||
@ -197,7 +194,7 @@ class BeitConfig(BackboneConfigMixin, PretrainedConfig):
|
||||
|
||||
# handle backwards compatibility
|
||||
if "segmentation_indices" in kwargs:
|
||||
logger.warning(
|
||||
warnings.warn(
|
||||
"The `segmentation_indices` argument is deprecated and will be removed in a future version, use `out_indices` instead.",
|
||||
FutureWarning,
|
||||
)
|
||||
|
@ -15,6 +15,7 @@
|
||||
"""Image processor class for MaskFormer."""
|
||||
|
||||
import math
|
||||
import warnings
|
||||
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Set, Tuple, Union
|
||||
|
||||
import numpy as np
|
||||
@ -987,7 +988,7 @@ class MaskFormerImageProcessor(BaseImageProcessor):
|
||||
`torch.Tensor`:
|
||||
A tensor of shape (`batch_size, num_class_labels, height, width`).
|
||||
"""
|
||||
logger.warning(
|
||||
warnings.warn(
|
||||
"`post_process_segmentation` is deprecated and will be removed in v5 of Transformers, please use"
|
||||
" `post_process_instance_segmentation`",
|
||||
FutureWarning,
|
||||
|
@ -366,7 +366,7 @@ def main():
|
||||
label_to_id = {i: int(label_name_to_id[label_list[i]]) for i in range(num_labels)}
|
||||
else:
|
||||
logger.warning(
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: ",
|
||||
"Your model seems to have been trained with labels, but they don't match the dataset: "
|
||||
f"model labels: {sorted(label_name_to_id.keys())}, dataset labels: {sorted(label_list)}."
|
||||
"\nIgnoring the model labels as a result.",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user