Duke-de-Artois commited on
Commit
a0de60d
·
verified ·
1 Parent(s): 5d4ce49

Upload 4 files

Browse files
configuration_intern_vit.py CHANGED
@@ -17,8 +17,10 @@ class InternVisionConfig(PretrainedConfig):
17
  r"""
18
  This is the configuration class to store the configuration of a [`InternVisionModel`]. It is used to
19
  instantiate a vision encoder according to the specified arguments, defining the model architecture.
 
20
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
21
  documentation from [`PretrainedConfig`] for more information.
 
22
  Args:
23
  num_channels (`int`, *optional*, defaults to 3):
24
  Number of color channels in the input images (e.g., 3 for RGB).
@@ -116,4 +118,3 @@ class InternVisionConfig(PretrainedConfig):
116
  )
117
 
118
  return cls.from_dict(config_dict, **kwargs)
119
-
 
17
  r"""
18
  This is the configuration class to store the configuration of a [`InternVisionModel`]. It is used to
19
  instantiate a vision encoder according to the specified arguments, defining the model architecture.
20
+
21
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
22
  documentation from [`PretrainedConfig`] for more information.
23
+
24
  Args:
25
  num_channels (`int`, *optional*, defaults to 3):
26
  Number of color channels in the input images (e.g., 3 for RGB).
 
118
  )
119
 
120
  return cls.from_dict(config_dict, **kwargs)
 
configuration_internlm2.py CHANGED
@@ -29,8 +29,11 @@ class InternLM2Config(PretrainedConfig):
29
  This is the configuration class to store the configuration of a [`InternLM2Model`]. It is used to instantiate
30
  an InternLM2 model according to the specified arguments, defining the model architecture. Instantiating a
31
  configuration with the defaults will yield a similar configuration to that of the InternLM2-7B.
 
32
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
33
  documentation from [`PretrainedConfig`] for more information.
 
 
34
  Args:
35
  vocab_size (`int`, *optional*, defaults to 32000):
36
  Vocabulary size of the InternLM2 model. Defines the number of different tokens that can be represented by the
@@ -66,6 +69,7 @@ class InternLM2Config(PretrainedConfig):
66
  tie_word_embeddings(`bool`, *optional*, defaults to `False`):
67
  Whether to tie weight embeddings
68
  Example:
 
69
  """
70
  model_type = 'internlm2'
71
  _auto_class = 'AutoConfig'
@@ -144,4 +148,3 @@ class InternLM2Config(PretrainedConfig):
144
  )
145
  if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor < 1.0:
146
  raise ValueError(f"`rope_scaling`'s factor field must be a float >= 1, got {rope_scaling_factor}")
147
-
 
29
  This is the configuration class to store the configuration of a [`InternLM2Model`]. It is used to instantiate
30
  an InternLM2 model according to the specified arguments, defining the model architecture. Instantiating a
31
  configuration with the defaults will yield a similar configuration to that of the InternLM2-7B.
32
+
33
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
34
  documentation from [`PretrainedConfig`] for more information.
35
+
36
+
37
  Args:
38
  vocab_size (`int`, *optional*, defaults to 32000):
39
  Vocabulary size of the InternLM2 model. Defines the number of different tokens that can be represented by the
 
69
  tie_word_embeddings(`bool`, *optional*, defaults to `False`):
70
  Whether to tie weight embeddings
71
  Example:
72
+
73
  """
74
  model_type = 'internlm2'
75
  _auto_class = 'AutoConfig'
 
148
  )
149
  if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor < 1.0:
150
  raise ValueError(f"`rope_scaling`'s factor field must be a float >= 1, got {rope_scaling_factor}")
 
configuration_internvl_chat.py CHANGED
@@ -73,6 +73,7 @@ class InternVLChatConfig(PretrainedConfig):
73
  def to_dict(self):
74
  """
75
  Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
 
76
  Returns:
77
  `Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
78
  """
@@ -93,4 +94,3 @@ class InternVLChatConfig(PretrainedConfig):
93
  output['max_dynamic_patch'] = self.max_dynamic_patch
94
 
95
  return output
96
-
 
73
  def to_dict(self):
74
  """
75
  Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
76
+
77
  Returns:
78
  `Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
79
  """
 
94
  output['max_dynamic_patch'] = self.max_dynamic_patch
95
 
96
  return output
 
modeling_intern_vit.py CHANGED
@@ -299,6 +299,7 @@ class InternVisionEncoder(nn.Module):
299
  """
300
  Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
301
  [`InternEncoderLayer`].
 
302
  Args:
303
  config (`InternConfig`):
304
  The corresponding vision configuration for the `InternEncoder`.
@@ -426,4 +427,4 @@ class InternVisionModel(PreTrainedModel):
426
  pooler_output=pooled_output,
427
  hidden_states=encoder_outputs.hidden_states,
428
  attentions=encoder_outputs.attentions,
429
- )
 
299
  """
300
  Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
301
  [`InternEncoderLayer`].
302
+
303
  Args:
304
  config (`InternConfig`):
305
  The corresponding vision configuration for the `InternEncoder`.
 
427
  pooler_output=pooled_output,
428
  hidden_states=encoder_outputs.hidden_states,
429
  attentions=encoder_outputs.attentions,
430
+ )