configuration_rembert.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """RemBERT model configuration"""
  15. from huggingface_hub.dataclasses import strict
  16. from ...configuration_utils import PreTrainedConfig
  17. from ...utils import auto_docstring
  18. @auto_docstring(checkpoint="google/rembert")
  19. @strict
  20. class RemBertConfig(PreTrainedConfig):
  21. r"""
  22. input_embedding_size (`int`, *optional*, defaults to 256):
  23. Dimensionality of the input embeddings.
  24. output_embedding_size (`int`, *optional*, defaults to 1664):
  25. Dimensionality of the output embeddings.
  26. Example:
  27. ```python
  28. >>> from transformers import RemBertModel, RemBertConfig
  29. >>> # Initializing a RemBERT rembert style configuration
  30. >>> configuration = RemBertConfig()
  31. >>> # Initializing a model from the rembert style configuration
  32. >>> model = RemBertModel(configuration)
  33. >>> # Accessing the model configuration
  34. >>> configuration = model.config
  35. ```"""
  36. model_type = "rembert"
  37. vocab_size: int = 250300
  38. hidden_size: int = 1152
  39. num_hidden_layers: int = 32
  40. num_attention_heads: int = 18
  41. input_embedding_size: int = 256
  42. output_embedding_size: int = 1664
  43. intermediate_size: int = 4608
  44. hidden_act: str = "gelu"
  45. hidden_dropout_prob: float | int = 0.0
  46. attention_probs_dropout_prob: float | int = 0.0
  47. classifier_dropout_prob: float | int = 0.1
  48. max_position_embeddings: int = 512
  49. type_vocab_size: int = 2
  50. initializer_range: float = 0.02
  51. layer_norm_eps: float = 1e-12
  52. use_cache: bool = True
  53. pad_token_id: int | None = 0
  54. bos_token_id: int | None = 312
  55. eos_token_id: int | list[int] | None = 313
  56. is_decoder: bool = False
  57. add_cross_attention: bool = False
  58. tie_word_embeddings: bool = False
  59. __all__ = ["RemBertConfig"]