configuration_splinter.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright 2021 Tel AViv University, AllenAI 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. """Splinter 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="tau/splinter-base")
  19. @strict
  20. class SplinterConfig(PreTrainedConfig):
  21. r"""
  22. question_token_id (`int`, *optional*, defaults to 104):
  23. The id of the `[QUESTION]` token.
  24. Example:
  25. ```python
  26. >>> from transformers import SplinterModel, SplinterConfig
  27. >>> # Initializing a Splinter tau/splinter-base style configuration
  28. >>> configuration = SplinterConfig()
  29. >>> # Initializing a model from the tau/splinter-base style configuration
  30. >>> model = SplinterModel(configuration)
  31. >>> # Accessing the model configuration
  32. >>> configuration = model.config
  33. ```"""
  34. model_type = "splinter"
  35. vocab_size: int = 30522
  36. hidden_size: int = 768
  37. num_hidden_layers: int = 12
  38. num_attention_heads: int = 12
  39. intermediate_size: int = 3072
  40. hidden_act: str = "gelu"
  41. hidden_dropout_prob: float | int = 0.1
  42. attention_probs_dropout_prob: float | int = 0.1
  43. max_position_embeddings: int = 512
  44. type_vocab_size: int = 2
  45. initializer_range: float = 0.02
  46. layer_norm_eps: float = 1e-12
  47. pad_token_id: int | None = 0
  48. bos_token_id: int | None = None
  49. eos_token_id: int | list[int] | None = None
  50. question_token_id: int = 104
  51. __all__ = ["SplinterConfig"]