codingutf8 2022 meta platforms inc and the huggingface inc team 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 orglicenseslicense2 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 regnet model configuration from configurationutils import pretrainedconfig from utils import logging logger logging getloggername regnetpretrainedconfigarchivemap facebookregnety040 https huggingface cofacebookregnety040blobmainconfig json class regnetconfigpretrainedconfig r this is the configuration class to store the configuration of a regnetmodel it is used to instantiate a regnet model according to the specified arguments defining the model architecture instantiating a configuration with the defaults will yield a similar configuration to that of the regnet facebookregnety040https huggingface cofacebookregnety040 architecture configuration objects inherit from pretrainedconfig and can be used to control the model outputs read the documentation from pretrainedconfig for more information args numchannels int optional defaults to 3 the number of input channels embeddingsize int optional defaults to 64 dimensionality hidden size for the embedding layer hiddensizes listint optional defaults to 256 512 1024 2048 dimensionality hidden size at each stage depths listint optional defaults to 3 4 6 3 depth number of layers for each stage layertype str optional defaults to y the layer to use it can be either x or y an x layer is a resnet s bottleneck layer with reduction fixed to 1 while a y layer is a x but with squeeze and excitation please refer to the paper for a detailed explanation of how these layers were constructed hiddenact str optional defaults to relu the nonlinear activation function in each block if string gelu relu selu and gelunew are supported downsampleinfirststage bool optional defaults to false if true the first stage will downsample the inputs using a stride of 2 example python from transformers import regnetconfig regnetmodel initializing a regnet regnety40 style configuration configuration regnetconfig initializing a model from the regnety40 style configuration model regnetmodelconfiguration accessing the model configuration configuration model config always downsample in the first stage coding utf 8 2022 meta platforms inc and the huggingface inc team 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 regnet model configuration this is the configuration class to store the configuration of a regnetmodel it is used to instantiate a regnet model according to the specified arguments defining the model architecture instantiating a configuration with the defaults will yield a similar configuration to that of the regnet facebook regnet y 040 https huggingface co facebook regnet y 040 architecture configuration objects inherit from pretrainedconfig and can be used to control the model outputs read the documentation from pretrainedconfig for more information args num_channels int optional defaults to 3 the number of input channels embedding_size int optional defaults to 64 dimensionality hidden size for the embedding layer hidden_sizes list int optional defaults to 256 512 1024 2048 dimensionality hidden size at each stage depths list int optional defaults to 3 4 6 3 depth number of layers for each stage layer_type str optional defaults to y the layer to use it can be either x or y an x layer is a resnet s bottleneck layer with reduction fixed to 1 while a y layer is a x but with squeeze and excitation please refer to the paper for a detailed explanation of how these layers were constructed hidden_act str optional defaults to relu the non linear activation function in each block if string gelu relu selu and gelu_new are supported downsample_in_first_stage bool optional defaults to false if true the first stage will downsample the inputs using a stride of 2 example python from transformers import regnetconfig regnetmodel initializing a regnet regnet y 40 style configuration configuration regnetconfig initializing a model from the regnet y 40 style configuration model regnetmodel configuration accessing the model configuration configuration model config always downsample in the first stage
from ...configuration_utils import PretrainedConfig
from ...utils import logging


logger = logging.get_logger(__name__)

REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP = {
    "facebook/regnet-y-040": "https://huggingface.co/facebook/regnet-y-040/blob/main/config.json",
}


class RegNetConfig(PretrainedConfig):
    r

    model_type = "regnet"
    layer_types = ["x", "y"]

    def __init__(
        self,
        num_channels=3,
        embedding_size=32,
        hidden_sizes=[128, 192, 512, 1088],
        depths=[2, 6, 12, 2],
        groups_width=64,
        layer_type="y",
        hidden_act="relu",
        **kwargs,
    ):
        super().__init__(**kwargs)
        if layer_type not in self.layer_types:
            raise ValueError(f"layer_type={layer_type} is not one of {','.join(self.layer_types)}")
        self.num_channels = num_channels
        self.embedding_size = embedding_size
        self.hidden_sizes = hidden_sizes
        self.depths = depths
        self.groups_width = groups_width
        self.layer_type = layer_type
        self.hidden_act = hidden_act
        
        self.downsample_in_first_stage = True