Ë
    S^(hæ  ã                   ón  — d Z ddlZddlZddlmZ ddlmZmZmZ ddl	Z	ddl
Z	ddl	mZ ddlmZmZmZ ddlmZmZ dd	lmZmZmZmZmZmZ dd
lmZmZ ddlmZmZm Z  ddl!m"Z"m#Z#m$Z$m%Z% ddl&m'Z'  e%jP                  e)«      Z*dZ+dZ,d„ Z- G d„ dej\                  «      Z/ G d„ de«      Z0 G d„ dej\                  «      Z1 G d„ dej\                  «      Z2 G d„ dej\                  «      Z3 G d„ dej\                  «      Z4 G d„ dej\                  «      Z5 G d „ d!ej\                  «      Z6 G d"„ d#ej\                  «      Z7 G d$„ d%ej\                  «      Z8 G d&„ d'ej\                  «      Z9 G d(„ d)ej\                  «      Z:d*Z;d+Z< e#d,e;«       G d-„ d.e0«      «       Z= G d/„ d0ej\                  «      Z> e#d1e;«       G d2„ d3e0«      «       Z? G d4„ d5ej\                  «      Z@ e#d6e;«       G d7„ d8e0«      «       ZA e#d9e;«       G d:„ d;e0«      «       ZB e#d<e;«       G d=„ d>e0«      «       ZC e#d?e;«       G d@„ dAe0«      «       ZDg dB¢ZEy)CzPyTorch ConvBERT model.é    N)Ú
attrgetter)ÚOptionalÚTupleÚUnion)Únn)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELossé   )ÚACT2FNÚget_activation)Ú"BaseModelOutputWithCrossAttentionsÚMaskedLMOutputÚMultipleChoiceModelOutputÚQuestionAnsweringModelOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚPreTrainedModelÚSequenceSummary)Úapply_chunking_to_forwardÚ find_pruneable_heads_and_indicesÚprune_linear_layer)Úadd_code_sample_docstringsÚadd_start_docstringsÚ%add_start_docstrings_to_model_forwardÚloggingé   )ÚConvBertConfigzYituTech/conv-bert-baser   c                 óœ  — 	 ddl }t        j
                  j                  |«      }t        j                  d|› �«       |j                  j                  |«      }i }|D ]A  \  }}t        j                  d|› d|› �«       |j                  j                  ||«      }	|	||<   ŒC ddd	d
ddddœ}
|j                  dkD  rd}nd}t        |j                  «      D �]:  }d|› d�|
d|› d�<   d|› d�|
d|› d�<   d|› d�|
d|› d�<   d|› d�|
d|› d�<   d|› d�|
d|› d�<   d|› d�|
d|› d�<   d|› d �|
d|› d!�<   d|› d"�|
d|› d#�<   d|› d$�|
d|› d%�<   d|› d&�|
d|› d'�<   d|› d(�|
d|› d)�<   d|› d*�|
d|› d+�<   d|› d,�|
d|› d-�<   d|› d.�|
d|› d/�<   d|› d0�|
d|› d1�<   d|› d2�|
d|› d3�<   d|› d4�|
d|› d5�<   d|› d6|› d7�|
d|› d8�<   d|› d6|› d9�|
d|› d:�<   d|› d;|› d7�|
d|› d<�<   d|› d;|› d9�|
d|› d=�<   d|› d>�|
d|› d?�<   d|› d@�|
d|› dA�<   �Œ= | j                  «       D �]  }|d   }t        |«      } || «      }|
|   }t!        j"                  ||   «      }t        j                  dB|› dC|› dD�«       |j%                  d7«      r.|j%                  dE«      s|j%                  dF«      s|j&                  }|j%                  dG«      r|j)                  ddHd«      }|j%                  dI«      r|j)                  dHdd«      }|j%                  dJ«      r|j+                  dK«      }||_        �Œ | S # t        $ r t        j                  d«       ‚ w xY w)Lz'Load tf checkpoints in a pytorch model.r   Nz™Loading a TensorFlow model in PyTorch, requires TensorFlow to be installed. Please see https://www.tensorflow.org/install/ for installation instructions.z&Converting TensorFlow checkpoint from zLoading TF weight z with shape z"electra/embeddings/word_embeddingsz&electra/embeddings/position_embeddingsz(electra/embeddings/token_type_embeddingsz"electra/embeddings/LayerNorm/gammaz!electra/embeddings/LayerNorm/betaz!electra/embeddings_project/kernelzelectra/embeddings_project/bias)z!embeddings.word_embeddings.weightz%embeddings.position_embeddings.weightz'embeddings.token_type_embeddings.weightzembeddings.LayerNorm.weightzembeddings.LayerNorm.biaszembeddings_project.weightzembeddings_project.biasr   Úg_denseÚdensezelectra/encoder/layer_z/attention/self/query/kernelzencoder.layer.z.attention.self.query.weightz/attention/self/query/biasz.attention.self.query.biasz/attention/self/key/kernelz.attention.self.key.weightz/attention/self/key/biasz.attention.self.key.biasz/attention/self/value/kernelz.attention.self.value.weightz/attention/self/value/biasz.attention.self.value.biasz./attention/self/conv_attn_key/depthwise_kernelz4.attention.self.key_conv_attn_layer.depthwise.weightz./attention/self/conv_attn_key/pointwise_kernelz4.attention.self.key_conv_attn_layer.pointwise.weightz"/attention/self/conv_attn_key/biasz(.attention.self.key_conv_attn_layer.biasz'/attention/self/conv_attn_kernel/kernelz(.attention.self.conv_kernel_layer.weightz%/attention/self/conv_attn_kernel/biasz&.attention.self.conv_kernel_layer.biasz&/attention/self/conv_attn_point/kernelz%.attention.self.conv_out_layer.weightz$/attention/self/conv_attn_point/biasz#.attention.self.conv_out_layer.biasz/attention/output/dense/kernelz.attention.output.dense.weightz!/attention/output/LayerNorm/gammaz".attention.output.LayerNorm.weightz/attention/output/dense/biasz.attention.output.dense.biasz /attention/output/LayerNorm/betaz .attention.output.LayerNorm.biasz/intermediate/z/kernelz.intermediate.dense.weightz/biasz.intermediate.dense.biasz/output/z.output.dense.weightz.output.dense.biasz/output/LayerNorm/gammaz.output.LayerNorm.weightz/output/LayerNorm/betaz.output.LayerNorm.biaszTF: z, PT: ú z/intermediate/g_dense/kernelz/output/g_dense/kernelz/depthwise_kernelé   z/pointwise_kernelz/conv_attn_key/biaséÿÿÿÿ)Ú
tensorflowÚImportErrorÚloggerÚerrorÚosÚpathÚabspathÚinfoÚtrainÚlist_variablesÚload_variableÚ
num_groupsÚrangeÚnum_hidden_layersÚnamed_parametersr   ÚtorchÚ
from_numpyÚendswithÚTÚpermuteÚ	unsqueezeÚdata)ÚmodelÚconfigÚtf_checkpoint_pathÚtfÚtf_pathÚ	init_varsÚtf_dataÚnameÚshapeÚarrayÚparam_mappingÚgroup_dense_nameÚjÚparamÚ
param_nameÚ	retrieverÚresultÚtf_nameÚvalues                      úl/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/convbert/modeling_convbert.pyÚload_tf_weights_in_convbertrO   0   so  € ðÛô �g‰g�o‰oÐ0Ó1€GÜ
‡K�KÐ8¸¸	ÐBÔCà—‘×'Ñ'¨Ó0€IØ€GØ ò ‰ˆˆeÜ�‰Ð(¨¨¨l¸5¸'ÐBÔCØ—‘×&Ñ& w°Ó5ˆØˆ�Šðð .RØ1YØ3]Ø'KØ%HØ%HØ#Dñ€Mð ×Ñ˜1ÒØ$Ñà"Ðä�6×+Ñ+Ó,ó Cwˆà$ Q CÐ'CÐDð 	˜ q cÐ)EÐFÑGð % Q CÐ'AÐBð 	˜ q cÐ)CÐDÑEð % Q CÐ'AÐBð 	˜ q cÐ)CÐDÑEð % Q CÐ'?Ð@ð 	˜ q cÐ)AÐBÑCð % Q CÐ'CÐDð 	˜ q cÐ)EÐFÑGð % Q CÐ'AÐBð 	˜ q cÐ)CÐDÑEð % Q CÐ'UÐVð 	˜ q cÐ)]Ð^Ñ_ð % Q CÐ'UÐVð 	˜ q cÐ)]Ð^Ñ_ð % Q CÐ'IÐJð 	˜ q cÐ)QÐRÑSð % Q CÐ'NÐOð 	˜ q cÐ)QÐRÑSð % Q CÐ'LÐMð 	˜ q cÐ)OÐPÑQð % Q CÐ'MÐNð 	˜ q cÐ)NÐOÑPð % Q CÐ'KÐLð 	˜ q cÐ)LÐMÑNð % Q CÐ'EÐFð 	˜ q cÐ)GÐHÑIð % Q CÐ'HÐIð 	˜ q cÐ)KÐLÑMð % Q CÐ'CÐDð 	˜ q cÐ)EÐFÑGð % Q CÐ'GÐHð 	˜ q cÐ)IÐJÑKð % Q C ~Ð6FÐ5GÀwÐOð 	˜ q cÐ)CÐDÑEð % Q C ~Ð6FÐ5GÀuÐMð 	˜ q cÐ)AÐBÑCð % Q C xÐ0@Ð/AÀÐIð 	˜ q cÐ)=Ð>Ñ?ð % Q C xÐ0@Ð/AÀÐGð 	˜ q cÐ);Ð<Ñ=ð % Q CÐ'>Ð?ð 	˜ q cÐ)AÐBÑCð G]Ð]^Ð\_Ð_uÐDvˆ˜ q cÐ)?Ð@ÓAðGCwðJ ×'Ñ'Ó)ó ˆØ˜1‘Xˆ
Ü˜zÓ*ˆ	Ù˜5Ó!ˆØ 
Ñ+ˆÜ× Ñ  ¨Ñ!1Ó2ˆÜ�‰�d˜7˜) 6¨*¨°QÐ7Ô8Ø×Ñ˜IÔ&Ø×#Ñ#Ð$BÔCØ×'Ñ'Ð(@ÔAØ!ŸG™G�EØ×ÑÐ/Ô0Ø—M‘M ! Q¨Ó*ˆEØ×ÑÐ/Ô0Ø—M‘M ! Q¨Ó*ˆEØ×ÑÐ1Ô2Ø—O‘O BÓ'ˆEØˆŽð#ð$ €Løôk ò Ü�‰ðQô	
ð 	ðús   ‚L+ Ì+ Mc                   óÄ   ‡ — e Zd ZdZˆ fd„Z	 	 	 	 d	deej                     deej                     deej                     deej                     dej                  f
d„Z	ˆ xZ
S )
ÚConvBertEmbeddingszGConstruct the embeddings from word, position and token_type embeddings.c                 ó  •— t         ‰| �  «        t        j                  |j                  |j
                  |j                  ¬«      | _        t        j                  |j                  |j
                  «      | _	        t        j                  |j                  |j
                  «      | _        t        j                  |j
                  |j                  ¬«      | _        t        j                  |j                  «      | _        | j#                  dt%        j&                  |j                  «      j)                  d«      d¬«       | j#                  dt%        j*                  | j,                  j/                  «       t$        j0                  ¬«      d¬«       y )	N)Úpadding_idx©ÚepsÚposition_ids)r   r$   F)Ú
persistentÚtoken_type_ids)Údtype)ÚsuperÚ__init__r   Ú	EmbeddingÚ
vocab_sizeÚembedding_sizeÚpad_token_idÚword_embeddingsÚmax_position_embeddingsÚposition_embeddingsÚtype_vocab_sizeÚtoken_type_embeddingsÚ	LayerNormÚlayer_norm_epsÚDropoutÚhidden_dropout_probÚdropoutÚregister_bufferr4   ÚarangeÚexpandÚzerosrV   ÚsizeÚlong©Úselfr<   Ú	__class__s     €rN   r[   zConvBertEmbeddings.__init__¯   s  ø€ Ü‰ÑÔÜ!Ÿ|™|¨F×,=Ñ,=¸v×?TÑ?TÐbh×buÑbuÔvˆÔÜ#%§<¡<°×0NÑ0NÐPV×PeÑPeÓ#fˆÔ Ü%'§\¡\°&×2HÑ2HÈ&×J_ÑJ_Ó%`ˆÔ"ô Ÿ™ f×&;Ñ&;À×AVÑAVÔWˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒà×ÑØœEŸL™L¨×)GÑ)GÓH×OÑOÐPWÓXÐejð 	ô 	
ð 	×ÑØœeŸk™k¨$×*;Ñ*;×*@Ñ*@Ó*BÌ%Ï*É*ÔUÐbgð 	õ 	
ó    Ú	input_idsrX   rV   Úinputs_embedsÚreturnc                 ó2  — |�|j                  «       }n|j                  «       d d }|d   }|€| j                  d d …d |…f   }|€st        | d«      r-| j                  d d …d |…f   }|j	                  |d   |«      }|}n:t        j                  |t
        j                  | j                  j                  ¬«      }|€| j                  |«      }| j                  |«      }	| j                  |«      }
||	z   |
z   }| j                  |«      }| j                  |«      }|S )Nr$   r   rX   r   ©rY   Údevice)rn   rV   ÚhasattrrX   rl   r4   rm   ro   ry   r`   rb   rd   re   ri   )rq   rt   rX   rV   ru   Úinput_shapeÚ
seq_lengthÚbuffered_token_type_idsÚ buffered_token_type_ids_expandedrb   rd   Ú
embeddingss               rN   ÚforwardzConvBertEmbeddings.forwardÁ   s,  € ð Ð Ø#Ÿ.™.Ó*‰Kà'×,Ñ,Ó.¨s°Ð3ˆKà  ‘^ˆ
àÐØ×,Ñ,ªQ°°°¨^Ñ<ˆLð
 Ð!Ü�tÐ-Ô.Ø*.×*=Ñ*=ºaÀÀ*À¸nÑ*MÐ'Ø3J×3QÑ3QÐR]Ð^_ÑR`ÐblÓ3mÐ0Ø!A‘ä!&§¡¨[ÄÇ
Á
ÐSW×SdÑSd×SkÑSkÔ!l�àÐ Ø ×0Ñ0°Ó;ˆMØ"×6Ñ6°|ÓDÐØ $× :Ñ :¸>Ó JÐà"Ð%8Ñ8Ð;PÑPˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
ØÐrs   )NNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r[   r   r4   Ú
LongTensorÚFloatTensorr€   Ú__classcell__©rr   s   @rN   rQ   rQ   ¬   s€   ø„ ÙQô
ð( 15Ø59Ø37Ø59ñ$à˜E×,Ñ,Ñ-ð$ð ! ×!1Ñ!1Ñ2ð$ð ˜u×/Ñ/Ñ0ð	$ð
   × 1Ñ 1Ñ2ð$ð 
×	Ñ	÷$rs   rQ   c                   ó&   — e Zd ZdZeZeZdZdZ	d„ Z
y)ÚConvBertPreTrainedModelz†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    ÚconvbertTc                 ól  — t        |t        j                  t        j                  f«      rm|j                  j
                  j                  d| j                  j                  ¬«       |j                  �%|j                  j
                  j                  «        yyt        |t        j                  «      rz|j                  j
                  j                  d| j                  j                  ¬«       |j                  �2|j                  j
                  |j                     j                  «        yyt        |t        j                  «      rJ|j                  j
                  j                  «        |j                  j
                  j                  d«       yt        |t        «      r%|j                  j
                  j                  «        yt        |t         «      r`|j                  j
                  j                  d| j                  j                  ¬«       |j                  j
                  j                  «        yy)zInitialize the weightsç        ©ÚmeanÚstdNg      ð?)Ú
isinstancer   ÚLinearÚConv1dÚweightr:   Únormal_r<   Úinitializer_rangeÚbiasÚzero_r\   rS   re   Úfill_ÚSeparableConv1DÚGroupedLinearLayer)rq   Úmodules     rN   Ú_init_weightsz%ConvBertPreTrainedModel._init_weightsó   sw  € ä�fœrŸy™y¬"¯)©)Ð4Ô5ð �M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSØ�{‰{Ð&Ø—‘× Ñ ×&Ñ&Õ(ð 'ä˜¤§¡Ô-Ø�M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSØ×!Ñ!Ð-Ø—‘×"Ñ" 6×#5Ñ#5Ñ6×<Ñ<Õ>ð .ä˜¤§¡Ô-Ø�K‰K×Ñ×"Ñ"Ô$Ø�M‰M×Ñ×$Ñ$ SÕ)Ü˜¤Ô0Ø�K‰K×Ñ×"Ñ"Õ$Ü˜Ô 2Ô3Ø�M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSØ�K‰K×Ñ×"Ñ"Õ$ð 4rs   N)r�   r‚   rƒ   r„   r   Úconfig_classrO   Úload_tf_weightsÚbase_model_prefixÚsupports_gradient_checkpointingr�   © rs   rN   rŠ   rŠ   è   s$   „ ñð
 "€LØ1€OØ"ÐØ&*Ð#ó%rs   rŠ   c                   óZ   ‡ — e Zd ZdZˆ fd„Zdej                  dej                  fd„Zˆ xZS )rš   zSThis class implements separable convolution, i.e. a depthwise and a pointwise layerc                 óì  •— t         ‰| �  «        t        j                  |||||dz  d¬«      | _        t        j                  ||dd¬«      | _        t        j                  t        j                  |d«      «      | _	        | j                  j                  j                  j                  d|j                  ¬«       | j
                  j                  j                  j                  d|j                  ¬«       y )Nr#   F)Úkernel_sizeÚgroupsÚpaddingr—   r   )r¥   r—   r�   rŽ   )rZ   r[   r   r“   Ú	depthwiseÚ	pointwiseÚ	Parameterr4   rm   r—   r”   r:   r•   r–   )rq   r<   Úinput_filtersÚoutput_filtersr¥   Úkwargsrr   s         €rN   r[   zSeparableConv1D.__init__  s»   ø€ Ü‰ÑÔÜŸ™ØØØ#Ø Ø 1Ñ$Øô
ˆŒô Ÿ™ =°.ÈaÐV[Ô\ˆŒÜ—L‘L¤§¡¨^¸QÓ!?Ó@ˆŒ	à�‰×Ñ×"Ñ"×*Ñ*°¸×9QÑ9QÐ*ÔRØ�‰×Ñ×"Ñ"×*Ñ*°¸×9QÑ9QÐ*ÕRrs   Úhidden_statesrv   c                 óh   — | j                  |«      }| j                  |«      }|| j                  z  }|S ©N)r¨   r©   r—   )rq   r®   Úxs      rN   r€   zSeparableConv1D.forward  s0   € Ø�N‰N˜=Ó)ˆØ�N‰N˜1ÓˆØ	ˆT�Y‰Y‰ˆØˆrs   ©	r�   r‚   rƒ   r„   r[   r4   ÚTensorr€   r‡   rˆ   s   @rN   rš   rš   	  s'   ø„ Ù]ôSð  U§\¡\ð °e·l±l÷ rs   rš   c                   óî   ‡ — e Zd Zˆ fd„Zd„ Z	 	 	 	 d
dej                  deej                     deej                     deej                     dee	   de
ej                  eej                     f   fd	„Zˆ xZS )ÚConvBertSelfAttentionc                 ój  •— t         ‰| �  «        |j                  |j                  z  dk7  r2t	        |d«      s&t        d|j                  › d|j                  › d�«      ‚|j                  |j                  z  }|dk  r|j                  | _        d| _        n|| _        |j                  | _        |j                  | _        |j                  | j                  z  dk7  rt        d«      ‚|j                  | j                  z  dz  | _        | j                  | j                  z  | _	        t        j                  |j                  | j                  «      | _        t        j                  |j                  | j                  «      | _        t        j                  |j                  | j                  «      | _        t        ||j                  | j                  | j                  «      | _        t        j                  | j                  | j                  | j                  z  «      | _        t        j                  |j                  | j                  «      | _        t        j&                  | j                  dgt)        | j                  dz
  dz  «      dg¬	«      | _        t        j,                  |j.                  «      | _        y )
Nr   r^   zThe hidden size (z6) is not a multiple of the number of attention heads (ú)r   z6hidden_size should be divisible by num_attention_headsr#   )r¥   r§   )rZ   r[   Úhidden_sizeÚnum_attention_headsrz   Ú
ValueErrorÚ
head_ratioÚconv_kernel_sizeÚattention_head_sizeÚall_head_sizer   r’   ÚqueryÚkeyrM   rš   Úkey_conv_attn_layerÚconv_kernel_layerÚconv_out_layerÚUnfoldÚintÚunfoldrg   Úattention_probs_dropout_probri   )rq   r<   Únew_num_attention_headsrr   s      €rN   r[   zConvBertSelfAttention.__init__$  s>  ø€ Ü‰ÑÔØ×Ñ × :Ñ :Ñ:¸aÒ?ÌÐPVÐXhÔHiÜØ# F×$6Ñ$6Ð#7ð 8Ø ×4Ñ4Ð5°Qð8óð ð
 #)×"<Ñ"<À×@QÑ@QÑ"QÐØ" QÒ&Ø$×8Ñ8ˆDŒOØ'(ˆDÕ$à'>ˆDÔ$Ø$×/Ñ/ˆDŒOà &× 7Ñ 7ˆÔØ×Ñ × 8Ñ 8Ñ8¸AÒ=ÜÐUÓVÐVà$*×$6Ñ$6¸$×:RÑ:RÑ$RÐWXÑ#XˆÔ Ø!×5Ñ5¸×8PÑ8PÑPˆÔä—Y‘Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
Ü—9‘9˜V×/Ñ/°×1CÑ1CÓDˆŒÜ—Y‘Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
ä#2Ø�F×&Ñ&¨×(:Ñ(:¸D×<QÑ<Qó$
ˆÔ ô "$§¡¨4×+=Ñ+=¸t×?WÑ?WÐZ^×ZoÑZoÑ?oÓ!pˆÔÜ Ÿi™i¨×(:Ñ(:¸D×<NÑ<NÓOˆÔä—i‘iØ×.Ñ.°Ð2¼SÀ$×BWÑBWÐZ[ÑB[Ð_`ÑA`Ó=aÐcdÐ<eô
ˆŒô —z‘z &×"EÑ"EÓFˆ�rs   c                 ó    — |j                  «       d d | j                  | j                  fz   } |j                  |Ž }|j	                  dddd«      S )Nr$   r   r#   r   r   )rn   r¹   r½   Úviewr8   )rq   r±   Únew_x_shapes      rN   Útranspose_for_scoresz*ConvBertSelfAttention.transpose_for_scoresK  sN   € Ø—f‘f“h˜s �m t×'?Ñ'?À×AYÑAYÐ&ZÑZˆØˆA�F‰F�KÐ ˆØ�y‰y˜˜A˜q !Ó$Ð$rs   r®   Úattention_maskÚ	head_maskÚencoder_hidden_statesÚoutput_attentionsrv   c                 óŒ  — | j                  |«      }|j                  d«      }|�#| j                  |«      }| j                  |«      }	n"| j                  |«      }| j                  |«      }	| j	                  |j                  dd«      «      }
|
j                  dd«      }
| j                  |«      }| j                  |«      }| j                  |	«      }t        j                  |
|«      }| j                  |«      }t        j                  |d| j                  dg«      }t        j                  |d¬«      }| j                  |«      }t        j                  ||d| j                  g«      }|j                  dd«      j                  «       j!                  d«      }t"        j$                  j'                  || j                  dgd| j                  dz
  dz  dgd¬«      }|j                  dd«      j                  |d| j                  | j                  «      }t        j                  |d| j(                  | j                  g«      }t        j*                  ||«      }t        j                  |d| j                  g«      }t        j*                  ||j                  dd«      «      }|t-        j.                  | j(                  «      z  }|�||z   }t"        j$                  j                  |d¬«      }| j1                  |«      }|�||z  }t        j*                  ||«      }|j3                  dddd«      j                  «       }t        j                  ||d| j4                  | j(                  g«      }t        j6                  ||gd«      }|j                  «       d d | j4                  | j(                  z  dz  fz   } |j8                  |Ž }|r||f}|S |f}|S )	Nr   r   r#   r$   ©Údim)r¥   Údilationr§   Ústrideéþÿÿÿr   )r¿   rn   rÀ   rM   rÁ   Ú	transposerÌ   r4   ÚmultiplyrÂ   Úreshaper¼   ÚsoftmaxrÃ   r¾   Ú
contiguousr9   r   Ú
functionalrÆ   r½   ÚmatmulÚmathÚsqrtri   r8   r¹   ÚcatrÊ   )rq   r®   rÍ   rÎ   rÏ   rÐ   Úmixed_query_layerÚ
batch_sizeÚmixed_key_layerÚmixed_value_layerÚmixed_key_conv_attn_layerÚquery_layerÚ	key_layerÚvalue_layerÚconv_attn_layerrÂ   rÃ   Úattention_scoresÚattention_probsÚcontext_layerÚconv_outÚnew_context_layer_shapeÚoutputss                          rN   r€   zConvBertSelfAttention.forwardP  s§  € ð !ŸJ™J }Ó5ÐØ"×'Ñ'¨Ó*ˆ
ð !Ð,Ø"Ÿh™hÐ'<Ó=ˆOØ $§
¡
Ð+@Ó AÑà"Ÿh™h }Ó5ˆOØ $§
¡
¨=Ó 9Ðà$(×$<Ñ$<¸]×=TÑ=TÐUVÐXYÓ=ZÓ$[Ð!Ø$=×$GÑ$GÈÈ1Ó$MÐ!à×/Ñ/Ð0AÓBˆØ×-Ñ-¨oÓ>ˆ	Ø×/Ñ/Ð0AÓBˆÜŸ.™.Ð)BÐDUÓVˆà ×2Ñ2°?ÓCÐÜ!ŸM™MÐ*;¸bÀ$×BWÑBWÐYZÐ=[Ó\ÐÜ!ŸM™MÐ*;ÀÔCÐà×,Ñ,¨]Ó;ˆÜŸ™ ~¸
ÀBÈ×HZÑHZÐ7[Ó\ˆØ'×1Ñ1°!°QÓ7×BÑBÓD×NÑNÈrÓRˆÜŸ™×-Ñ-ØØ×.Ñ.°Ð2ØØ×+Ñ+¨aÑ/°AÑ5°qÐ9Øð .ó 
ˆð (×1Ñ1°!°QÓ7×?Ñ?Ø˜˜D×.Ñ.°×0EÑ0Eó
ˆô Ÿ™ ~¸¸D×<TÑ<TÐVZ×VkÑVkÐ7lÓmˆÜŸ™ nÐ6GÓHˆÜŸ™ ~¸¸D×<NÑ<NÐ7OÓPˆô !Ÿ<™<¨°Y×5HÑ5HÈÈRÓ5PÓQÐØ+¬d¯i©i¸×8PÑ8PÓ.QÑQÐØÐ%à/°.Ñ@Ðô Ÿ-™-×/Ñ/Ð0@ÀbÐ/ÓIˆð Ÿ,™, Ó7ˆð Ð Ø-°	Ñ9ˆOäŸ™ _°kÓBˆØ%×-Ñ-¨a°°A°qÓ9×DÑDÓFˆä—=‘= °*¸bÀ$×BZÑBZÐ\`×\tÑ\tÐ1uÓvˆÜŸ	™	 =°(Ð";¸QÓ?ˆð #0×"4Ñ"4Ó"6°s¸Ð";Ø×$Ñ$ t×'?Ñ'?Ñ?À!ÑCð?
ñ #
Ðð +˜×*Ñ*Ð,CÐDˆá6G�= /Ð2ˆØˆð O\ÐM]ˆØˆrs   ©NNNF)r�   r‚   rƒ   r[   rÌ   r4   r³   r   r†   Úboolr   r€   r‡   rˆ   s   @rN   rµ   rµ   #  s¡   ø„ ô%GòN%ð 7;Ø15Ø8<Ø,1ñPà—|‘|ðPð ! ×!2Ñ!2Ñ3ðPð ˜E×-Ñ-Ñ.ð	Pð
  (¨¯©Ñ5ðPð $ D™>ðPð 
ˆu�|‰|˜X e§l¡lÑ3Ð3Ñ	4÷Prs   rµ   c                   ón   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  dej
                  fd„Zˆ xZS )ÚConvBertSelfOutputc                 ó(  •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        t        j                  |j                  |j                  ¬«      | _        t        j                  |j                  «      | _
        y ©NrT   )rZ   r[   r   r’   r¸   r!   re   rf   rg   rh   ri   rp   s     €rN   r[   zConvBertSelfOutput.__init__¤  s`   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸ™ f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z‘z &×"<Ñ"<Ó=ˆ�rs   r®   Úinput_tensorrv   c                 ór   — | j                  |«      }| j                  |«      }| j                  ||z   «      }|S r°   ©r!   ri   re   ©rq   r®   rö   s      rN   r€   zConvBertSelfOutput.forwardª  ó7   € ØŸ
™
 =Ó1ˆØŸ™ ]Ó3ˆØŸ™ }°|Ñ'CÓDˆØÐrs   ©r�   r‚   rƒ   r[   r4   r³   r€   r‡   rˆ   s   @rN   ró   ró   £  s1   ø„ ô>ð U§\¡\ð ÀÇÁð ÐRW×R^ÑR^÷ rs   ró   c                   óî   ‡ — e Zd Zˆ fd„Zd„ Z	 	 	 	 d
dej                  deej                     deej                     deej                     dee	   de
ej                  eej                     f   fd	„Zˆ xZS )ÚConvBertAttentionc                 ó€   •— t         ‰| �  «        t        |«      | _        t	        |«      | _        t        «       | _        y r°   )rZ   r[   rµ   rq   ró   ÚoutputÚsetÚpruned_headsrp   s     €rN   r[   zConvBertAttention.__init__²  s0   ø€ Ü‰ÑÔÜ)¨&Ó1ˆŒ	Ü(¨Ó0ˆŒÜ›EˆÕrs   c                 ó>  — t        |«      dk(  ry t        || j                  j                  | j                  j                  | j
                  «      \  }}t        | j                  j                  |«      | j                  _        t        | j                  j                  |«      | j                  _        t        | j                  j                  |«      | j                  _	        t        | j                  j                  |d¬«      | j                  _        | j                  j                  t        |«      z
  | j                  _        | j                  j                  | j                  j                  z  | j                  _        | j
                  j                  |«      | _        y )Nr   r   rÒ   )Úlenr   rq   r¹   r½   r  r   r¿   rÀ   rM   rÿ   r!   r¾   Úunion)rq   ÚheadsÚindexs      rN   Úprune_headszConvBertAttention.prune_heads¸  s  € Üˆu‹:˜Š?ØÜ7Ø�4—9‘9×0Ñ0°$·)±)×2OÑ2OÐQU×QbÑQbó
‰ˆˆuô
 -¨T¯Y©Y¯_©_¸eÓDˆ�	‰	ŒÜ*¨4¯9©9¯=©=¸%Ó@ˆ�	‰	ŒÜ,¨T¯Y©Y¯_©_¸eÓDˆ�	‰	ŒÜ.¨t¯{©{×/@Ñ/@À%ÈQÔOˆ�‰Ôð )-¯	©	×(EÑ(EÌÈEË
Ñ(Rˆ�	‰	Ô%Ø"&§)¡)×"?Ñ"?À$Ç)Á)×B_ÑB_Ñ"_ˆ�	‰	ÔØ ×-Ñ-×3Ñ3°EÓ:ˆÕrs   r®   rÍ   rÎ   rÏ   rÐ   rv   c                 ól   — | j                  |||||«      }| j                  |d   |«      }|f|dd  z   }|S )Nr   r   )rq   rÿ   )	rq   r®   rÍ   rÎ   rÏ   rÐ   Úself_outputsÚattention_outputrï   s	            rN   r€   zConvBertAttention.forwardÊ  sQ   € ð —y‘yØØØØ!Øó
ˆð  Ÿ;™; |°A¡¸ÓFÐØ#Ð%¨°Q°RÐ(8Ñ8ˆØˆrs   rð   )r�   r‚   rƒ   r[   r  r4   r³   r   r†   rñ   r   r€   r‡   rˆ   s   @rN   rý   rý   ±  sš   ø„ ô"ò;ð* 7;Ø15Ø8<Ø,1ñà—|‘|ðð ! ×!2Ñ!2Ñ3ðð ˜E×-Ñ-Ñ.ð	ð
  (¨¯©Ñ5ðð $ D™>ðð 
ˆu�|‰|˜X e×&7Ñ&7Ñ8Ð8Ñ	9÷rs   rý   c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )r›   c                 ó¸  •— t         ‰| �  «        || _        || _        || _        | j                  | j                  z  | _        | j                  | j                  z  | _        t        j                  t        j                  | j                  | j
                  | j                  «      «      | _        t        j                  t        j                  |«      «      | _        y r°   )rZ   r[   Ú
input_sizeÚoutput_sizer0   Úgroup_in_dimÚgroup_out_dimr   rª   r4   Úemptyr”   r—   )rq   r  r  r0   rr   s       €rN   r[   zGroupedLinearLayer.__init__ß  s—   ø€ Ü‰ÑÔØ$ˆŒØ&ˆÔØ$ˆŒØ ŸO™O¨t¯©Ñ>ˆÔØ!×-Ñ-°·±Ñ@ˆÔÜ—l‘l¤5§;¡;¨t¯©À×@QÑ@QÐSW×SeÑSeÓ#fÓgˆŒÜ—L‘L¤§¡¨[Ó!9Ó:ˆ�	rs   r®   rv   c                 óˆ  — t        |j                  «       «      d   }t        j                  |d| j                  | j
                  g«      }|j                  ddd«      }t        j                  || j                  «      }|j                  ddd«      }t        j                  ||d| j                  g«      }|| j                  z   }|S )Nr   r$   r   r#   )Úlistrn   r4   rÙ   r0   r  r8   rÝ   r”   r  r—   )rq   r®   râ   r±   s       rN   r€   zGroupedLinearLayer.forwardé  s¢   € Ü˜-×,Ñ,Ó.Ó/°Ñ2ˆ
Ü�M‰M˜-¨"¨d¯o©o¸t×?PÑ?PÐ)QÓRˆØ�I‰I�a˜˜AÓˆÜ�L‰L˜˜DŸK™KÓ(ˆØ�I‰I�a˜˜AÓˆÜ�M‰M˜!˜j¨"¨d×.>Ñ.>Ð?Ó@ˆØ�—	‘	‰MˆØˆrs   rû   rˆ   s   @rN   r›   r›   Þ  s#   ø„ ô;ð U§\¡\ð °e·l±l÷ rs   r›   c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚConvBertIntermediatec                 óŠ  •— t         ‰| �  «        |j                  dk(  r0t        j                  |j
                  |j                  «      | _        n1t        |j
                  |j                  |j                  ¬«      | _        t        |j                  t        «      rt        |j                     | _        y |j                  | _        y )Nr   ©r  r  r0   )rZ   r[   r0   r   r’   r¸   Úintermediate_sizer!   r›   r‘   Ú
hidden_actÚstrr   Úintermediate_act_fnrp   s     €rN   r[   zConvBertIntermediate.__init__õ  s“   ø€ Ü‰ÑÔØ×Ñ Ò!ÜŸ™ 6×#5Ñ#5°v×7OÑ7OÓPˆD�Jä+Ø!×-Ñ-¸6×;SÑ;SÐ`f×`qÑ`qôˆDŒJô �f×'Ñ'¬Ô-Ü'-¨f×.?Ñ.?Ñ'@ˆDÕ$à'-×'8Ñ'8ˆDÕ$rs   r®   rv   c                 óJ   — | j                  |«      }| j                  |«      }|S r°   )r!   r  ©rq   r®   s     rN   r€   zConvBertIntermediate.forward  s&   € ØŸ
™
 =Ó1ˆØ×0Ñ0°Ó?ˆØÐrs   rû   rˆ   s   @rN   r  r  ô  s#   ø„ ô9ð U§\¡\ð °e·l±l÷ rs   r  c                   ón   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  dej
                  fd„Zˆ xZS )ÚConvBertOutputc                 óª  •— t         ‰| �  «        |j                  dk(  r0t        j                  |j
                  |j                  «      | _        n1t        |j
                  |j                  |j                  ¬«      | _        t        j                  |j                  |j                  ¬«      | _	        t        j                  |j                  «      | _        y )Nr   r  rT   )rZ   r[   r0   r   r’   r  r¸   r!   r›   re   rf   rg   rh   ri   rp   s     €rN   r[   zConvBertOutput.__init__	  s–   ø€ Ü‰ÑÔØ×Ñ Ò!ÜŸ™ 6×#;Ñ#;¸V×=OÑ=OÓPˆD�Jä+Ø!×3Ñ3À×ASÑASÐ`f×`qÑ`qôˆDŒJô Ÿ™ f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z‘z &×"<Ñ"<Ó=ˆ�rs   r®   rö   rv   c                 ór   — | j                  |«      }| j                  |«      }| j                  ||z   «      }|S r°   rø   rù   s      rN   r€   zConvBertOutput.forward  rú   rs   rû   rˆ   s   @rN   r  r    s1   ø„ ô	>ð U§\¡\ð ÀÇÁð ÐRW×R^ÑR^÷ rs   r  c                   ó  ‡ — e Zd Zˆ fd„Z	 	 	 	 	 ddej
                  deej                     deej                     deej
                     deej
                     dee   de	ej
                  eej                     f   fd	„Z
d
„ Zˆ xZS )ÚConvBertLayerc                 ób  •— t         ‰| �  «        |j                  | _        d| _        t	        |«      | _        |j                  | _        |j                  | _        | j                  r*| j                  st        | › d�«      ‚t	        |«      | _	        t        |«      | _        t        |«      | _        y )Nr   z> should be used as a decoder model if cross attention is added)rZ   r[   Úchunk_size_feed_forwardÚseq_len_dimrý   Ú	attentionÚ
is_decoderÚadd_cross_attentionÚ	TypeErrorÚcrossattentionr  Úintermediater  rÿ   rp   s     €rN   r[   zConvBertLayer.__init__  s”   ø€ Ü‰ÑÔØ'-×'EÑ'EˆÔ$ØˆÔÜ*¨6Ó2ˆŒØ ×+Ñ+ˆŒØ#)×#=Ñ#=ˆÔ Ø×#Ò#Ø—?’?Ü 4 &Ð(fÐ gÓhÐhÜ"3°FÓ";ˆDÔÜ0°Ó8ˆÔÜ$ VÓ,ˆ�rs   r®   rÍ   rÎ   rÏ   Úencoder_attention_maskrÐ   rv   c                 ó>  — | j                  ||||¬«      }|d   }|dd  }	| j                  r?|�=t        | d«      st        d| › d�«      ‚| j	                  |||||«      }
|
d   }|	|
dd  z   }	t        | j                  | j                  | j                  |«      }|f|	z   }	|	S )N)rÐ   r   r   r+  z'If `encoder_hidden_states` are passed, z` has to be instantiated with cross-attention layers by setting `config.add_cross_attention=True`)	r'  r(  rz   ÚAttributeErrorr+  r   Úfeed_forward_chunkr%  r&  )rq   r®   rÍ   rÎ   rÏ   r-  rÐ   Úself_attention_outputsr
  rï   Úcross_attention_outputsÚlayer_outputs               rN   r€   zConvBertLayer.forward*  sð   € ð "&§¡ØØØØ/ð	 "0ó "
Ðð 2°!Ñ4ÐØ(¨¨Ð,ˆà�?Š?Ð4Ð@Ü˜4Ð!1Ô2Ü$Ø=¸d¸Vð DDð Dóð ð '+×&9Ñ&9Ø Ø&ØØ%Ø!ó'Ð#ð  7°qÑ9ÐØÐ 7¸¸Ð ;Ñ;ˆGä0Ø×#Ñ# T×%AÑ%AÀ4×CSÑCSÐUeó
ˆð  �/ GÑ+ˆØˆrs   c                 óL   — | j                  |«      }| j                  ||«      }|S r°   )r,  rÿ   )rq   r
  Úintermediate_outputr3  s       rN   r0  z ConvBertLayer.feed_forward_chunkR  s,   € Ø"×/Ñ/Ð0@ÓAÐØ—{‘{Ð#6Ð8HÓIˆØÐrs   )NNNNF)r�   r‚   rƒ   r[   r4   r³   r   r†   rñ   r   r€   r0  r‡   rˆ   s   @rN   r#  r#    s±   ø„ ô-ð" 7;Ø15Ø8<Ø9=Ø,1ñ&à—|‘|ð&ð ! ×!2Ñ!2Ñ3ð&ð ˜E×-Ñ-Ñ.ð	&ð
  (¨¯©Ñ5ð&ð !)¨¯©Ñ 6ð&ð $ D™>ð&ð 
ˆu�|‰|˜X e×&7Ñ&7Ñ8Ð8Ñ	9ó&öPrs   r#  c                   óò   ‡ — e Zd Zˆ fd„Z	 	 	 	 	 	 	 ddej
                  deej                     deej                     deej
                     deej
                     dee   dee   d	ee   d
e	e
ef   fd„Zˆ xZS )ÚConvBertEncoderc                 óÐ   •— t         ‰| �  «        || _        t        j                  t        |j                  «      D �cg c]  }t        |«      ‘Œ c}«      | _        d| _	        y c c}w )NF)
rZ   r[   r<   r   Ú
ModuleListr1   r2   r#  ÚlayerÚgradient_checkpointing)rq   r<   Ú_rr   s      €rN   r[   zConvBertEncoder.__init__Y  sN   ø€ Ü‰ÑÔØˆŒÜ—]‘]Ä5È×IaÑIaÓCbÖ#c¸a¤M°&Õ$9Ò#cÓdˆŒ
Ø&+ˆÕ#ùò $ds   ½A#r®   rÍ   rÎ   rÏ   r-  rÐ   Úoutput_hidden_statesÚreturn_dictrv   c	           
      óü  — |rdnd }	|rdnd }
|r| j                   j                  rdnd }t        | j                  «      D ]Ž  \  }}|r|	|fz   }	|�||   nd }| j                  r.| j
                  r"| j                  |j                  ||||||«      }n |||||||«      }|d   }|sŒf|
|d   fz   }
| j                   j                  sŒ†||d   fz   }Œ� |r|	|fz   }	|st        d„ ||	|
|fD «       «      S t        ||	|
|¬«      S )Nr¢   r   r   r#   c              3   ó$   K  — | ]  }|�|–— Œ
 y ­wr°   r¢   )Ú.0Úvs     rN   ú	<genexpr>z*ConvBertEncoder.forward.<locals>.<genexpr>�  s   è ø€ ò àØ�=ô ñùs   ‚)Úlast_hidden_stater®   Ú
attentionsÚcross_attentions)
r<   r)  Ú	enumerater:  r;  ÚtrainingÚ_gradient_checkpointing_funcÚ__call__Útupler   )rq   r®   rÍ   rÎ   rÏ   r-  rÐ   r=  r>  Úall_hidden_statesÚall_self_attentionsÚall_cross_attentionsÚiÚlayer_moduleÚlayer_head_maskÚlayer_outputss                   rN   r€   zConvBertEncoder.forward_  s`  € ñ #7™B¸DÐÙ$5™b¸4ÐÙ%6¸4¿;¹;×;ZÒ;Z™rÐ`dÐÜ(¨¯©Ó4ò 	V‰OˆAˆ|Ù#Ø$5¸Ð8HÑ$HÐ!à.7Ð.C˜i¨šlÈˆOà×*Ò*¨t¯}ª}Ø $× AÑ AØ ×)Ñ)Ø!Ø"Ø#Ø)Ø*Ø%ó!‘ñ !-Ø!Ø"Ø#Ø)Ø*Ø%ó!�ð *¨!Ñ,ˆMÚ Ø&9¸]È1Ñ=MÐ<OÑ&OÐ#Ø—;‘;×2Ó2Ø+?À=ÐQRÑCSÐBUÑ+UÑ(ð;	Vñ>  Ø 1°]Ð4DÑ DÐáÜñ à'Ð):Ð<OÐQeÐfôó ð ô
 2Ø+Ø+Ø*Ø1ô	
ð 	
rs   )NNNNFFT)r�   r‚   rƒ   r[   r4   r³   r   r†   rñ   r   r   r   r€   r‡   rˆ   s   @rN   r7  r7  X  s¿   ø„ ô,ð 7;Ø15Ø8<Ø9=Ø,1Ø/4Ø&*ñ;
à—|‘|ð;
ð ! ×!2Ñ!2Ñ3ð;
ð ˜E×-Ñ-Ñ.ð	;
ð
  (¨¯©Ñ5ð;
ð !)¨¯©Ñ 6ð;
ð $ D™>ð;
ð ' t™nð;
ð ˜d‘^ð;
ð 
ˆuÐ8Ð8Ñ	9÷;
rs   r7  c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚConvBertPredictionHeadTransformc                 óh  •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        t        |j                  t        «      rt        |j                     | _
        n|j                  | _
        t        j                  |j                  |j                  ¬«      | _        y rõ   )rZ   r[   r   r’   r¸   r!   r‘   r  r  r   Útransform_act_fnre   rf   rp   s     €rN   r[   z(ConvBertPredictionHeadTransform.__init__ž  s{   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
Ü�f×'Ñ'¬Ô-Ü$*¨6×+<Ñ+<Ñ$=ˆDÕ!à$*×$5Ñ$5ˆDÔ!ÜŸ™ f×&8Ñ&8¸f×>SÑ>SÔTˆ�rs   r®   rv   c                 ól   — | j                  |«      }| j                  |«      }| j                  |«      }|S r°   )r!   rV  re   r  s     rN   r€   z'ConvBertPredictionHeadTransform.forward§  s4   € ØŸ
™
 =Ó1ˆØ×-Ñ-¨mÓ<ˆØŸ™ }Ó5ˆØÐrs   rû   rˆ   s   @rN   rT  rT  �  s$   ø„ ôUð U§\¡\ð °e·l±l÷ rs   rT  aK  
    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.

    Parameters:
        config ([`ConvBertConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
a8
  
    Args:
        input_ids (`torch.LongTensor` of shape `({0})`):
            Indices of input sequence tokens in the vocabulary.

            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        attention_mask (`torch.FloatTensor` of shape `({0})`, *optional*):
            Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:


            - 1 for tokens that are **not masked**,
            - 0 for tokens that are **masked**.

            [What are attention masks?](../glossary#attention-mask)
        token_type_ids (`torch.LongTensor` of shape `({0})`, *optional*):
            Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
            1]`:


            - 0 corresponds to a *sentence A* token,
            - 1 corresponds to a *sentence B* token.

            [What are token type IDs?](../glossary#token-type-ids)
        position_ids (`torch.LongTensor` of shape `({0})`, *optional*):
            Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
            config.max_position_embeddings - 1]`.

            [What are position IDs?](../glossary#position-ids)
        head_mask (`torch.FloatTensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
            Mask to nullify selected heads of the self-attention modules. Mask values selected in `[0, 1]`:


            - 1 indicates the head is **not masked**,
            - 0 indicates the head is **masked**.

        inputs_embeds (`torch.FloatTensor` of shape `({0}, hidden_size)`, *optional*):
            Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
            is useful if you want more control over how to convert *input_ids* indices into associated vectors than the
            model's internal embedding lookup matrix.
        output_attentions (`bool`, *optional*):
            Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
            tensors for more detail.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
zbThe bare ConvBERT Model transformer outputting raw hidden-states without any specific head on top.c                   ó|  ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Z eej                  d«      «       e
eee¬«      	 	 	 	 	 	 	 	 	 ddeej                      deej"                     d	eej                      d
eej                      deej"                     deej"                     dee   dee   dee   deeef   fd„«       «       Zˆ xZS )ÚConvBertModelc                 ó"  •— t         ‰| �  |«       t        |«      | _        |j                  |j
                  k7  r/t        j                  |j                  |j
                  «      | _        t        |«      | _
        || _        | j                  «        y r°   )rZ   r[   rQ   r   r^   r¸   r   r’   Úembeddings_projectr7  Úencoderr<   Ú	post_initrp   s     €rN   r[   zConvBertModel.__init__ó  sl   ø€ Ü‰Ñ˜Ô Ü,¨VÓ4ˆŒà× Ñ  F×$6Ñ$6Ò6Ü&(§i¡i°×0EÑ0EÀv×GYÑGYÓ&ZˆDÔ#ä& vÓ.ˆŒØˆŒà�‰Õrs   c                 ó.   — | j                   j                  S r°   ©r   r`   ©rq   s    rN   Úget_input_embeddingsz"ConvBertModel.get_input_embeddingsÿ  s   € Ø�‰×.Ñ.Ð.rs   c                 ó&   — || j                   _        y r°   r_  )rq   rM   s     rN   Úset_input_embeddingsz"ConvBertModel.set_input_embeddings  s   € Ø*/ˆ�‰Õ'rs   c                 ó˜   — |j                  «       D ]7  \  }}| j                  j                  |   j                  j	                  |«       Œ9 y)z�
        Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
        class PreTrainedModel
        N)Úitemsr\  r:  r'  r  )rq   Úheads_to_pruner:  r  s       rN   Ú_prune_headszConvBertModel._prune_heads  sE   € ð
 +×0Ñ0Ó2ò 	C‰LˆE�5Ø�L‰L×Ñ˜uÑ%×/Ñ/×;Ñ;¸EÕBñ	Crs   úbatch_size, sequence_length©Ú
checkpointÚoutput_typerž   rt   rÍ   rX   rV   rÎ   ru   rÐ   r=  r>  rv   c
                 ó¢  — |�|n| j                   j                  }|�|n| j                   j                  }|	�|	n| j                   j                  }	|�|�t	        d«      ‚|�#| j                  ||«       |j                  «       }
n!|�|j                  «       d d }
nt	        d«      ‚|
\  }}|�|j                  n|j                  }|€t        j                  |
|¬«      }|€pt        | j                  d«      r4| j                  j                  d d …d |…f   }|j                  ||«      }|}n&t        j                  |
t        j                  |¬«      }| j!                  ||
«      }| j#                  || j                   j$                  «      }| j                  ||||¬«      }t        | d«      r| j'                  |«      }| j)                  ||||||	¬	«      }|S )
NzDYou cannot specify both input_ids and inputs_embeds at the same timer$   z5You have to specify either input_ids or inputs_embeds)ry   rX   rx   )rt   rV   rX   ru   r[  )rÍ   rÎ   rÐ   r=  r>  )r<   rÐ   r=  Úuse_return_dictrº   Ú%warn_if_padding_and_no_attention_maskrn   ry   r4   Úonesrz   r   rX   rl   rm   ro   Úget_extended_attention_maskÚget_head_maskr2   r[  r\  )rq   rt   rÍ   rX   rV   rÎ   ru   rÐ   r=  r>  r{   râ   r|   ry   r}   r~   Úextended_attention_maskr®   s                     rN   r€   zConvBertModel.forward  sä  € ð$ 2CÐ1NÑ-ÐTX×T_ÑT_×TqÑTqÐà$8Ð$DÑ È$Ï+É+×JjÑJjð 	ð &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆàÐ  ]Ð%>ÜÐcÓdÐdØÐ"Ø×6Ñ6°yÀ.ÔQØ#Ÿ.™.Ó*‰KØÐ&Ø'×,Ñ,Ó.¨s°Ð3‰KäÐTÓUÐUà!,Ñˆ
�JØ%.Ð%:�×!Ò!À×@TÑ@TˆàÐ!Ü"ŸZ™Z¨¸FÔCˆNØÐ!Ü�t—‘Ð(8Ô9Ø*.¯/©/×*HÑ*HÊÈKÈZÈKÈÑ*XÐ'Ø3J×3QÑ3QÐR\Ð^hÓ3iÐ0Ø!A‘ä!&§¡¨[ÄÇ
Á
ÐSYÔ!Z�à"&×"BÑ"BÀ>ÐS^Ó"_ÐØ×&Ñ& y°$·+±+×2OÑ2OÓPˆ	àŸ™Ø¨lÈ>Ðivð (ó 
ˆô �4Ð-Ô.Ø ×3Ñ3°MÓBˆMàŸ™ØØ2ØØ/Ø!5Ø#ð %ó 
ˆð Ðrs   )	NNNNNNNNN)r�   r‚   rƒ   r[   ra  rc  rg  r   ÚCONVBERT_INPUTS_DOCSTRINGÚformatr   Ú_CHECKPOINT_FOR_DOCr   Ú_CONFIG_FOR_DOCr   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   rY  rY  î  s-  ø„ ô

ò/ò0òCñ +Ð+D×+KÑ+KÐLiÓ+jÓkÙØ&Ø6Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø,0Ø/3Ø&*ñ<à˜E×,Ñ,Ñ-ð<ð ! ×!2Ñ!2Ñ3ð<ð ! ×!1Ñ!1Ñ2ð	<ð
 ˜u×/Ñ/Ñ0ð<ð ˜E×-Ñ-Ñ.ð<ð   × 1Ñ 1Ñ2ð<ð $ D™>ð<ð ' t™nð<ð ˜d‘^ð<ð 
ˆuÐ8Ð8Ñ	9ò<óó lô<rs   rY  c                   óZ   ‡ — e Zd ZdZˆ fd„Zdej                  dej                  fd„Zˆ xZS )ÚConvBertGeneratorPredictionszAPrediction module for the generator, made up of two dense layers.c                 ó   •— t         ‰| �  «        t        d«      | _        t	        j
                  |j                  |j                  ¬«      | _        t	        j                  |j                  |j                  «      | _
        y )NÚgelurT   )rZ   r[   r   Ú
activationr   re   r^   rf   r’   r¸   r!   rp   s     €rN   r[   z%ConvBertGeneratorPredictions.__init__U  sV   ø€ Ü‰ÑÔä(¨Ó0ˆŒÜŸ™ f×&;Ñ&;À×AVÑAVÔWˆŒÜ—Y‘Y˜v×1Ñ1°6×3HÑ3HÓIˆ�
rs   Úgenerator_hidden_statesrv   c                 ól   — | j                  |«      }| j                  |«      }| j                  |«      }|S r°   )r!   r{  re   )rq   r|  r®   s      rN   r€   z$ConvBertGeneratorPredictions.forward\  s3   € ØŸ
™
Ð#:Ó;ˆØŸ™¨Ó6ˆØŸ™ }Ó5ˆàÐrs   )	r�   r‚   rƒ   r„   r[   r4   r†   r€   r‡   rˆ   s   @rN   rx  rx  R  s+   ø„ ÙKôJð¨u×/@Ñ/@ð ÀU×EVÑEV÷ rs   rx  z6ConvBERT Model with a `language modeling` head on top.c                   óœ  ‡ — e Zd ZdgZˆ fd„Zd„ Zd„ Z eej                  d«      «       e
eee¬«      	 	 	 	 	 	 	 	 	 	 ddeej                      deej"                     d	eej                      d
eej                      deej"                     deej"                     deej                      dee   dee   dee   deeef   fd„«       «       Zˆ xZS )ÚConvBertForMaskedLMzgenerator.lm_head.weightc                 óâ   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        t        j                  |j                  |j                  «      | _
        | j                  «        y r°   )rZ   r[   rY  r‹   rx  Úgenerator_predictionsr   r’   r^   r]   Úgenerator_lm_headr]  rp   s     €rN   r[   zConvBertForMaskedLM.__init__h  sR   ø€ Ü‰Ñ˜Ô ä% fÓ-ˆŒÜ%AÀ&Ó%IˆÔ"ä!#§¡¨6×+@Ñ+@À&×BSÑBSÓ!TˆÔà�‰Õrs   c                 ó   — | j                   S r°   ©r‚  r`  s    rN   Úget_output_embeddingsz)ConvBertForMaskedLM.get_output_embeddingsr  s   € Ø×%Ñ%Ð%rs   c                 ó   — || _         y r°   r„  )rq   r`   s     rN   Úset_output_embeddingsz)ConvBertForMaskedLM.set_output_embeddingsu  s
   € Ø!0ˆÕrs   rh  ri  rt   rÍ   rX   rV   rÎ   ru   ÚlabelsrÐ   r=  r>  rv   c                 óÎ  — |
�|
n| j                   j                  }
| j                  ||||||||	|
«	      }|d   }| j                  |«      }| j	                  |«      }d}|�Pt        j                  «       } ||j                  d| j                   j                  «      |j                  d«      «      }|
s|f|dd z   }|�|f|z   S |S t        |||j                  |j                  ¬«      S )a¢  
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
            config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
            loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`
        Nr   r$   r   ©ÚlossÚlogitsr®   rE  )r<   rm  r‹   r�  r‚  r   r	   rÊ   r]   r   r®   rE  )rq   rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  r|  Úgenerator_sequence_outputÚprediction_scoresr‹  Úloss_fctrÿ   s                    rN   r€   zConvBertForMaskedLM.forwardx  s  € ð2 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà"&§-¡-ØØØØØØØØ Øó
#
Ðð %<¸AÑ$>Ð!à ×6Ñ6Ð7PÓQÐØ ×2Ñ2Ð3DÓEÐàˆàÐÜ×*Ñ*Ó,ˆHÙÐ-×2Ñ2°2°t·{±{×7MÑ7MÓNÐPV×P[ÑP[Ð\^ÓP_Ó`ˆDáØ'Ð)Ð,CÀAÀBÐ,GÑGˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEäØØ$Ø1×?Ñ?Ø.×9Ñ9ô	
ð 	
rs   ©
NNNNNNNNNN)r�   r‚   rƒ   Ú_tied_weights_keysr[   r…  r‡  r   rs  rt  r   ru  r   rv  r   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   r  r  d  sG  ø„ à4Ð5Ðôò&ò1ñ +Ð+D×+KÑ+KÐLiÓ+jÓkÙØ&Ø"Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø-1Ø,0Ø/3Ø&*ñ4
à˜E×,Ñ,Ñ-ð4
ð ! ×!2Ñ!2Ñ3ð4
ð ! ×!1Ñ!1Ñ2ð	4
ð
 ˜u×/Ñ/Ñ0ð4
ð ˜E×-Ñ-Ñ.ð4
ð   × 1Ñ 1Ñ2ð4
ð ˜×)Ñ)Ñ*ð4
ð $ D™>ð4
ð ' t™nð4
ð ˜d‘^ð4
ð 
ˆu�nÐ$Ñ	%ò4
óó lô4
rs   r  c                   óZ   ‡ — e Zd ZdZˆ fd„Zdej                  dej                  fd„Zˆ xZS )ÚConvBertClassificationHeadz-Head for sentence-level classification tasks.c                 óh  •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        |j                  �|j                  n|j                  }t        j                  |«      | _	        t        j                  |j                  |j                  «      | _        || _        y r°   )rZ   r[   r   r’   r¸   r!   Úclassifier_dropoutrh   rg   ri   Ú
num_labelsÚout_projr<   ©rq   r<   r•  rr   s      €rN   r[   z#ConvBertClassificationHead.__init__¸  s†   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
à)/×)BÑ)BÐ)NˆF×%Ò%ÐTZ×TnÑTnð 	ô —z‘zÐ"4Ó5ˆŒÜŸ	™	 &×"4Ñ"4°f×6GÑ6GÓHˆŒàˆ�rs   r®   rv   c                 óê   — |d d …dd d …f   }| j                  |«      }| j                  |«      }t        | j                  j                     |«      }| j                  |«      }| j                  |«      }|S )Nr   )ri   r!   r   r<   r  r—  )rq   r®   r­   r±   s       rN   r€   z"ConvBertClassificationHead.forwardÃ  se   € Øš!˜Q¢˜'Ñ"ˆØ�L‰L˜‹OˆØ�J‰J�q‹MˆÜ�4—;‘;×)Ñ)Ñ*¨1Ó-ˆØ�L‰L˜‹OˆØ�M‰M˜!ÓˆØˆrs   r²   rˆ   s   @rN   r“  r“  µ  s&   ø„ Ù7ô	ð U§\¡\ð ÀÇÁ÷ rs   r“  z 
    ConvBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the
    pooled output) e.g. for GLUE tasks.
    c                   óŠ  ‡ — e Zd Zˆ fd„Z eej                  d«      «       eee	e
¬«      	 	 	 	 	 	 	 	 	 	 ddeej                     deej                     deej                     deej                     deej                     d	eej                     d
eej                     dee   dee   dee   deee	f   fd„«       «       Zˆ xZS )Ú!ConvBertForSequenceClassificationc                 ó´   •— t         ‰| �  |«       |j                  | _        || _        t	        |«      | _        t        |«      | _        | j                  «        y r°   )	rZ   r[   r–  r<   rY  r‹   r“  Ú
classifierr]  rp   s     €rN   r[   z*ConvBertForSequenceClassification.__init__Õ  sH   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒØˆŒÜ% fÓ-ˆŒÜ4°VÓ<ˆŒð 	�‰Õrs   rh  ri  rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  rv   c                 ó  — |
�|
n| j                   j                  }
| j                  ||||||||	|
¬«	      }|d   }| j                  |«      }d}|��‡| j                   j                  €�| j
                  dk(  rd| j                   _        nl| j
                  dkD  rL|j                  t        j                  k(  s|j                  t        j                  k(  rd| j                   _        nd| j                   _        | j                   j                  dk(  rIt        «       }| j
                  dk(  r& ||j                  «       |j                  «       «      }nŒ |||«      }n‚| j                   j                  dk(  r=t        «       } ||j                  d| j
                  «      |j                  d«      «      }n,| j                   j                  dk(  rt        «       } |||«      }|
s|f|dd z   }|�|f|z   S |S t        |||j                   |j"                  ¬	«      S )
a�  
        labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
            config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
            `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
        N©rÍ   rX   rV   rÎ   ru   rÐ   r=  r>  r   r   Ú
regressionÚsingle_label_classificationÚmulti_label_classificationr$   rŠ  )r<   rm  r‹   r�  Úproblem_typer–  rY   r4   ro   rÅ   r
   Úsqueezer	   rÊ   r   r   r®   rE  ©rq   rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  rï   Úsequence_outputrŒ  r‹  r�  rÿ   s                    rN   r€   z)ConvBertForSequenceClassification.forwardß  sÚ  € ð2 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—-‘-ØØ)Ø)Ø%ØØ'Ø/Ø!5Ø#ð  ó 

ˆð " !™*ˆØ—‘ Ó1ˆàˆØÑØ�{‰{×'Ñ'Ð/Ø—?‘? aÒ'Ø/;�D—K‘KÕ,Ø—_‘_ qÒ(¨f¯l©l¼e¿j¹jÒ.HÈFÏLÉLÔ\a×\eÑ\eÒLeØ/L�D—K‘KÕ,à/K�D—K‘KÔ,à�{‰{×'Ñ'¨<Ò7Ü"›9�Ø—?‘? aÒ'Ù# F§N¡NÓ$4°f·n±nÓ6FÓG‘Dá# F¨FÓ3‘DØ—‘×)Ñ)Ð-JÒJÜ+Ó-�Ù §¡¨B°·±Ó @À&Ç+Á+ÈbÃ/ÓR‘Ø—‘×)Ñ)Ð-IÒIÜ,Ó.�Ù ¨Ó/�áØ�Y ¨¨ Ñ,ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä'ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
rs   r�  )r�   r‚   rƒ   r[   r   rs  rt  r   ru  r   rv  r   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   r›  r›  Í  sB  ø„ ôñ +Ð+D×+KÑ+KÐLiÓ+jÓkÙØ&Ø,Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø-1Ø,0Ø/3Ø&*ñD
à˜E×,Ñ,Ñ-ðD
ð ! ×!2Ñ!2Ñ3ðD
ð ! ×!1Ñ!1Ñ2ð	D
ð
 ˜u×/Ñ/Ñ0ðD
ð ˜E×-Ñ-Ñ.ðD
ð   × 1Ñ 1Ñ2ðD
ð ˜×)Ñ)Ñ*ðD
ð $ D™>ðD
ð ' t™nðD
ð ˜d‘^ðD
ð 
ˆuÐ.Ð.Ñ	/òD
óó lôD
rs   r›  z©
    ConvBERT Model with a multiple choice classification head on top (a linear layer on top of the pooled output and a
    softmax) e.g. for RocStories/SWAG tasks.
    c                   óŠ  ‡ — e Zd Zˆ fd„Z eej                  d«      «       eee	e
¬«      	 	 	 	 	 	 	 	 	 	 ddeej                     deej                     deej                     deej                     deej                     d	eej                     d
eej                     dee   dee   dee   deee	f   fd„«       «       Zˆ xZS )ÚConvBertForMultipleChoicec                 óÎ   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        t        j                  |j                  d«      | _	        | j                  «        y )Nr   )rZ   r[   rY  r‹   r   Úsequence_summaryr   r’   r¸   r�  r]  rp   s     €rN   r[   z"ConvBertForMultipleChoice.__init__4  sM   ø€ Ü‰Ñ˜Ô ä% fÓ-ˆŒÜ /°Ó 7ˆÔÜŸ)™) F×$6Ñ$6¸Ó:ˆŒð 	�‰Õrs   z(batch_size, num_choices, sequence_lengthri  rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  rv   c                 óL  — |
�|
n| j                   j                  }
|�|j                  d   n|j                  d   }|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�1|j                  d|j	                  d«      |j	                  d«      «      nd}| j                  ||||||||	|
¬«	      }|d   }| j                  |«      }| j                  |«      }|j                  d|«      }d}|�t        «       } |||«      }|
s|f|dd z   }|�|f|z   S |S t        |||j                  |j                  ¬«      S )aJ  
        labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
            num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
            `input_ids` above)
        Nr   r$   rÖ   rŸ  r   rŠ  )r<   rm  rC   rÊ   rn   r‹   rª  r�  r	   r   r®   rE  )rq   rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  Únum_choicesrï   r¦  Úpooled_outputrŒ  Úreshaped_logitsr‹  r�  rÿ   s                       rN   r€   z!ConvBertForMultipleChoice.forward>  sß  € ð6 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆØ,5Ð,A�i—o‘o aÒ(À}×GZÑGZÐ[\ÑG]ˆà>GÐ>S�I—N‘N 2 y§~¡~°bÓ'9Ô:ÐY]ˆ	ØM[ÐMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆØM[ÐMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆØGSÐG_�|×(Ñ(¨¨\×->Ñ->¸rÓ-BÔCÐeiˆð Ð(ð ×Ñ˜r =×#5Ñ#5°bÓ#9¸=×;MÑ;MÈbÓ;QÔRàð 	ð —-‘-ØØ)Ø)Ø%ØØ'Ø/Ø!5Ø#ð  ó 

ˆð " !™*ˆà×-Ñ-¨oÓ>ˆØ—‘ Ó/ˆØ Ÿ+™+ b¨+Ó6ˆàˆØÐÜ'Ó)ˆHÙ˜O¨VÓ4ˆDáØ%Ð'¨'°!°"¨+Ñ5ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä(ØØ"Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
rs   r�  )r�   r‚   rƒ   r[   r   rs  rt  r   ru  r   rv  r   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   r¨  r¨  ,  sE  ø„ ôñ +Ø!×(Ñ(Ð)SÓTóñ  Ø&Ø-Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø-1Ø,0Ø/3Ø&*ñ@
à˜E×,Ñ,Ñ-ð@
ð ! ×!2Ñ!2Ñ3ð@
ð ! ×!1Ñ!1Ñ2ð	@
ð
 ˜u×/Ñ/Ñ0ð@
ð ˜E×-Ñ-Ñ.ð@
ð   × 1Ñ 1Ñ2ð@
ð ˜×)Ñ)Ñ*ð@
ð $ D™>ð@
ð ' t™nð@
ð ˜d‘^ð@
ð 
ˆuÐ/Ð/Ñ	0ò@
óóô@
rs   r¨  z§
    ConvBERT Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
    Named-Entity-Recognition (NER) tasks.
    c                   óŠ  ‡ — e Zd Zˆ fd„Z eej                  d«      «       eee	e
¬«      	 	 	 	 	 	 	 	 	 	 ddeej                     deej                     deej                     deej                     deej                     d	eej                     d
eej                     dee   dee   dee   deee	f   fd„«       «       Zˆ xZS )ÚConvBertForTokenClassificationc                 ó`  •— t         ‰| �  |«       |j                  | _        t        |«      | _        |j
                  �|j
                  n|j                  }t        j                  |«      | _	        t        j                  |j                  |j                  «      | _        | j                  «        y r°   )rZ   r[   r–  rY  r‹   r•  rh   r   rg   ri   r’   r¸   r�  r]  r˜  s      €rN   r[   z'ConvBertForTokenClassification.__init__‘  sˆ   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä% fÓ-ˆŒà)/×)BÑ)BÐ)NˆF×%Ò%ÐTZ×TnÑTnð 	ô —z‘zÐ"4Ó5ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õrs   rh  ri  rt   rÍ   rX   rV   rÎ   ru   rˆ  rÐ   r=  r>  rv   c                 ó¨  — |
�|
n| j                   j                  }
| j                  ||||||||	|
¬«	      }|d   }| j                  |«      }| j	                  |«      }d}|�<t        «       } ||j                  d| j                  «      |j                  d«      «      }|
s|f|dd z   }|�|f|z   S |S t        |||j                  |j                  ¬«      S )zÛ
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
        NrŸ  r   r$   r   rŠ  )r<   rm  r‹   ri   r�  r	   rÊ   r–  r   r®   rE  r¥  s                    rN   r€   z&ConvBertForTokenClassification.forwardŸ  sö   € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—-‘-ØØ)Ø)Ø%ØØ'Ø/Ø!5Ø#ð  ó 

ˆð " !™*ˆàŸ,™, Ó7ˆØ—‘ Ó1ˆàˆØÐÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¸f¿k¹kÈ"»oÓNˆDáØ�Y ¨¨ Ñ,ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä$ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
rs   r�  )r�   r‚   rƒ   r[   r   rs  rt  r   ru  r   rv  r   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   r°  r°  ‰  s5  ø„ ôñ +Ð+D×+KÑ+KÐLiÓ+jÓkÙØ&Ø)Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø-1Ø,0Ø/3Ø&*ñ2
à˜E×,Ñ,Ñ-ð2
ð ! ×!2Ñ!2Ñ3ð2
ð ! ×!1Ñ!1Ñ2ð	2
ð
 ˜u×/Ñ/Ñ0ð2
ð ˜E×-Ñ-Ñ.ð2
ð   × 1Ñ 1Ñ2ð2
ð ˜×)Ñ)Ñ*ð2
ð $ D™>ð2
ð ' t™nð2
ð ˜d‘^ð2
ð 
ˆuÐ+Ð+Ñ	,ò2
óó lô2
rs   r°  zá
    ConvBERT Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear
    layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
    c                   óª  ‡ — e Zd Zˆ fd„Z eej                  d«      «       eee	e
¬«      	 	 	 	 	 	 	 	 	 	 	 ddeej                     deej                     deej                     deej                     deej                     d	eej                     d
eej                     deej                     dee   dee   dee   deee	f   fd„«       «       Zˆ xZS )ÚConvBertForQuestionAnsweringc                 óä   •— t         ‰| �  |«       |j                  | _        t        |«      | _        t        j                  |j                  |j                  «      | _        | j                  «        y r°   )
rZ   r[   r–  rY  r‹   r   r’   r¸   Ú
qa_outputsr]  rp   s     €rN   r[   z%ConvBertForQuestionAnswering.__init__â  sS   ø€ Ü‰Ñ˜Ô à ×+Ñ+ˆŒÜ% fÓ-ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õrs   rh  ri  rt   rÍ   rX   rV   rÎ   ru   Ústart_positionsÚend_positionsrÐ   r=  r>  rv   c                 ó(  — |�|n| j                   j                  }| j                  |||||||	|
|¬«	      }|d   }| j                  |«      }|j	                  dd¬«      \  }}|j                  d«      j                  «       }|j                  d«      j                  «       }d}|�·|�µt        |j                  «       «      dkD  r|j                  d«      }t        |j                  «       «      dkD  r|j                  d«      }|j                  d«      }|j                  d|«      }|j                  d|«      }t        |¬«      } |||«      } |||«      }||z   dz  }|s||f|dd z   }|�|f|z   S |S t        ||||j                  |j                  ¬	«      S )
a  
        start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for position (index) of the start of the labelled span for computing the token classification loss.
            Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
            are not taken into account for computing the loss.
        end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for position (index) of the end of the labelled span for computing the token classification loss.
            Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
            are not taken into account for computing the loss.
        NrŸ  r   r   r$   rÒ   )Úignore_indexr#   )r‹  Ústart_logitsÚ
end_logitsr®   rE  )r<   rm  r‹   r¶  Úsplitr¤  rÛ   r  rn   Úclampr	   r   r®   rE  )rq   rt   rÍ   rX   rV   rÎ   ru   r·  r¸  rÐ   r=  r>  rï   r¦  rŒ  r»  r¼  Ú
total_lossÚignored_indexr�  Ú
start_lossÚend_lossrÿ   s                          rN   r€   z$ConvBertForQuestionAnswering.forwardì  sÂ  € ð< &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—-‘-ØØ)Ø)Ø%ØØ'Ø/Ø!5Ø#ð  ó 

ˆð " !™*ˆà—‘ Ó1ˆØ#)§<¡<°°r <Ó#:Ñ ˆ�jØ#×+Ñ+¨BÓ/×:Ñ:Ó<ˆØ×'Ñ'¨Ó+×6Ñ6Ó8ˆ
àˆ
ØÐ&¨=Ð+Dä�?×'Ñ'Ó)Ó*¨QÒ.Ø"1×"9Ñ"9¸"Ó"=�Ü�=×%Ñ%Ó'Ó(¨1Ò,Ø -× 5Ñ 5°bÓ 9�à(×-Ñ-¨aÓ0ˆMØ-×3Ñ3°A°}ÓEˆOØ)×/Ñ/°°=ÓAˆMä'°]ÔCˆHÙ! ,°Ó@ˆJÙ 
¨MÓ:ˆHØ$ xÑ/°1Ñ4ˆJáØ" JÐ/°'¸!¸"°+Ñ=ˆFØ/9Ð/E�Z�M FÑ*ÐQÈ6ÐQä+ØØ%Ø!Ø!×/Ñ/Ø×)Ñ)ô
ð 	
rs   )NNNNNNNNNNN)r�   r‚   rƒ   r[   r   rs  rt  r   ru  r   rv  r   r4   r…   r†   rñ   r   r   r€   r‡   rˆ   s   @rN   r´  r´  Ú  s[  ø„ ôñ +Ð+D×+KÑ+KÐLiÓ+jÓkÙØ&Ø0Ø$ôð 15Ø6:Ø59Ø37Ø15Ø59Ø6:Ø48Ø,0Ø/3Ø&*ñH
à˜E×,Ñ,Ñ-ðH
ð ! ×!2Ñ!2Ñ3ðH
ð ! ×!1Ñ!1Ñ2ð	H
ð
 ˜u×/Ñ/Ñ0ðH
ð ˜E×-Ñ-Ñ.ðH
ð   × 1Ñ 1Ñ2ðH
ð " %×"2Ñ"2Ñ3ðH
ð   × 0Ñ 0Ñ1ðH
ð $ D™>ðH
ð ' t™nðH
ð ˜d‘^ðH
ð 
ˆuÐ2Ð2Ñ	3òH
óó lôH
rs   r´  )	r  r¨  r´  r›  r°  r#  rY  rŠ   rO   )Fr„   rÞ   r)   Úoperatorr   Útypingr   r   r   r4   Útorch.utils.checkpointr   Útorch.nnr   r	   r
   Úactivationsr   r   Úmodeling_outputsr   r   r   r   r   r   Úmodeling_utilsr   r   Úpytorch_utilsr   r   r   Úutilsr   r   r   r   Úconfiguration_convbertr   Ú
get_loggerr�   r'   ru  rv  rO   ÚModulerQ   rŠ   rš   rµ   ró   rý   r›   r  r  r#  r7  rT  ÚCONVBERT_START_DOCSTRINGrs  rY  rx  r  r“  r›  r¨  r°  r´  Ú__all__r¢   rs   rN   ú<module>rÑ     s~  ðñ ã Û 	Ý ß )Ñ )ã Û Ý ß AÑ Aç 1÷÷ ÷ ?ß lÑ lß uÓ uÝ 2ð 
ˆ×	Ñ	˜HÓ	%€à/Ð Ø"€òyôx9˜Ÿ™ô 9ôx%˜oô %ôB�b—i‘iô ô4}˜BŸI™Iô }ô@˜Ÿ™ô ô*˜Ÿ	™	ô *ôZ˜Ÿ™ô ô,˜2Ÿ9™9ô ô(�R—Y‘Yô ô&:�B—I‘Iô :ôzB
�b—i‘iô B
ôJ b§i¡iô ð"	Ð ð2Ð ñj ØhØóô]Ð+ó ]ó	ð]ô@ 2§9¡9ô ñ$ ÐRÐTlÓmôM
Ð1ó M
ó nðM
ô` §¡ô ñ0 ðð óôU
Ð(?ó U
óðU
ñp ðð óôS
Ð 7ó S
óðS
ñl ðð óôG
Ð%<ó G
óðG
ñT ðð óôY
Ð#:ó Y
óðY
òx
�rs   