Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initilizations #1

Merged
merged 4 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/transformers/modeling_tf_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class TFBaseModelOutputWithPoolingAndNoAttention(ModelOutput):
pooler_output (`tf.Tensor` of shape `(batch_size, hidden_size)`):
Last layer hidden-state after a pooling operation on the spatial dimensions.
hidden_states (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `tf.Tensor` (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape `(batch_size, num_channels, height, width)`.
Tuple of `tf.Tensor` (one for the output of the embeddings, if the model has an embedding layer, + one for
the output of each layer) of shape `(batch_size, num_channels, height, width)`.

Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
"""
Expand Down Expand Up @@ -830,6 +830,7 @@ class TFSequenceClassifierOutputWithPast(ModelOutput):
hidden_states: Optional[Tuple[tf.Tensor]] = None
attentions: Optional[Tuple[tf.Tensor]] = None


@dataclass
class TFImageClassifierOutputWithNoAttention(ModelOutput):
"""
Expand All @@ -841,9 +842,9 @@ class TFImageClassifierOutputWithNoAttention(ModelOutput):
logits (`tf.Tensor` of shape `(batch_size, config.num_labels)`):
Classification (or regression if config.num_labels==1) scores (before SoftMax).
hidden_states (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
Tuple of `tf.Tensor` (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape `(batch_size, num_channels, height, width)`. Hidden-states (also
called feature maps) of the model at the output of each stage.
Tuple of `tf.Tensor` (one for the output of the embeddings, if the model has an embedding layer, + one for
the output of each stage) of shape `(batch_size, num_channels, height, width)`. Hidden-states (also called
feature maps) of the model at the output of each stage.
"""

loss: Optional[tf.Tensor] = None
Expand Down
4 changes: 4 additions & 0 deletions src/transformers/models/regnet/configuration_regnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class RegNetConfig(PretrainedConfig):
documentation from [`PretrainedConfig`] for more information.

Args:
image_size (`int`, *optional*, defaults to 224):
Size of the input images.
num_channels (`int`, *optional*, defaults to 3):
The number of input channels.
embedding_size (`int`, *optional*, defaults to 64):
Expand Down Expand Up @@ -71,6 +73,7 @@ class RegNetConfig(PretrainedConfig):

def __init__(
self,
image_size=224,
num_channels=3,
embedding_size=32,
hidden_sizes=[128, 192, 512, 1088],
Expand All @@ -83,6 +86,7 @@ def __init__(
super().__init__(**kwargs)
if layer_type not in self.layer_types:
raise ValueError(f"layer_type={layer_type} is not one of {','.join(self.layer_types)}")
self.image_size = image_size
self.num_channels = num_channels
self.embedding_size = embedding_size
self.hidden_sizes = hidden_sizes
Expand Down
Loading