| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
- # This file was automatically generated from src/transformers/models/pixio/modular_pixio.py.
- # Do NOT edit this file manually as any edits will be overwritten by the generation of
- # the file from the modular. If any change should be done, please apply the change to the
- # modular_pixio.py file directly. One of our CI enforces this.
- # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
- # Copyright 2025 Meta AI and 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.
- from huggingface_hub.dataclasses import strict
- from ...backbone_utils import BackboneConfigMixin
- from ...configuration_utils import PreTrainedConfig
- from ...utils import auto_docstring
- @auto_docstring(checkpoint="facebook/pixio-huge")
- @strict
- class PixioConfig(BackboneConfigMixin, PreTrainedConfig):
- r"""
- apply_layernorm (`bool`, *optional*, defaults to `True`):
- Whether to apply layer normalization to the feature maps in case the model is used as backbone.
- reshape_hidden_states (`bool`, *optional*, defaults to `True`):
- Whether to reshape the feature maps to 4D tensors of shape `(batch_size, hidden_size, height, width)` in
- case the model is used as backbone. If `False`, the feature maps will be 3D tensors of shape `(batch_size,
- seq_len, hidden_size)`.
- n_cls_tokens (`int`, *optional*, defaults to 8):
- Number of class tokens in the Transformer encoder.
- Example:
- ```python
- >>> from transformers import PixioConfig, PixioModel
- >>> # Initializing a Pixio pixio-huge style configuration
- >>> configuration = PixioConfig()
- >>> # Initializing a model (with random weights) from the pixio-huge style configuration
- >>> model = PixioModel(configuration)
- >>> # Accessing the model configuration
- >>> configuration = model.config
- ```"""
- model_type = "pixio"
- hidden_size: int = 1280
- num_hidden_layers: int = 32
- num_attention_heads: int = 16
- mlp_ratio: int = 4
- hidden_act: str = "gelu"
- hidden_dropout_prob: float | int = 0.0
- attention_probs_dropout_prob: float | int = 0.0
- initializer_range: float = 0.02
- layer_norm_eps: float = 1e-6
- image_size: int | list[int] | tuple[int, int] = 256
- patch_size: int | list[int] | tuple[int, int] = 16
- num_channels: int = 3
- qkv_bias: bool = True
- drop_path_rate: float | int = 0.0
- _out_features: list[str] | None = None
- _out_indices: list[int] | None = None
- apply_layernorm: bool = True
- reshape_hidden_states: bool = True
- n_cls_tokens: int = 8
- def __post_init__(self, **kwargs):
- self.stage_names = ["stem"] + [f"stage{idx}" for idx in range(1, self.num_hidden_layers + 1)]
- self.set_output_features_output_indices(
- out_indices=kwargs.pop("out_indices", None), out_features=kwargs.pop("out_features", None)
- )
- super().__post_init__(**kwargs)
- __all__ = ["PixioConfig"]
|