| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- # Copyright 2022 The HuggingFace Inc. team. All rights reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- """YOSO model configuration"""
- from huggingface_hub.dataclasses import strict
- from ...configuration_utils import PreTrainedConfig
- from ...utils import auto_docstring
- @auto_docstring(checkpoint="uw-madison/yoso-4096")
- @strict
- class YosoConfig(PreTrainedConfig):
- r"""
- use_expectation (`bool`, *optional*, defaults to `True`):
- Whether or not to use YOSO Expectation. Overrides any effect of num_hash.
- hash_code_len (`int`, *optional*, defaults to 9):
- The length of hashes generated by the hash functions.
- num_hash (`int`, *optional*, defaults to 64):
- Number of hash functions used in [`YosoSelfAttention`].
- conv_window (`int`, *optional*):
- Kernel size of depth-wise convolution.
- use_fast_hash (`bool`, *optional*, defaults to `False`):
- Whether or not to use custom cuda kernels which perform fast random projection via hadamard transform.
- lsh_backward (`bool`, *optional*, defaults to `True`):
- Whether or not to perform backpropagation using Locality Sensitive Hashing.
- Example:
- ```python
- >>> from transformers import YosoConfig, YosoModel
- >>> # Initializing a YOSO uw-madison/yoso-4096 style configuration
- >>> configuration = YosoConfig()
- >>> # Initializing a model (with random weights) from the uw-madison/yoso-4096 style configuration
- >>> model = YosoModel(configuration)
- >>> # Accessing the model configuration
- >>> configuration = model.config
- ```"""
- model_type = "yoso"
- vocab_size: int = 50265
- hidden_size: int = 768
- num_hidden_layers: int = 12
- num_attention_heads: int = 12
- intermediate_size: int = 3072
- hidden_act: str = "gelu"
- hidden_dropout_prob: float | int = 0.1
- attention_probs_dropout_prob: float | int = 0.1
- max_position_embeddings: int = 4096
- type_vocab_size: int = 1
- initializer_range: float = 0.02
- layer_norm_eps: float = 1e-12
- use_expectation: bool = True
- hash_code_len: int = 9
- num_hash: int = 64
- conv_window: int | None = None
- use_fast_hash: bool = True
- lsh_backward: bool = True
- pad_token_id: int | None = 1
- bos_token_id: int | None = 0
- eos_token_id: int | list[int] | None = 2
- add_cross_attention: bool = False
- tie_word_embeddings: bool = True
- __all__ = ["YosoConfig"]
|