CoolFace
Modelpublic

apple/aimv2-large-patch14-224

sourceHugging Faceapple-amlrupdated 1y agoView on Hugging Face
62likes1.6kdownloads
configuration_aimv2.py63 linesDownload Raw Back to root
1from typing import Any2 3from transformers.configuration_utils import PretrainedConfig4 5__all__ = ["AIMv2Config"]6 7 8class AIMv2Config(PretrainedConfig):9    """This is the configuration class to store the configuration of an [`AIMv2Model`].10 11    Instantiating a configuration with the defaults will yield a similar configuration12    to that of the [apple/aimv2-large-patch14-224](https://huggingface.co/apple/aimv2-large-patch14-224).13 14    Args:15        hidden_size: Dimension of the hidden representations.16        intermediate_size: Dimension of the SwiGLU representations.17        num_hidden_layers: Number of hidden layers in the Transformer.18        num_attention_heads: Number of attention heads for each attention layer19            in the Transformer.20        num_channels: Number of input channels.21        image_size: Image size.22        patch_size: Patch size.23        rms_norm_eps: Epsilon value used for the RMS normalization layer.24        attention_dropout: Dropout ratio for attention probabilities.25        projection_dropout: Dropout ratio for the projection layer after the attention.26        qkv_bias: Whether to add a bias to the queries, keys and values.27        use_bias: Whether to add a bias in the feed-forward and projection layers.28        kwargs: Keyword arguments for the [`PretrainedConfig`].29    """30 31    model_type: str = "aimv2"32 33    def __init__(34        self,35        hidden_size: int = 1024,36        intermediate_size: int = 2816,37        num_hidden_layers: int = 24,38        num_attention_heads: int = 8,39        num_channels: int = 3,40        image_size: int = 224,41        patch_size: int = 14,42        rms_norm_eps: float = 1e-5,43        attention_dropout: float = 0.0,44        projection_dropout: float = 0.0,45        qkv_bias: bool = False,46        use_bias: bool = False,47        **kwargs: Any,48    ):49        super().__init__(**kwargs)50        self.hidden_size = hidden_size51        self.intermediate_size = intermediate_size52        self.num_hidden_layers = num_hidden_layers53        self.num_attention_heads = num_attention_heads54        self.num_channels = num_channels55        self.patch_size = patch_size56        self.image_size = image_size57        self.attention_dropout = attention_dropout58        self.rms_norm_eps = rms_norm_eps59 60        self.projection_dropout = projection_dropout61        self.qkv_bias = qkv_bias62        self.use_bias = use_bias63