text stringlengths 31 243k | type stringclasses 1
value | start int64 36 275k | end int64 286 280k | depth int64 0 1 | filepath stringlengths 85 188 | parent_class stringclasses 3
values | class_index int64 0 10.8k |
|---|---|---|---|---|---|---|---|
class TFXLMRobertaOutput(keras.layers.Layer):
def __init__(self, config: XLMRobertaConfig, **kwargs):
super().__init__(**kwargs)
self.dense = keras.layers.Dense(
units=config.hidden_size, kernel_initializer=get_initializer(config.initializer_range), name="dense"
)
self.L... | class_definition | 24,689 | 26,030 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,900 |
class TFXLMRobertaLayer(keras.layers.Layer):
def __init__(self, config: XLMRobertaConfig, **kwargs):
super().__init__(**kwargs)
self.attention = TFXLMRobertaAttention(config, name="attention")
self.is_decoder = config.is_decoder
self.add_cross_attention = config.add_cross_attention
... | class_definition | 26,123 | 30,888 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,901 |
class TFXLMRobertaEncoder(keras.layers.Layer):
def __init__(self, config: XLMRobertaConfig, **kwargs):
super().__init__(**kwargs)
self.config = config
self.layer = [TFXLMRobertaLayer(config, name=f"layer_._{i}") for i in range(config.num_hidden_layers)]
def call(
self,
h... | class_definition | 30,983 | 34,082 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,902 |
class TFXLMRobertaMainLayer(keras.layers.Layer):
config_class = XLMRobertaConfig
def __init__(self, config, add_pooling_layer=True, **kwargs):
super().__init__(**kwargs)
self.config = config
self.is_decoder = config.is_decoder
self.num_hidden_layers = config.num_hidden_layers
... | class_definition | 34,211 | 44,700 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,903 |
class TFXLMRobertaPreTrainedModel(TFPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = XLMRobertaConfig
base_model_prefix = "roberta" | class_definition | 44,815 | 45,084 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,904 |
class TFXLMRobertaModel(TFXLMRobertaPreTrainedModel):
def __init__(self, config, *inputs, **kwargs):
super().__init__(config, *inputs, **kwargs)
self.roberta = TFXLMRobertaMainLayer(config, name="roberta")
@unpack_inputs
@add_start_docstrings_to_model_forward(XLM_ROBERTA_INPUTS_DOCSTRING.fo... | class_definition | 45,378 | 49,253 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,905 |
class TFXLMRobertaLMHead(keras.layers.Layer):
"""XLMRoberta Head for masked language modeling."""
def __init__(self, config, input_embeddings, **kwargs):
super().__init__(**kwargs)
self.config = config
self.hidden_size = config.hidden_size
self.dense = keras.layers.Dense(
... | class_definition | 49,359 | 51,783 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,906 |
class TFXLMRobertaForMaskedLM(TFXLMRobertaPreTrainedModel, TFMaskedLanguageModelingLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"pooler", r"lm_head.decoder.weight"]
def __init__(self, config, *... | class_definition | 52,032 | 55,723 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,907 |
class TFXLMRobertaForCausalLM(TFXLMRobertaPreTrainedModel, TFCausalLanguageModelingLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"pooler", r"lm_head.decoder.weight"]
def __init__(self, config: X... | class_definition | 55,999 | 62,629 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,908 |
class TFXLMRobertaClassificationHead(keras.layers.Layer):
"""Head for sentence-level classification tasks."""
def __init__(self, config, **kwargs):
super().__init__(**kwargs)
self.dense = keras.layers.Dense(
config.hidden_size,
kernel_initializer=get_initializer(config.i... | class_definition | 62,747 | 64,304 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,909 |
class TFXLMRobertaForSequenceClassification(TFXLMRobertaPreTrainedModel, TFSequenceClassificationLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"pooler", r"lm_head"]
def __init__(self, config, *i... | class_definition | 64,684 | 68,146 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,910 |
class TFXLMRobertaForMultipleChoice(TFXLMRobertaPreTrainedModel, TFMultipleChoiceLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"lm_head"]
_keys_to_ignore_on_load_missing = [r"dropout"]
def _... | class_definition | 68,527 | 72,758 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,911 |
class TFXLMRobertaForTokenClassification(TFXLMRobertaPreTrainedModel, TFTokenClassificationLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"pooler", r"lm_head"]
_keys_to_ignore_on_load_missing = [r... | class_definition | 73,142 | 76,934 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,912 |
class TFXLMRobertaForQuestionAnswering(TFXLMRobertaPreTrainedModel, TFQuestionAnsweringLoss):
# names with a '.' represents the authorized unexpected/missing layers when a TF model is loaded from a PT model
_keys_to_ignore_on_load_unexpected = [r"pooler", r"lm_head"]
def __init__(self, config, *inputs, **k... | class_definition | 77,374 | 81,821 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py | null | 5,913 |
class XLMRobertaConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`XLMRobertaModel`] or a [`TFXLMRobertaModel`]. It
is used to instantiate a XLM-RoBERTa model according to the specified arguments, defining the model architecture.
Instantiating a configuratio... | class_definition | 960 | 6,952 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/configuration_xlm_roberta.py | null | 5,914 |
class XLMRobertaOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == "multiple-choice":
dynamic_axis = {0: "batch", 1: "choice", 2: "sequence"}
else:
dynamic_axis = {0: "batch", 1: "sequence"}
return OrderedDict(
... | class_definition | 7,062 | 7,513 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/configuration_xlm_roberta.py | null | 5,915 |
class FlaxXLMRobertaEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.word_embeddings = nn.Embed(
self.config.vocab_size,... | class_definition | 6,186 | 8,019 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,916 |
class FlaxXLMRobertaSelfAttention(nn.Module):
config: XLMRobertaConfig
causal: bool = False
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.head_dim = self.config.hidden_size // self.config.num_attention_heads
if self.config.hidden_size % self.config... | class_definition | 8,124 | 16,027 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,917 |
class FlaxXLMRobertaSelfOutput(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.dense = nn.Dense(
self.config.hidden_size,
kernel_init=jax.nn.initializers.normal(self.config.initializer_range),
... | class_definition | 16,129 | 16,955 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,918 |
class FlaxXLMRobertaAttention(nn.Module):
config: XLMRobertaConfig
causal: bool = False
dtype: jnp.dtype = jnp.float32
def setup(self):
self.self = FlaxXLMRobertaSelfAttention(self.config, causal=self.causal, dtype=self.dtype)
self.output = FlaxXLMRobertaSelfOutput(self.config, dtype=se... | class_definition | 17,056 | 18,484 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,919 |
class FlaxXLMRobertaIntermediate(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.dense = nn.Dense(
self.config.intermediate_size,
kernel_init=jax.nn.initializers.normal(self.config.initializer_range),
... | class_definition | 18,588 | 19,178 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,920 |
class FlaxXLMRobertaOutput(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.dense = nn.Dense(
self.config.hidden_size,
kernel_init=jax.nn.initializers.normal(self.config.initializer_range),
... | class_definition | 19,276 | 20,106 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,921 |
class FlaxXLMRobertaLayer(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.attention = FlaxXLMRobertaAttention(self.config, causal=self.config.is_decoder, dtype=self.dtype)
self.intermediate = FlaxXLMRobertaIntermediat... | class_definition | 20,203 | 22,379 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,922 |
class FlaxXLMRobertaLayerCollection(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def setup(self):
if self.gradient_checkpointing:
FlaxXLMRobertaCheckpointLayer = remat(FlaxXLMRobertaLayer, st... | class_definition | 22,486 | 25,530 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,923 |
class FlaxXLMRobertaEncoder(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def setup(self):
self.layer = FlaxXLMRobertaLayerCollection(
self.config,
dtype=self.dtype,
gr... | class_definition | 25,629 | 26,884 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,924 |
class FlaxXLMRobertaPooler(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.dense = nn.Dense(
self.config.hidden_size,
kernel_init=jax.nn.initializers.normal(self.config.initializer_range),
... | class_definition | 26,982 | 27,513 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,925 |
class FlaxXLMRobertaLMHead(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
bias_init: Callable[..., np.ndarray] = jax.nn.initializers.zeros
def setup(self):
self.dense = nn.Dense(
self.config.hidden_size,
dtype=self.dtype,
kernel_init=jax.... | class_definition | 27,623 | 28,952 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,926 |
class FlaxXLMRobertaClassificationHead(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
def setup(self):
self.dense = nn.Dense(
self.config.hidden_size,
dtype=self.dtype,
kernel_init=jax.nn.initializers.normal(self.config.initializer_range),
... | class_definition | 29,074 | 30,328 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,927 |
class FlaxXLMRobertaPreTrainedModel(FlaxPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = XLMRobertaConfig
base_model_prefix = "xlm-roberta"
module_class: nn.Module = None
d... | class_definition | 30,491 | 38,474 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,928 |
class FlaxXLMRobertaModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
add_pooling_layer: bool = True
gradient_checkpointing: bool = False
def setup(self):
self.embeddings = FlaxXLMRobertaEmbeddings(self.config, dtype=self.dtype)
... | class_definition | 38,572 | 41,322 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,929 |
class FlaxXLMRobertaModel(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaModule | class_definition | 41,492 | 41,589 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,930 |
class FlaxXLMRobertaForMaskedLMModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
add_pooling_layer=False,
dtype=self.dtype,... | class_definition | 41,832 | 43,577 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,931 |
class FlaxXLMRobertaForMaskedLM(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForMaskedLMModule | class_definition | 43,696 | 43,810 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,932 |
class FlaxXLMRobertaForSequenceClassificationModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
dtype=self.dtype,
add_poolin... | class_definition | 44,111 | 45,651 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,933 |
class FlaxXLMRobertaForSequenceClassification(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForSequenceClassificationModule | class_definition | 45,887 | 46,029 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,934 |
class FlaxXLMRobertaForMultipleChoiceModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
dtype=self.dtype,
gradient_checkpoin... | class_definition | 46,333 | 48,471 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,935 |
class FlaxXLMRobertaForMultipleChoice(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForMultipleChoiceModule | class_definition | 48,716 | 48,842 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,936 |
class FlaxXLMRobertaForTokenClassificationModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
dtype=self.dtype,
add_pooling_l... | class_definition | 49,289 | 51,101 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,937 |
class FlaxXLMRobertaForTokenClassification(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForTokenClassificationModule | class_definition | 51,344 | 51,480 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,938 |
class FlaxXLMRobertaForQuestionAnsweringModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
dtype=self.dtype,
add_pooling_lay... | class_definition | 51,781 | 53,510 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,939 |
class FlaxXLMRobertaForQuestionAnswering(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForQuestionAnsweringModule | class_definition | 53,811 | 53,943 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,940 |
class FlaxXLMRobertaForCausalLMModule(nn.Module):
config: XLMRobertaConfig
dtype: jnp.dtype = jnp.float32
gradient_checkpointing: bool = False
def setup(self):
self.roberta = FlaxXLMRobertaModule(
config=self.config,
add_pooling_layer=False,
dtype=self.dtype,... | class_definition | 54,222 | 56,409 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,941 |
class FlaxXLMRobertaForCausalLM(FlaxXLMRobertaPreTrainedModel):
module_class = FlaxXLMRobertaForCausalLMModule
def prepare_inputs_for_generation(self, input_ids, max_length, attention_mask: Optional[jax.Array] = None):
# initializing the cache
batch_size, seq_length = input_ids.shape
p... | class_definition | 56,744 | 58,290 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/xlm_roberta/modeling_flax_xlm_roberta.py | null | 5,942 |
class CLIPSegTextConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a... | class_definition | 784 | 5,378 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/configuration_clipseg.py | null | 5,943 |
class CLIPSegVisionConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an
CLIPSeg model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield... | class_definition | 5,381 | 9,392 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/configuration_clipseg.py | null | 5,944 |
class CLIPSegConfig(PretrainedConfig):
r"""
[`CLIPSegConfig`] is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to
instantiate a CLIPSeg model according to the specified arguments, defining the text model and vision model configs.
Instantiating a configuration with ... | class_definition | 9,395 | 19,278 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/configuration_clipseg.py | null | 5,945 |
class CLIPSegProcessor(ProcessorMixin):
r"""
Constructs a CLIPSeg processor which wraps a CLIPSeg image processor and a CLIP tokenizer into a single processor.
[`CLIPSegProcessor`] offers all the functionalities of [`ViTImageProcessor`] and [`CLIPTokenizerFast`]. See the
[`~CLIPSegProcessor.__call__`] ... | class_definition | 772 | 7,789 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/processing_clipseg.py | null | 5,946 |
class CLIPSegOutput(ModelOutput):
"""
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
Th... | class_definition | 2,146 | 4,023 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,947 |
class CLIPSegDecoderOutput(ModelOutput):
"""
Args:
logits (`torch.FloatTensor` of shape `(batch_size, height, width)`):
Classification scores for each pixel.
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.out... | class_definition | 4,037 | 5,188 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,948 |
class CLIPSegImageSegmentationOutput(ModelOutput):
"""
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
...
vision_model_output (`BaseModelOutputWithPooling`):
The outp... | class_definition | 5,202 | 6,061 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,949 |
class CLIPSegVisionEmbeddings(nn.Module):
# Copied from transformers.models.clip.modeling_clip.CLIPVisionEmbeddings.__init__ with CLIP->CLIPSeg
def __init__(self, config: CLIPSegVisionConfig):
super().__init__()
self.config = config
self.embed_dim = config.hidden_size
self.image_... | class_definition | 6,064 | 9,921 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,950 |
class CLIPSegTextEmbeddings(nn.Module):
def __init__(self, config: CLIPSegTextConfig):
super().__init__()
embed_dim = config.hidden_size
self.token_embedding = nn.Embedding(config.vocab_size, embed_dim)
self.position_embedding = nn.Embedding(config.max_position_embeddings, embed_dim... | class_definition | 10,015 | 11,599 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,951 |
class CLIPSegAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()
self.config = config
self.embed_dim = config.hidden_size
self.num_heads = config.num_attention_heads
self.head_dim = self... | class_definition | 11,688 | 16,421 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,952 |
class CLIPSegMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size... | class_definition | 16,504 | 17,077 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,953 |
class CLIPSegEncoderLayer(nn.Module):
def __init__(self, config: CLIPSegConfig):
super().__init__()
self.embed_dim = config.hidden_size
self.self_attn = CLIPSegAttention(config)
self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
self.mlp = CLIPSegMLP(c... | class_definition | 17,181 | 19,138 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,954 |
class CLIPSegPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = CLIPSegConfig
base_model_prefix = "clip"
supports_gradient_checkpointing = True
def _init_weigh... | class_definition | 19,141 | 21,791 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,955 |
class CLIPSegEncoder(nn.Module):
"""
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`CLIPSegEncoderLayer`].
Args:
config: CLIPSegConfig
"""
def __init__(self, config: CLIPSegConfig):
super().__init__()
self.config = ... | class_definition | 27,496 | 31,899 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,956 |
class CLIPSegTextTransformer(nn.Module):
def __init__(self, config: CLIPSegTextConfig):
super().__init__()
self.config = config
embed_dim = config.hidden_size
self.embeddings = CLIPSegTextEmbeddings(config)
self.encoder = CLIPSegEncoder(config)
self.final_layer_norm =... | class_definition | 31,902 | 36,655 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,957 |
class CLIPSegTextModel(CLIPSegPreTrainedModel):
config_class = CLIPSegTextConfig
_no_split_modules = ["CLIPSegTextEmbeddings", "CLIPSegEncoderLayer"]
def __init__(self, config: CLIPSegTextConfig):
super().__init__(config)
self.text_model = CLIPSegTextTransformer(config)
# Initializ... | class_definition | 36,658 | 38,718 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,958 |
class CLIPSegVisionTransformer(nn.Module):
# Copied from transformers.models.altclip.modeling_altclip.AltCLIPVisionTransformer.__init__ with AltCLIP->CLIPSeg
def __init__(self, config: CLIPSegVisionConfig):
super().__init__()
self.config = config
embed_dim = config.hidden_size
s... | class_definition | 38,721 | 41,126 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,959 |
class CLIPSegVisionModel(CLIPSegPreTrainedModel):
config_class = CLIPSegVisionConfig
main_input_name = "pixel_values"
def __init__(self, config: CLIPSegVisionConfig):
super().__init__(config)
self.vision_model = CLIPSegVisionTransformer(config)
# Initialize weights and apply final p... | class_definition | 41,129 | 43,170 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,960 |
class CLIPSegModel(CLIPSegPreTrainedModel):
config_class = CLIPSegConfig
def __init__(self, config: CLIPSegConfig):
super().__init__(config)
if not isinstance(config.text_config, CLIPSegTextConfig):
raise TypeError(
"config.text_config is expected to be of type CLIP... | class_definition | 43,220 | 52,795 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,961 |
class CLIPSegDecoderLayer(nn.Module):
"""
CLIPSeg decoder layer, which is identical to `CLIPSegEncoderLayer`, except that normalization is applied after
self-attention/MLP, rather than before.
"""
# Copied from transformers.models.altclip.modeling_altclip.AltCLIPEncoderLayer.__init__ with AltCLIP->... | class_definition | 52,798 | 55,046 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,962 |
class CLIPSegDecoder(CLIPSegPreTrainedModel):
def __init__(self, config: CLIPSegConfig):
super().__init__(config)
self.conditional_layer = config.conditional_layer
self.film_mul = nn.Linear(config.projection_dim, config.reduce_dim)
self.film_add = nn.Linear(config.projection_dim, c... | class_definition | 55,049 | 58,997 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,963 |
class CLIPSegForImageSegmentation(CLIPSegPreTrainedModel):
config_class = CLIPSegConfig
def __init__(self, config: CLIPSegConfig):
super().__init__(config)
self.config = config
self.clip = CLIPSegModel(config)
self.extract_layers = config.extract_layers
self.decoder =... | class_definition | 59,176 | 66,772 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/clipseg/modeling_clipseg.py | null | 5,964 |
class CodeLlamaTokenizer(PreTrainedTokenizer):
"""
Construct a CodeLlama tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as
there is no padding token in the original model.
The default configuration match that of
[codellama/CodeLlama-7b-Instruct-hf](https://hug... | class_definition | 1,744 | 19,215 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/code_llama/tokenization_code_llama.py | null | 5,965 |
class CodeLlamaTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding.
This uses notably ByteFallback and no normalization.
```python
>>> from transformers import CodeLlamaTokenizerFast
>>> tokenizer = CodeLlamaTokenizerFast.from_pretra... | class_definition | 1,876 | 16,014 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/code_llama/tokenization_code_llama_fast.py | null | 5,966 |
class EfficientNetConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`EfficientNetModel`]. It is used to instantiate an
EfficientNet model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | class_definition | 947 | 7,187 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/configuration_efficientnet.py | null | 5,967 |
class EfficientNetOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse("1.11")
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict(
[
("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
]
... | class_definition | 7,190 | 7,595 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/configuration_efficientnet.py | null | 5,968 |
class EfficientNetImageProcessor(BaseImageProcessor):
r"""
Constructs a EfficientNet image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` ... | class_definition | 1,387 | 18,298 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/image_processing_efficientnet.py | null | 5,969 |
class EfficientNetEmbeddings(nn.Module):
r"""
A module that corresponds to the stem module of the original work.
"""
def __init__(self, config: EfficientNetConfig):
super().__init__()
self.out_dim = round_filters(config, 32)
self.padding = nn.ZeroPad2d(padding=(0, 1, 0, 1))
... | class_definition | 4,080 | 4,988 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,970 |
class EfficientNetDepthwiseConv2d(nn.Conv2d):
def __init__(
self,
in_channels,
depth_multiplier=1,
kernel_size=3,
stride=1,
padding=0,
dilation=1,
bias=True,
padding_mode="zeros",
):
out_channels = in_channels * depth_multiplier
... | class_definition | 4,991 | 5,637 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,971 |
class EfficientNetExpansionLayer(nn.Module):
r"""
This corresponds to the expansion phase of each block in the original implementation.
"""
def __init__(self, config: EfficientNetConfig, in_dim: int, out_dim: int, stride: int):
super().__init__()
self.expand_conv = nn.Conv2d(
... | class_definition | 5,640 | 6,537 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,972 |
class EfficientNetDepthwiseLayer(nn.Module):
r"""
This corresponds to the depthwise convolution phase of each block in the original implementation.
"""
def __init__(
self,
config: EfficientNetConfig,
in_dim: int,
stride: int,
kernel_size: int,
adjust_padd... | class_definition | 6,540 | 7,897 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,973 |
class EfficientNetSqueezeExciteLayer(nn.Module):
r"""
This corresponds to the Squeeze and Excitement phase of each block in the original implementation.
"""
def __init__(self, config: EfficientNetConfig, in_dim: int, expand_dim: int, expand: bool = False):
super().__init__()
self.dim = ... | class_definition | 7,900 | 9,275 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,974 |
class EfficientNetFinalBlockLayer(nn.Module):
r"""
This corresponds to the final phase of each block in the original implementation.
"""
def __init__(
self, config: EfficientNetConfig, in_dim: int, out_dim: int, stride: int, drop_rate: float, id_skip: bool
):
super().__init__()
... | class_definition | 9,278 | 10,430 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,975 |
class EfficientNetBlock(nn.Module):
r"""
This corresponds to the expansion and depthwise convolution phase of each block in the original implementation.
Args:
config ([`EfficientNetConfig`]):
Model configuration class.
in_dim (`int`):
Number of input channels.
... | class_definition | 10,433 | 13,488 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,976 |
class EfficientNetEncoder(nn.Module):
r"""
Forward propogates the embeddings through each EfficientNet block.
Args:
config ([`EfficientNetConfig`]):
Model configuration class.
"""
def __init__(self, config: EfficientNetConfig):
super().__init__()
self.config = c... | class_definition | 13,491 | 16,807 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,977 |
class EfficientNetPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = EfficientNetConfig
base_model_prefix = "efficientnet"
main_input_name = "pixel_values"
_no_... | class_definition | 16,810 | 17,731 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,978 |
class EfficientNetModel(EfficientNetPreTrainedModel):
def __init__(self, config: EfficientNetConfig):
super().__init__(config)
self.config = config
self.embeddings = EfficientNetEmbeddings(config)
self.encoder = EfficientNetEncoder(config)
# Final pooling layer
if co... | class_definition | 17,886 | 20,348 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,979 |
class EfficientNetForImageClassification(EfficientNetPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.num_labels = config.num_labels
self.config = config
self.efficientnet = EfficientNetModel(config)
# Classifier head
self.dropout = nn.Dropo... | class_definition | 20,562 | 23,945 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/efficientnet/modeling_efficientnet.py | null | 5,980 |
class MgpstrConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of an [`MgpstrModel`]. It is used to instantiate an
MGP-STR model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simi... | class_definition | 784 | 5,780 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/configuration_mgp_str.py | null | 5,981 |
class MgpstrTokenizer(PreTrainedTokenizer):
"""
Construct a MGP-STR char tokenizer.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
... | class_definition | 884 | 3,775 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/tokenization_mgp_str.py | null | 5,982 |
class DecodeType(ExplicitEnum):
CHARACTER = "char"
BPE = "bpe"
WORDPIECE = "wp" | class_definition | 914 | 1,005 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/processing_mgp_str.py | null | 5,983 |
class MgpstrProcessor(ProcessorMixin):
r"""
Constructs a MGP-STR processor which wraps an image processor and MGP-STR tokenizers into a single
[`MgpstrProcessor`] offers all the functionalities of `ViTImageProcessor`] and [`MgpstrTokenizer`]. See the
[`~MgpstrProcessor.__call__`] and [`~MgpstrProcessor... | class_definition | 1,102 | 9,297 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/processing_mgp_str.py | null | 5,984 |
class MgpstrDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float] = None) -> None:
super().__init__()
self.drop_prob = drop_prob
def forward(self, hidden_states: torch.Tensor) -> tor... | class_definition | 2,613 | 3,093 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,985 |
class MgpstrModelOutput(ModelOutput):
"""
Base class for vision model's outputs that also contains image embeddings of the pooling of the last hidden states.
Args:
logits (`tuple(torch.FloatTensor)` of shape `(batch_size, config.num_character_labels)`):
Tuple of `torch.FloatTensor` (one... | class_definition | 3,107 | 5,572 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,986 |
class MgpstrEmbeddings(nn.Module):
"""2D Image to Patch Embedding"""
def __init__(self, config: MgpstrConfig):
super().__init__()
image_size = (
config.image_size
if isinstance(config.image_size, collections.abc.Iterable)
else (config.image_size, config.image... | class_definition | 5,575 | 7,513 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,987 |
class MgpstrMlp(nn.Module):
"""MLP as used in Vision Transformer, MLP-Mixer and related networks"""
def __init__(self, config: MgpstrConfig, hidden_features):
super().__init__()
hidden_features = hidden_features or config.hidden_size
self.fc1 = nn.Linear(config.hidden_size, hidden_featu... | class_definition | 7,516 | 8,294 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,988 |
class MgpstrAttention(nn.Module):
def __init__(self, config: MgpstrConfig):
super().__init__()
self.num_heads = config.num_attention_heads
head_dim = config.hidden_size // config.num_attention_heads
self.scale = head_dim**-0.5
self.qkv = nn.Linear(config.hidden_size, config.... | class_definition | 8,297 | 9,660 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,989 |
class MgpstrLayer(nn.Module):
def __init__(self, config: MgpstrConfig, drop_path=None):
super().__init__()
self.norm1 = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.attn = MgpstrAttention(config)
# NOTE: drop path for stochastic depth, we shall see if this is bett... | class_definition | 9,663 | 10,824 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,990 |
class MgpstrEncoder(nn.Module):
def __init__(self, config: MgpstrConfig):
super().__init__()
# stochastic depth decay rule
dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, config.num_hidden_layers)]
self.blocks = nn.Sequential(
*[MgpstrLayer(config=confi... | class_definition | 10,827 | 12,241 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,991 |
class MgpstrA3Module(nn.Module):
def __init__(self, config: MgpstrConfig):
super().__init__()
self.token_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.tokenLearner = nn.Sequential(
nn.Conv2d(config.hidden_size, config.hidden_size, kernel_size=(1, 1), str... | class_definition | 12,244 | 13,465 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,992 |
class MgpstrPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = MgpstrConfig
base_model_prefix = "mgp_str"
_no_split_modules = []
def _init_weights(self, module... | class_definition | 13,468 | 14,505 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,993 |
class MgpstrModel(MgpstrPreTrainedModel):
def __init__(self, config: MgpstrConfig):
super().__init__(config)
self.config = config
self.embeddings = MgpstrEmbeddings(config)
self.encoder = MgpstrEncoder(config)
def get_input_embeddings(self) -> nn.Module:
return self.embe... | class_definition | 16,101 | 17,796 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,994 |
class MgpstrForSceneTextRecognition(MgpstrPreTrainedModel):
config_class = MgpstrConfig
main_input_name = "pixel_values"
def __init__(self, config: MgpstrConfig) -> None:
super().__init__(config)
self.num_labels = config.num_labels
self.mgp_str = MgpstrModel(config)
self.c... | class_definition | 18,062 | 21,923 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mgp_str/modeling_mgp_str.py | null | 5,995 |
class MobileBertTokenizer(PreTrainedTokenizer):
r"""
Construct a MobileBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
... | class_definition | 1,784 | 12,477 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mobilebert/tokenization_mobilebert.py | null | 5,996 |
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
never_split (`Iterable`, *opti... | class_definition | 12,552 | 19,300 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mobilebert/tokenization_mobilebert.py | null | 5,997 |
class WordpieceTokenizer:
"""Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
self.vocab = vocab
self.unk_token = unk_token
self.max_input_chars_per_word = max_input_chars_per_word
def tokenize(self, text):
"""
Toke... | class_definition | 19,379 | 21,267 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mobilebert/tokenization_mobilebert.py | null | 5,998 |
class TFMobileBertPreTrainingLoss:
"""
Loss function suitable for BERT-like pretraining, that is, the task of pretraining a language model by combining
NSP + MLM. .. note:: Any label of -100 will be ignored (along with the corresponding logits) in the loss
computation.
"""
def hf_compute_loss(s... | class_definition | 2,765 | 4,383 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/mobilebert/modeling_tf_mobilebert.py | null | 5,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.