Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
a5e6df82
Unverified
Commit
a5e6df82
authored
Oct 09, 2023
by
Isaac Chung
Committed by
GitHub
Oct 09, 2023
Browse files
[docstring] Fix docstrings for `CLIP` (#26691)
fix docstrings for vanilla clip
parent
87b4ade9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
13 deletions
+20
-13
src/transformers/models/clip/configuration_clip.py
src/transformers/models/clip/configuration_clip.py
+6
-2
src/transformers/models/clip/tokenization_clip.py
src/transformers/models/clip/tokenization_clip.py
+5
-3
src/transformers/models/clip/tokenization_clip_fast.py
src/transformers/models/clip/tokenization_clip_fast.py
+9
-5
utils/check_docstrings.py
utils/check_docstrings.py
+0
-3
No files found.
src/transformers/models/clip/configuration_clip.py
View file @
a5e6df82
...
@@ -168,10 +168,14 @@ class CLIPVisionConfig(PretrainedConfig):
...
@@ -168,10 +168,14 @@ class CLIPVisionConfig(PretrainedConfig):
Dimensionality of the encoder layers and the pooler layer.
Dimensionality of the encoder layers and the pooler layer.
intermediate_size (`int`, *optional*, defaults to 3072):
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
projection_dim (`int`, *optional*, defaults to 512):
Dimentionality of text and vision projection layers.
num_hidden_layers (`int`, *optional*, defaults to 12):
num_hidden_layers (`int`, *optional*, defaults to 12):
Number of hidden layers in the Transformer encoder.
Number of hidden layers in the Transformer encoder.
num_attention_heads (`int`, *optional*, defaults to 12):
num_attention_heads (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
Number of attention heads for each attention layer in the Transformer encoder.
num_channels (`int`, *optional*, defaults to 3):
The number of input channels.
image_size (`int`, *optional*, defaults to 224):
image_size (`int`, *optional*, defaults to 224):
The size (resolution) of each image.
The size (resolution) of each image.
patch_size (`int`, *optional*, defaults to 32):
patch_size (`int`, *optional*, defaults to 32):
...
@@ -179,13 +183,13 @@ class CLIPVisionConfig(PretrainedConfig):
...
@@ -179,13 +183,13 @@ class CLIPVisionConfig(PretrainedConfig):
hidden_act (`str` or `function`, *optional*, defaults to `"quick_gelu"`):
hidden_act (`str` or `function`, *optional*, defaults to `"quick_gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported.
`"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported.
layer_norm_eps (`float`, *optional*, defaults to 1e-5):
layer_norm_eps (`float`, *optional*, defaults to 1e-
0
5):
The epsilon used by the layer normalization layers.
The epsilon used by the layer normalization layers.
attention_dropout (`float`, *optional*, defaults to 0.0):
attention_dropout (`float`, *optional*, defaults to 0.0):
The dropout ratio for the attention probabilities.
The dropout ratio for the attention probabilities.
initializer_range (`float`, *optional*, defaults to 0.02):
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
initializer_factor (`float`, *optional*, defaults to 1):
initializer_factor (`float`, *optional*, defaults to 1
.0
):
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).
testing).
...
...
src/transformers/models/clip/tokenization_clip.py
View file @
a5e6df82
...
@@ -284,13 +284,15 @@ class CLIPTokenizer(PreTrainedTokenizer):
...
@@ -284,13 +284,15 @@ class CLIPTokenizer(PreTrainedTokenizer):
errors (`str`, *optional*, defaults to `"replace"`):
errors (`str`, *optional*, defaults to `"replace"`):
Paradigm to follow when decoding bytes to UTF-8. See
Paradigm to follow when decoding bytes to UTF-8. See
[bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
[bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
unk_token (`str`, *optional*, defaults to `<|endoftext|>`):
unk_token (`str`, *optional*, defaults to `
"
<|endoftext|>
"
`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
token instead.
bos_token (`str`, *optional*, defaults to `<|startoftext|>`):
bos_token (`str`, *optional*, defaults to `
"
<|startoftext|>
"
`):
The beginning of sequence token.
The beginning of sequence token.
eos_token (`str`, *optional*, defaults to `<|endoftext|>`):
eos_token (`str`, *optional*, defaults to `
"
<|endoftext|>
"
`):
The end of sequence token.
The end of sequence token.
pad_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
The token used for padding, for example when batching sequences of different lengths.
"""
"""
vocab_files_names
=
VOCAB_FILES_NAMES
vocab_files_names
=
VOCAB_FILES_NAMES
...
...
src/transformers/models/clip/tokenization_clip_fast.py
View file @
a5e6df82
...
@@ -56,17 +56,21 @@ class CLIPTokenizerFast(PreTrainedTokenizerFast):
...
@@ -56,17 +56,21 @@ class CLIPTokenizerFast(PreTrainedTokenizerFast):
refer to this superclass for more information regarding those methods.
refer to this superclass for more information regarding those methods.
Args:
Args:
vocab_file (`str`):
vocab_file (`str`
, *optional*
):
Path to the vocabulary file.
Path to the vocabulary file.
merges_file (`str`):
merges_file (`str`
, *optional*
):
Path to the merges file.
Path to the merges file.
unk_token (`str`, *optional*, defaults to `<|endoftext|>`):
tokenizer_file (`str`, *optional*):
The path to a tokenizer file to use instead of the vocab file.
unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
token instead.
bos_token (`str`, *optional*, defaults to `<|startoftext|>`):
bos_token (`str`, *optional*, defaults to `
"
<|startoftext|>
"
`):
The beginning of sequence token.
The beginning of sequence token.
eos_token (`str`, *optional*, defaults to `<|endoftext|>`):
eos_token (`str`, *optional*, defaults to `
"
<|endoftext|>
"
`):
The end of sequence token.
The end of sequence token.
pad_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
The token used for padding, for example when batching sequences of different lengths.
"""
"""
vocab_files_names
=
VOCAB_FILES_NAMES
vocab_files_names
=
VOCAB_FILES_NAMES
...
...
utils/check_docstrings.py
View file @
a5e6df82
...
@@ -118,9 +118,6 @@ OBJECTS_TO_IGNORE = [
...
@@ -118,9 +118,6 @@ OBJECTS_TO_IGNORE = [
"BridgeTowerTextConfig"
,
"BridgeTowerTextConfig"
,
"BridgeTowerVisionConfig"
,
"BridgeTowerVisionConfig"
,
"BrosModel"
,
"BrosModel"
,
"CLIPTokenizer"
,
"CLIPTokenizerFast"
,
"CLIPVisionConfig"
,
"CamembertConfig"
,
"CamembertConfig"
,
"CamembertModel"
,
"CamembertModel"
,
"CamembertTokenizerFast"
,
"CamembertTokenizerFast"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment