configuration_biogpt.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright 2022 The HuggingFace Team and Microsoft Research AI4Science 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. """BioGPT 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="microsoft/biogpt")
  19. @strict
  20. class BioGptConfig(PreTrainedConfig):
  21. r"""
  22. Example:
  23. ```python
  24. >>> from transformers import BioGptModel, BioGptConfig
  25. >>> # Initializing a BioGPT microsoft/biogpt style configuration
  26. >>> configuration = BioGptConfig()
  27. >>> # Initializing a model from the microsoft/biogpt style configuration
  28. >>> model = BioGptModel(configuration)
  29. >>> # Accessing the model configuration
  30. >>> configuration = model.config
  31. ```"""
  32. model_type = "biogpt"
  33. vocab_size: int = 42384
  34. hidden_size: int = 1024
  35. num_hidden_layers: int = 24
  36. num_attention_heads: int = 16
  37. intermediate_size: int = 4096
  38. hidden_act: str = "gelu"
  39. hidden_dropout_prob: float | int = 0.1
  40. attention_probs_dropout_prob: float | int = 0.1
  41. max_position_embeddings: int = 1024
  42. initializer_range: float = 0.02
  43. layer_norm_eps: float = 1e-12
  44. scale_embedding: bool = True
  45. use_cache: bool = True
  46. layerdrop: float | int = 0.0
  47. activation_dropout: float | int = 0.0
  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__ = ["BioGptConfig"]