Unverified Commit b8e5cd53 authored by Sai-Suraj-27's avatar Sai-Suraj-27 Committed by GitHub
Browse files

Refactor: Removed un-necessary `object` base class (#32230)

* Refactored to remove un-necessary object base class.

* small fix.
parent 1c7ebf1d
...@@ -297,7 +297,7 @@ class SplinterTokenizer(PreTrainedTokenizer): ...@@ -297,7 +297,7 @@ class SplinterTokenizer(PreTrainedTokenizer):
return (vocab_file,) return (vocab_file,)
class BasicTokenizer(object): class BasicTokenizer:
""" """
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
...@@ -446,7 +446,7 @@ class BasicTokenizer(object): ...@@ -446,7 +446,7 @@ class BasicTokenizer(object):
return "".join(output) return "".join(output)
class WordpieceTokenizer(object): class WordpieceTokenizer:
"""Runs WordPiece tokenization.""" """Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100): def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
......
...@@ -285,7 +285,7 @@ class SqueezeBertTokenizer(PreTrainedTokenizer): ...@@ -285,7 +285,7 @@ class SqueezeBertTokenizer(PreTrainedTokenizer):
# Copied from transformers.models.bert.tokenization_bert.BasicTokenizer # Copied from transformers.models.bert.tokenization_bert.BasicTokenizer
class BasicTokenizer(object): class BasicTokenizer:
""" """
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
...@@ -446,7 +446,7 @@ class BasicTokenizer(object): ...@@ -446,7 +446,7 @@ class BasicTokenizer(object):
return "".join(output) return "".join(output)
class WordpieceTokenizer(object): class WordpieceTokenizer:
"""Runs WordPiece tokenization.""" """Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100): def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
......
...@@ -1888,7 +1888,7 @@ def _max_by_axis(the_list): ...@@ -1888,7 +1888,7 @@ def _max_by_axis(the_list):
# Copied from transformers.models.detr.modeling_detr.NestedTensor # Copied from transformers.models.detr.modeling_detr.NestedTensor
class NestedTensor(object): class NestedTensor:
def __init__(self, tensors, mask: Optional[Tensor]): def __init__(self, tensors, mask: Optional[Tensor]):
self.tensors = tensors self.tensors = tensors
self.mask = mask self.mask = mask
......
...@@ -1550,7 +1550,7 @@ class AverageApproximationFunction(str, enum.Enum): ...@@ -1550,7 +1550,7 @@ class AverageApproximationFunction(str, enum.Enum):
# Beginning of everything related to segmented tensors # Beginning of everything related to segmented tensors
class IndexMap(object): class IndexMap:
"""Index grouping entries within a tensor.""" """Index grouping entries within a tensor."""
def __init__(self, indices, num_segments, batch_dims=0): def __init__(self, indices, num_segments, batch_dims=0):
......
...@@ -1830,7 +1830,7 @@ class AverageApproximationFunction(str, enum.Enum): ...@@ -1830,7 +1830,7 @@ class AverageApproximationFunction(str, enum.Enum):
# Beginning of everything related to segmented tensors # Beginning of everything related to segmented tensors
class IndexMap(object): class IndexMap:
"""Index grouping entries within a tensor.""" """Index grouping entries within a tensor."""
def __init__(self, indices, num_segments, batch_dims=0): def __init__(self, indices, num_segments, batch_dims=0):
......
...@@ -1961,7 +1961,7 @@ class TapasTokenizer(PreTrainedTokenizer): ...@@ -1961,7 +1961,7 @@ class TapasTokenizer(PreTrainedTokenizer):
# Copied from transformers.models.bert.tokenization_bert.BasicTokenizer # Copied from transformers.models.bert.tokenization_bert.BasicTokenizer
class BasicTokenizer(object): class BasicTokenizer:
""" """
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.). Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
...@@ -2123,7 +2123,7 @@ class BasicTokenizer(object): ...@@ -2123,7 +2123,7 @@ class BasicTokenizer(object):
# Copied from transformers.models.bert.tokenization_bert.WordpieceTokenizer # Copied from transformers.models.bert.tokenization_bert.WordpieceTokenizer
class WordpieceTokenizer(object): class WordpieceTokenizer:
"""Runs WordPiece tokenization.""" """Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100): def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
......
...@@ -1322,7 +1322,7 @@ def _max_by_axis(the_list): ...@@ -1322,7 +1322,7 @@ def _max_by_axis(the_list):
# Copied from transformers.models.detr.modeling_detr.NestedTensor # Copied from transformers.models.detr.modeling_detr.NestedTensor
class NestedTensor(object): class NestedTensor:
def __init__(self, tensors, mask: Optional[Tensor]): def __init__(self, tensors, mask: Optional[Tensor]):
self.tensors = tensors self.tensors = tensors
self.mask = mask self.mask = mask
......
...@@ -37,7 +37,7 @@ if is_tf_available(): ...@@ -37,7 +37,7 @@ if is_tf_available():
) )
class TFCTRLModelTester(object): class TFCTRLModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -34,7 +34,7 @@ if is_torch_available(): ...@@ -34,7 +34,7 @@ if is_torch_available():
) )
class DebertaModelTester(object): class DebertaModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -35,7 +35,7 @@ if is_torch_available(): ...@@ -35,7 +35,7 @@ if is_torch_available():
) )
class DebertaV2ModelTester(object): class DebertaV2ModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -40,7 +40,7 @@ if is_torch_available(): ...@@ -40,7 +40,7 @@ if is_torch_available():
from transformers.models.distilbert.modeling_distilbert import _create_sinusoidal_embeddings from transformers.models.distilbert.modeling_distilbert import _create_sinusoidal_embeddings
class DistilBertModelTester(object): class DistilBertModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -39,7 +39,7 @@ if is_torch_available(): ...@@ -39,7 +39,7 @@ if is_torch_available():
from transformers.models.flaubert.modeling_flaubert import create_sinusoidal_embeddings from transformers.models.flaubert.modeling_flaubert import create_sinusoidal_embeddings
class FlaubertModelTester(object): class FlaubertModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -34,7 +34,7 @@ if is_tf_available(): ...@@ -34,7 +34,7 @@ if is_tf_available():
from transformers.models.lxmert.modeling_tf_lxmert import TFLxmertForPreTraining, TFLxmertModel from transformers.models.lxmert.modeling_tf_lxmert import TFLxmertForPreTraining, TFLxmertModel
class TFLxmertModelTester(object): class TFLxmertModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -84,7 +84,7 @@ class TFMobileBertModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.Te ...@@ -84,7 +84,7 @@ class TFMobileBertModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.Te
return inputs_dict return inputs_dict
class TFMobileBertModelTester(object): class TFMobileBertModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -37,7 +37,7 @@ if is_torch_available(): ...@@ -37,7 +37,7 @@ if is_torch_available():
) )
class SqueezeBertModelTester(object): class SqueezeBertModelTester:
def __init__( def __init__(
self, self,
parent, parent,
......
...@@ -23,7 +23,7 @@ from transformers import is_torch_available ...@@ -23,7 +23,7 @@ from transformers import is_torch_available
from .utils.test_configuration_utils import config_common_kwargs from .utils.test_configuration_utils import config_common_kwargs
class ConfigTester(object): class ConfigTester:
def __init__(self, parent, config_class=None, has_text_modality=True, common_properties=None, **kwargs): def __init__(self, parent, config_class=None, has_text_modality=True, common_properties=None, **kwargs):
self.parent = parent self.parent = parent
self.config_class = config_class self.config_class = config_class
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment