"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "d2da2cb2324b43104a1b970e1591e1415cf34600"
Commit 2f32dfd3 authored by Julien Chaumond's avatar Julien Chaumond
Browse files

Convention: name mixins mixins

parent 055e80cf
...@@ -32,7 +32,7 @@ from .modeling_tf_pytorch_utils import load_pytorch_checkpoint_in_tf2_model ...@@ -32,7 +32,7 @@ from .modeling_tf_pytorch_utils import load_pytorch_checkpoint_in_tf2_model
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class TFModelUtils: class TFModelUtilsMixin:
""" """
A few utilities for `tf.keras.Model`s, to be used as a mixin. A few utilities for `tf.keras.Model`s, to be used as a mixin.
""" """
...@@ -47,7 +47,7 @@ class TFModelUtils: ...@@ -47,7 +47,7 @@ class TFModelUtils:
return self.count_params() return self.count_params()
class TFPreTrainedModel(tf.keras.Model, TFModelUtils): class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin):
r""" Base class for all TF models. r""" Base class for all TF models.
:class:`~transformers.TFPreTrainedModel` takes care of storing the configuration of the models and handles methods for loading/downloading/saving models :class:`~transformers.TFPreTrainedModel` takes care of storing the configuration of the models and handles methods for loading/downloading/saving models
......
...@@ -53,7 +53,7 @@ except ImportError: ...@@ -53,7 +53,7 @@ except ImportError:
return input return input
class ModuleUtils: class ModuleUtilsMixin:
""" """
A few utilities for torch.nn.Modules, to be used as a mixin. A few utilities for torch.nn.Modules, to be used as a mixin.
""" """
...@@ -66,7 +66,7 @@ class ModuleUtils: ...@@ -66,7 +66,7 @@ class ModuleUtils:
return sum(p.numel() for p in params) return sum(p.numel() for p in params)
class PreTrainedModel(nn.Module, ModuleUtils): class PreTrainedModel(nn.Module, ModuleUtilsMixin):
r""" Base class for all models. r""" Base class for all models.
:class:`~transformers.PreTrainedModel` takes care of storing the configuration of the models and handles methods for loading/downloading/saving models :class:`~transformers.PreTrainedModel` takes care of storing the configuration of the models and handles methods for loading/downloading/saving models
......
...@@ -592,7 +592,6 @@ class ModelTesterMixin: ...@@ -592,7 +592,6 @@ class ModelTesterMixin:
model(**inputs_dict) model(**inputs_dict)
global_rng = random.Random() global_rng = random.Random()
......
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