configuration_mpnet.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Copyright 2018 The HuggingFace Inc. team, Microsoft Corporation.
  2. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """MPNet model configuration"""
  16. from huggingface_hub.dataclasses import strict
  17. from ...configuration_utils import PreTrainedConfig
  18. from ...utils import auto_docstring
  19. @auto_docstring(checkpoint="microsoft/mpnet-base")
  20. @strict
  21. class MPNetConfig(PreTrainedConfig):
  22. r"""
  23. relative_attention_num_buckets (`int`, *optional*, defaults to 32):
  24. The number of buckets to use for each attention layer.
  25. Examples:
  26. ```python
  27. >>> from transformers import MPNetModel, MPNetConfig
  28. >>> # Initializing a MPNet mpnet-base style configuration
  29. >>> configuration = MPNetConfig()
  30. >>> # Initializing a model from the mpnet-base style configuration
  31. >>> model = MPNetModel(configuration)
  32. >>> # Accessing the model configuration
  33. >>> configuration = model.config
  34. ```"""
  35. model_type = "mpnet"
  36. vocab_size: int = 30527
  37. hidden_size: int = 768
  38. num_hidden_layers: int = 12
  39. num_attention_heads: int = 12
  40. intermediate_size: int = 3072
  41. hidden_act: str = "gelu"
  42. hidden_dropout_prob: float | int = 0.1
  43. attention_probs_dropout_prob: float | int = 0.1
  44. max_position_embeddings: int = 512
  45. initializer_range: float = 0.02
  46. layer_norm_eps: float = 1e-12
  47. relative_attention_num_buckets: int = 32
  48. pad_token_id: int | None = 1
  49. bos_token_id: int | None = 0
  50. eos_token_id: int | list[int] | None = 2
  51. tie_word_embeddings: bool = True
  52. __all__ = ["MPNetConfig"]