#                🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
#           This file was automatically generated from src/transformers/models/tipsv2_dpt/modular_tipsv2_dpt.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_tipsv2_dpt.py file directly. One of our CI enforces this.
#                🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# Copyright 2026 Google LLC 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 consolidate_backbone_kwargs_to_config
from ...configuration_utils import PreTrainedConfig
from ...utils import auto_docstring
from ..auto import AutoConfig


@auto_docstring(checkpoint="google/tipsv2-b14-dpt")
@strict
class Tipsv2DptConfig(PreTrainedConfig):
    r"""
    neck_hidden_sizes (`list[int]`, *optional*, defaults to `[96, 192, 384, 768]`):
        The hidden sizes to project to for the feature maps of the backbone.
    fusion_hidden_size (`int`, *optional*, defaults to 256):
        The number of channels before fusion.
    reassemble_factors (`list[float]`, *optional*, defaults to `[4, 2, 1, 0.5]`):
        The up/downsampling factors of the reassemble layers.
    readout_activation (`str`, *optional*, defaults to `"gelu_pytorch_tanh"`):
        Activation applied after the readout projection layer.
    num_depth_bins (`int`, *optional*, defaults to 256):
        The number of depth bins used by the depth-estimation head.
    min_depth (`float`, *optional*, defaults to 0.001):
        The minimum depth value (meters) for depth bin calculation.
    max_depth (`float`, *optional*, defaults to 10.0):
        The maximum depth value (meters) for depth bin calculation.
    depth_decoder_activation (`str`, *optional*, defaults to `"relu"`):
        Activation applied after the depth decoder projection layer.
    semantic_loss_ignore_index (`int`, *optional*, defaults to 255):
        Label index to ignore in the cross-entropy loss for semantic segmentation.

    Example:

    ```python
    >>> from transformers import Tipsv2DptConfig, Tipsv2DptForDensePrediction

    >>> configuration = Tipsv2DptConfig()
    >>> model = Tipsv2DptForDensePrediction(configuration)
    >>> configuration = model.config
    ```
    """

    model_type = "tipsv2_dpt"
    sub_configs = {"backbone_config": AutoConfig}

    backbone_config: dict | PreTrainedConfig | None = None
    neck_hidden_sizes: list[int] | tuple[int, ...] | None = None
    fusion_hidden_size: int = 256
    reassemble_factors: list[int | float] | tuple[int | float, ...] | None = None
    readout_activation: str = "gelu_pytorch_tanh"
    num_depth_bins: int = 256
    min_depth: float = 0.001
    max_depth: float = 10.0
    depth_decoder_activation: str = "relu"
    semantic_loss_ignore_index: int = 255

    def __post_init__(self, **kwargs):
        if self.neck_hidden_sizes is None:
            self.neck_hidden_sizes = [96, 192, 384, 768]
        if self.reassemble_factors is None:
            self.reassemble_factors = [4, 2, 1, 0.5]

        self.backbone_config, kwargs = consolidate_backbone_kwargs_to_config(
            backbone_config=self.backbone_config,
            default_config_type="tipsv2_vision_model",
            default_config_kwargs={
                "out_indices": [3, 6, 9, 12],
                "apply_layernorm": True,
                "reshape_hidden_states": False,
            },
            **kwargs,
        )
        super().__post_init__(**kwargs)


__all__ = ["Tipsv2DptConfig"]
