
    fTh:                         S SK Jr  SSKJr  SSKJr  SSKJrJr  \R                  " \
5      r " S S\5      r " S	 S
\5      r " S S\5      r/ SQrg)    )List   )PretrainedConfig)logging   )CONFIG_MAPPING
AutoConfigc                   \   ^  \ rS rSrSrSrSr                  SU 4S jjrSrU =r	$ )JanusVisionConfig    a^
  
This is the configuration class to store the configuration of a [`JanusVisionModel`]. It is used to instantiate a
`JanusVisionModel` according to the specified arguments, defining the model architecture.

Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
    hidden_size (`int`, *optional*, defaults to 1024):
        Dimensionality of the encoder layers and the pooler layer.
    num_hidden_layers (`int`, *optional*, defaults to 24):
        Number of hidden layers in the Transformer encoder.
    num_attention_heads (`int`, *optional*, defaults to 16):
        Number of attention heads for each attention layer in the Transformer encoder.
    num_channels (`int`, *optional*, defaults to 3):
        The number of input channels.
    patch_size (`int`, *optional*, defaults to 16):
        The size (resolution) of each patch.
    image_size (`int`, *optional*, defaults to 384):
        The size (resolution) of each image.
    attention_dropout (`float`, *optional*, defaults to 0.0):
        Dropout probability for attention weights.
    layer_norm_eps (`float`, *optional*, defaults to 1e-06):
        The epsilon used by the layer normalization layers.
    hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
        The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
        `"relu"`, `"selu"`, and `"gelu_new"` are supported.
    mlp_ratio (`float`, *optional*, defaults to 4.0):
        Ratio of MLP hidden dimensionality to embedding dimensionality.
    attention_bias (`bool`, *optional*, defaults to `True`):
        Whether to add a bias to the queries, keys, and values in the attention layers.
    hidden_dropout_rate (`float`, *optional*, defaults to 0.0):
        The dropout probability for fully connected layers in the encoder.
    projection_dim (`int`, *optional*, defaults to 2048):
        Dimensionality of the MLP projection head.
    projection_dropout (`float`, *optional*, defaults to 0.0):
        Dropout probability for the projection layer.
    use_qk_norm (`bool`, *optional*, defaults to `False`):
        Whether to normalize the query and key matrices.
    initializer_range (`float`, *optional*, defaults to 0.02):
        The standard deviation of the truncated normal initializer for initializing all weight matrices.
    depth (`int`, *optional*, defaults to 2):
        Number of hidden layers in the aligner module.
    num_image_tokens (`int`, *optional*, defaults to 576):
        Number of image tokens.
janus_vision_modelvision_configc                   > [         TU ]  " S0 UD6  Xl        X l        X0l        X@l        XPl        X`l        Xpl        Xl	        Xl
        Xl        Xl        Xl        Xl        Xl        Xl        UU l        UU l        UU l        g N )super__init__hidden_sizenum_hidden_layersnum_attention_headsnum_channels
patch_size
image_sizeattention_dropoutlayer_norm_eps
hidden_act	mlp_ratioattention_biashidden_dropout_rateprojection_dimprojection_dropoutuse_qk_norminitializer_rangedepthnum_image_tokens)selfr   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   kwargs	__class__s                       e/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/janus/configuration_janus.pyr   JanusVisionConfig.__init__R   s    , 	"6"&!2#6 ($$!2,$",#6 ,"4&!2
 0    )r   r   r$   r   r   r   r   r#   r   r   r   r   r   r%   r   r    r!   r"   )i         r   r-   i          gư>gelug      @Tr.      r.   F{Gz?r   i@  )
__name__
__module____qualname____firstlineno____doc__
model_typebase_config_keyr   __static_attributes____classcell__r(   s   @r)   r   r       sW    ,\ &J%O '*1 *1r+   r   c                      ^  \ rS rSrSrSrSrSSSSS	S
S
S/ SQSSSSSSS4S\S\S\S\S\S\S\S\S\	\   S\S\
4U 4S jjjrSrU =r$ )JanusVQVAEConfig   a	  
This is the configuration class to store the configuration of a [`JanusVQVAEModel`]. It is used to instantiate a
`JanusVQVAEModel` according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information. Instantiating a
configuration with the defaults will yield a similar configuration to the VQModel of the
[deepseek-community/Janus-Pro-1B](https://huggingface.co/deepseek-community/Janus-Pro-1B).

Args:
    embed_dim (`int`, *optional*, defaults to 8):
        Dimensionality of each embedding vector.
    num_embeddings (`int`, *optional*, defaults to 16384):
        Number of codebook embeddings.
    double_latent (`bool`, *optional*, defaults to `False`):
        Whether to use double z channels.
    latent_channels (`int`, *optional*, defaults to 256):
        Number of channels for the latent space.
    num_patches (`int`, *optional*, defaults to 32):
        Num of patches the input images can be divided into.
    in_channels (`int`, *optional*, defaults to 3):
        Number of input channels.
    out_channels (`int`, *optional*, defaults to 3):
        Number of out channels.
    base_channels (`int`, *optional*, defaults to 128):
        Base channel count.
    channel_multiplier (`List[int]`, *optional*, defaults to `[1, 1, 2, 2, 4]`):
        Channel multipliers for each resolution.
    num_res_blocks (`int`, *optional*, defaults to 2):
        Number of residual blocks.
    dropout (`float`, *optional*, defaults to 0.0):
        Dropout rate.
    initializer_range (`float`, *optional*, defaults to 0.02):
        The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
    projection_dim (`int`, *optional*, defaults to 2048):
        Dimensionality of the MLP projection head.
    num_hidden_layers (`int`, *optional*, defaults to 2):
        Number of hidden layers in VAVAE MLP Connecter module.
    hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
        The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
        `"relu"`, `"silu"` and `"gelu_new"` are supported.
    image_token_embed_dim (`int`, *optional*, defaults to 2048):
        Dimension of image embeddings. It should be same as the dimensionality of text embeddings.
janus_vqgan	vq_config   i @  F   r   r      )   rD   r   r      r   r.   r1   r0   r/   	embed_dimnum_embeddingsdouble_latentlatent_channelsnum_patchesin_channelsout_channelsbase_channelschannel_multipliernum_res_blocksdropoutc                    > [         TU ]  " S0 UD6  Xl        X l        X0l        X@l        X`l        Xl        Xl        Xl	        Xl
        Xl        XPl        Xpl        Xl        Xl        Xl        UU l        g r   )r   r   rF   rG   rH   rI   rK   rM   rN   rO   rP   r#   rJ   rL   r    r   r   image_token_embed_dim)r&   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r#   r    r   r   rR   r'   r(   s                     r)   r   JanusVQVAEConfig.__init__   st    ( 	"6"",*.&*"4,!2&(,!2$%:"r+   )rM   rN   rH   rP   rF   r   rR   rK   r#   rI   rG   r   rJ   rO   rL   r    )r2   r3   r4   r5   r6   r7   r8   intboolr   floatr   r9   r:   r;   s   @r)   r=   r=      s    *X J!O ##" (7"#$;$; $; 	$;
 $; $; $; $; $; !I$; $; $; $;r+   r=   c                   H   ^  \ rS rSrSrSr\\\S.r	    SU 4S jjr
SrU =r$ )JanusConfig   a  
This is the configuration class to store the configuration of a [`JanusModel`]. It is used to instantiate an
Janus 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 Janus-1B or Janus-7B models.

e.g. [deepseek-community/Janus-Pro-1B](https://huggingface.co/deepseek-community/Janus-Pro-1B) or
[deepseek-community/Janus-Pro-7B](https://huggingface.co/deepseek-community/Janus-Pro-7B)

Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.

Args:
    text_config (`Union[AutoConfig, dict]`, *optional*, defaults to `LlamaConfig`):
        The config object or dictionary of the text backbone.
    vision_config (`Union[AutoConfig, dict]`,  *optional*, defaults to `JanusVisionConfig`):
        The config object or dictionary of the vision backbone.
    vq_config (`Union[AutoConfig, dict]`,  *optional*, defaults to `JanusVQVAEConfig`):
        The config object or dictionary of the VQVAE backbone.
    image_token_id (`int`, *optional*, defaults to 100581):
        Token index of a placeholder image token.

Example:

```python
>>> from transformers import JanusForConditionalGeneration, JanusConfig, JanusVisionConfig, JanusVQVAEConfig, LlamaConfig

>>> # Initializing a Janus vision config
>>> vision_config = JanusVisionConfig()

>>> # Initializing a Llama config
>>> text_config = LlamaConfig()

>>> # Initializing a VQ config
>>> vq_config = JanusVQVAEConfig()

>>> # Initializing a Janus Pro 1B style configuration
>>> configuration = JanusConfig(vision_config=vision_config, text_config=text_config, vq_config=vq_config)

>>> # Initializing a model from the Janus Pro 1B style configuration
>>> model = JanusForConditionalGeneration(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```janus)text_configr   r@   c                   > [        U[        5      (       a-  UR                  SS5      US'   [        US      " S	0 UD6U l        O_Uc)  [
        R                  S5        [        S   " 5       U l        O3[        U[        5      (       a  Xl        O[        S[        U5       35      eUc%  [
        R                  S5        [        5       U l        OY[        U[        5      (       a  [        S	0 UD6U l        O3[        U[        5      (       a  X l        O[        S[        U5       35      eUc%  [
        R                  S5        [        5       U l        OY[        U[        5      (       a  [        S	0 UD6U l        O3[        U[        5      (       a  X0l        O[        S[        U5       35      eU R                  R                  U R                  R                  -  U R                  l        X@l        [$        TU ]L  " S	0 UD6  g )
Nr7   llamaz7`text_config` is None. Initializing with default valueszTInvalid type for `text_config`. Must be either `dict` or `LlamaConfig`. Type found: zK`vision_config` is None. Initializing with default JanusVisionConfig valuesz\Invalid type for `vision_config`. Must be either `dict` or `JanusVisionConfig`. Type found: zF`vq_config` is None. Initializing with default JanusVQVAEConfig valueszWInvalid type for `vq_config`. Must be either `dict` or `JanusVQVAEConfig`. Type found: r   )
isinstancedictgetr   r[   loggerinfor   
ValueErrortyper   r   r=   r@   r   r   rJ   image_token_idr   r   )r&   r[   r   r@   re   r'   r(   s         r)   r   JanusConfig.__init__  s    k4(((3g(NK%-k,.GHW;WD KKQR-g68D%566*  $[ 124 
  KKef!2!4Dt,,!2!C]!CD'899!.  $] 346 
 KK`a-/DN	4((-:	:DN	#344&N  $Y02  &*%7%7%B%BdFXFXFcFc%c","6"r+   )re   r[   r   r@   )NNNi )r2   r3   r4   r5   r6   r7   r	   r   r=   sub_configsr   r9   r:   r;   s   @r)   rX   rX      s8    +Z J!*%K 5# 5#r+   rX   )r=   r   rX   N)typingr   configuration_utilsr   utilsr   autor   r	   
get_loggerr2   ra   r   r=   rX   __all__r   r+   r)   <module>rn      s]   ,  3  - 
		H	%\1( \1~T;' T;nj#" j#Z Cr+   