
    Z j[                     ,   S SK r S SKJr  S SKrS SKJr  S SKJs  Jr  S SK	J
s  Js  Jr  S SKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJrJr  SSKJ r J!r!J"r"  SSK#J$r$  SSK%J&r&  SSK'J(r(J)r)  SSK*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1J2r2  SSK3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:J;r;  \/Rx                  " \=5      r>\," SS9\ " S S\85      5       5       r? " S S\:5      r@\," SS9\ " S S\5      5       5       rA " S S \R                  5      rC " S! S"\R                  5      rD " S# S$\&5      rE " S% S&\;5      rF " S' S(\E5      rG " S) S*\E5      rH\,\ " S+ S,\$5      5       5       rI\," S-S.9 " S/ S0\E5      5       rJ\,\4" S1S29 " S3 S4\5      5       5       rK/ S5QrLg)6    N)	dataclass)strict   )initialization)ACT2CLS)filter_output_hidden_states)PreTrainedConfig)TorchvisionBackend)BatchFeature)group_images_by_shapereorder_images)IMAGENET_DEFAULT_MEANIMAGENET_DEFAULT_STDSizeDict)BaseModelOutput)PreTrainedModel)ImagesKwargsUnpack)TransformersKwargsauto_docstringcan_return_tupleis_torchdynamo_compilinglogging)
TensorTypemerge_with_config_defaults)requires)capture_outputs   )GotOcr2VisionConfig)GotOcr2VisionAttentionGotOcr2VisionEncoderz&PaddlePaddle/SLANeXt_wired_safetensors)
checkpointc                   $    \ rS rSr% Sr\\S'   Srg)SLANeXtVisionConfig2      
image_size N)__name__
__module____qualname____firstlineno__r'   int__annotations____static_attributes__r(       |/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/slanext/modular_slanext.pyr$   r$   2   s     Jr0   r$   c                       \ rS rSrSrg)SLANeXtVisionAttention8   r(   Nr)   r*   r+   r,   r/   r(   r0   r1   r3   r3   8       r0   r3   c                      ^  \ rS rSr% SrSrS\0rSr\	\-  S-  \
S'   Sr\\
S'   Sr\\
S	'   S
r\\
S'   Sr\\
S'   Sr\\
S'   U 4S jrSrU =r$ )SLANeXtConfig<   a  
vision_config (`dict` or [`SLANeXtVisionConfig`], *optional*):
    Configuration for the vision encoder. If `None`, a default [`SLANeXtVisionConfig`] is used.
post_conv_in_channels (`int`, *optional*, defaults to 256):
    Number of input channels for the post-encoder convolution layer.
post_conv_out_channels (`int`, *optional*, defaults to 512):
    Number of output channels for the post-encoder convolution layer.
out_channels (`int`, *optional*, defaults to 50):
    Vocabulary size for the table structure token prediction head, i.e., the number of distinct structure
    tokens the model can predict.
hidden_size (`int`, *optional*, defaults to 512):
    Dimensionality of the hidden states in the attention GRU cell and the structure/location prediction heads.
max_text_length (`int`, *optional*, defaults to 500):
    Maximum number of autoregressive decoding steps (tokens) for the structure and location decoder.
slanextvision_configN   post_conv_in_channelsr&   post_conv_out_channelsr%   out_channelshidden_sizei  max_text_lengthc                    > U R                   c  [        5       U l         O9[        U R                   [        5      (       a  [        S0 U R                   D6U l         [        TU ]  " S0 UD6  g Nr(   )r;   r$   
isinstancedictsuper__post_init__selfkwargs	__class__s     r1   rG   SLANeXtConfig.__post_init__Y   sS    %!4!6D**D11!4!Jt7I7I!JD''r0   )r;   )r)   r*   r+   r,   __doc__
model_typer$   sub_configsr;   rE   r.   r=   r-   r>   r?   r@   rA   rG   r/   __classcell__rK   s   @r1   r8   r8   <   sm      J"$78K7;M4--4;!$3$"%C%L#KOS( (r0   r8   c            	          ^  \ rS rSrU 4S jrS\R                  S\R                  S\R                  S\\   4S jr	Sr
U =r$ )	SLANeXtAttentionGRUCella   c                    > [         TU ]  5         [        R                  " XSS9U l        [        R                  " X"5      U l        [        R                  " USSS9U l        [        R                  " X-   U5      U l        g )NF)bias   )	rF   __init__nnLinearinput_to_hiddenhidden_to_hiddenscoreGRUCellrnn)rI   
input_sizer@   num_embeddingsrK   s       r1   rX    SLANeXtAttentionGRUCell.__init__b   s[    !yyuM "		+ CYY{AE:
::j9;Gr0   prev_hiddenbatch_hiddenchar_onehotsrJ   c                    U R                  U5      nU R                  U5      R                  S5      nXV-   n[        R                  " U5      nU R                  U5      n[        R                  " US[        R                  S9R                  UR                  5      nUR                  SS5      n[        R                  " X5      R                  S5      n	[        R                  " X/S5      n
U R                  X5      nX4$ )NrW   dimdtyper   )r[   r\   	unsqueezetorchtanhr]   Fsoftmaxfloat32tori   	transposematmulsqueezecatr_   )rI   rc   rd   re   rJ   batch_hidden_projprev_hidden_projattention_scoresattn_weightscontextconcat_contexthidden_statess               r1   forwardSLANeXtAttentionGRUCell.forwardk   s     !00>00=GGJ,? ::&67::&67yy!1qNQQRbRhRhi#--a3,,|:BB1EG#:A>=**r0   )r\   r[   r_   r]   )r)   r*   r+   r,   rX   rk   FloatTensorr   r   r|   r/   rP   rQ   s   @r1   rS   rS   a   sQ    H+&&+ ''+ ''	+
 +,+ +r0   rS   c                   2   ^  \ rS rSrSU 4S jjrS rSrU =r$ )
SLANeXtMLP   c                    > [         TU ]  5         [        R                  " X5      U l        [        R                  " X5      U l        Uc  [        R                  " 5       U l        g [        U   " 5       U l        g N)	rF   rX   rY   rZ   fc1fc2Identityr   act_fn)rI   r@   r?   
activationrK   s       r1   rX   SLANeXtMLP.__init__   sN    99[699[7'1'9bkkmwz?R?Tr0   c                 l    U R                  U5      nU R                  U5      nU R                  U5      nU$ r   )r   r   r   )rI   r{   s     r1   r|   SLANeXtMLP.forward   s2    //M2r0   )r   r   r   r   )r)   r*   r+   r,   rX   r|   r/   rP   rQ   s   @r1   r   r      s    U r0   r   c                   t   ^  \ rS rSr% \\S'   SrSrSrSr	SS/r
\R                  " 5       U 4S	 j5       rS
rU =r$ )SLANeXtPreTrainedModel   configbackbonepixel_values)imageTstructure_attention_cellstructure_generatorc                 <  > [         TU ]  U5        [        U[        5      (       a.  UR                  b!  [
        R                  " UR                  S5        [        U[        5      (       aS  UR                  (       aB  [
        R                  " UR                  S5        [
        R                  " UR                  S5        [        U[        R                  5      (       a  UR                  S:  a#  S[        R                  " UR                  5      -  OSn[
        R                   " UR"                  U* U5        [
        R                   " UR$                  U* U5        UR&                  b#  [
        R                   " UR&                  U* U5        UR(                  b#  [
        R                   " UR(                  U* U5        [        U[*        5      (       a  S[        R                  " U R,                  R                  S-  5      -  nUR.                  4 H  nUR1                  5        Hy  n[        U[        R2                  5      (       d  M$  [
        R                   " UR4                  U* U5        UR6                  c  MV  [
        R                   " UR6                  U* U5        M{     M     gg)zInitialize the weightsNg        r   g      ?)rF   _init_weightsrD   SLANeXtVisionEncoder	pos_embedinit	constant_r3   use_rel_pos	rel_pos_h	rel_pos_wrY   r^   r@   mathsqrtuniform_	weight_ih	weight_hhbias_ihbias_hhSLANeXtSLAHeadr   r   childrenrZ   weightrV   )rI   modulestd	generatorlayerrK   s        r1   r   $SLANeXtPreTrainedModel._init_weights   s    	f% f233+v//5 f455!!v//5v//5 fbjj))9?9K9Ka9O#		&"4"455UVCMM&**SD#6MM&**SD#6~~)fnnsdC8~~)fnnsdC8 fn--		$++"9"9C"?@@C$88:	&//1E!%33ellSD#> ::1 MM%**sdC@	 2 ; .r0   r(   )r)   r*   r+   r,   r8   r.   base_model_prefixmain_input_nameinput_modalitiessupports_gradient_checkpointing_keep_in_fp32_modules_strictrk   no_gradr   r/   rP   rQ   s   @r1   r   r      sF    "$O!&*#$>@U#V 
]]_"A "Ar0   r   c                       \ rS rSrSrg)r      r(   Nr5   r(   r0   r1   r   r      r6   r0   r   c                   h   ^  \ rS rSr S	S\S-  4U 4S jjjrS\R                  S\\	   4S jr
SrU =r$ )
SLANeXtBackbone   Nr   c           	         > [         TU ]  U5        [        UR                  5      U l        [
        R                  " UR                  UR                  SSSSS9U l	        U R                  5         g )Nr   r   rW   F)kernel_sizestridepaddingrV   )rF   rX   r   r;   vision_towerrY   Conv2dr=   r>   	post_conv	post_initrI   r   rJ   rK   s      r1   rX   SLANeXtBackbone.__init__   s^    
 	 01E1EF((&*G*GUV_`jkrw
 	r0   r{   rJ   c                     U R                   " U40 UD6nU R                  UR                  5      nUR                  S5      R	                  SS5      n[        UUR                  UR                  S9$ )Nr   rW   )last_hidden_stater{   
attentions)r   r   r   flattenrq   r   r{   r   )rI   r{   rJ   vision_outputs       r1   r|   SLANeXtBackbone.forward   sj    ))-B6B}'F'FG%--a0::1a@+'55$//
 	
r0   )r   r   r   )r)   r*   r+   r,   rE   rX   rk   Tensorr   r   r|   r/   rP   rQ   s   @r1   r   r      s@     #
t
 

U\\ 
VDV=W 
 
r0   r   c                      ^  \ rS rSrS\0r SS\S-  4U 4S jjjr\\	\
 SS\R                  S\R                  S-  S\\   4S	 jj5       5       5       rS
rU =r$ )r      r   Nr   c                    > [         TU ]  U5        [        UR                  UR                  UR
                  5      U l        [        UR                  UR
                  5      U l        U R                  5         g r   )
rF   rX   rS   r>   r@   r?   r   r   r   r   r   s      r1   rX   SLANeXtSLAHead.__init__   s_    
 	 (?))6+=+=v?R?R)
% $.f.@.@&BUBU#V r0   r{   targetsrJ   c                    [         R                  " UR                  S   U R                  R                  4[         R
                  UR                  S9n[         R                  " UR                  S   /[         R                  UR                  S9n/ n/ n[        U R                  R                  S-   5       H  n[        R                  " XPR                  R                  5      R                  5       n	U R                  XAR                  5       U	5      u  pHU R                  U5      n
U
R!                  SS9nUR#                  U
5        UR#                  U5        [         R$                  " USS9R'                  U R                  R                  S-
  5      R)                  S5      R+                  5       (       d  M    O   [        R,                  " [         R$                  " USS9S[         R
                  S9R/                  UR0                  5      n[3        XS9$ )	Nr   ri   device)sizeri   r   rW   rh   rg   )r   r{   )rk   zerosshaper   r@   ro   r   longrangerA   rm   one_hotr?   floatr   r   argmaxappendstackeqanyallrn   rp   ri   r   )rI   r{   r   rJ   featurespredicted_charsstructure_preds_liststructure_ids_list_embedding_featurestructure_stepstructure_predss               r1   r|   SLANeXtSLAHead.forward   s    ;;  #T[[%<%<=U]][h[o[o
  ++M,?,?,B+C5::^k^r^rs!t{{22Q67A !		/;;;S;S T Z Z \77BUBUBWYjkKH!55h?N,333:O ''7%%o6{{-15889Q9QTU9UVZZ[]^bbdd 8 ))EKK0D!$LRT\a\i\ijmm
 eer0   )r   r   r   )r)   r*   r+   r,   rS   _can_record_outputsrE   rX   r   r   r   rk   r~   r   r   r   r|   r/   rP   rQ   s   @r1   r   r      s    - #t     (,f((f $f +,	f !   fr0   r   c                   j    \ rS rSr% SrSr\R                  S-  \S'   Sr	\R                  S-  \S'   Sr
g) SLANeXtForTableRecognitionOutputi  aY  
head_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Hidden-states of the SLANeXtSLAHead at each prediction step, varies up to max `self.config.max_text_length` states (depending on early exits).
head_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
    Attentions of the SLANeXtSLAHead at each prediction step, varies up to max `self.config.max_text_length` attentions (depending on early exits).
Nhead_hidden_stateshead_attentionsr(   )r)   r*   r+   r,   rM   r   rk   r~   r.   r   r/   r(   r0   r1   r   r     s4     48))D0704OU&&-4r0   r   z
    SLANeXt Table Recognition model for table recognition tasks. Wraps the core SLANeXtPreTrainedModel
    and returns outputs compatible with the Transformers table recognition API.
    )custom_introc            	          ^  \ rS rSrS\4U 4S jjr\\S\R                  S\
\   S\\R                     \-  4S j5       5       rSrU =r$ )	SLANeXtForTableRecognitioni  r   c                 |   > [         TU ]  U5        [        US9U l        [	        US9U l        U R                  5         g )N)r   )rF   rX   r   r   r   headr   )rI   r   rK   s     r1   rX   #SLANeXtForTableRecognition.__init__#  s2     'v6"&1	r0   r   rJ   returnc                     U R                   " U40 UD6nU R                  " UR                  40 UD6n[        UR                  UR                  UR
                  UR                  UR
                  S9$ )N)r   r{   r   r   r   )r   r   r   r   r{   r   )rI   r   rJ   backbone_outputshead_outputss        r1   r|   "SLANeXtForTableRecognition.forward)  sl    
  ==@@yy!1!C!CNvN/*<<*88'22+99(33
 	
r0   )r   r   )r)   r*   r+   r,   r8   rX   r   r   rk   r~   r   r   tupler   r|   r/   rP   rQ   s   @r1   r   r     s`    }  
!--
9?@R9S
	u  	!$D	D
  
r0   r   )rk   )backendsc                      ^  \ rS rSrSr\r\rSSS.r	SSS.r
SrSrSrSrSrSSS\S	S4S
 jrS\S   S\S\SSS\S\S\S\S\S\\\   -  S-  S\\\   -  S-  S\S-  S\S-  S\S-  S\\-  S-  S	\4 S jrS\\   4U 4S jjrS rS rS rU =r$ )!SLANeXtImageProcessori9  r   r&   )heightwidthTr   ztorch.Tensorr   r   c                 f
   UR                   u  p4pVUR                  X4-  XV5      nUR                  n[        UR                  UR
                  5      [        XV5      -  n[        XX-  5      n	[        Xh-  5      n
[        R                  " U
[        R                  US9nUS-   [        U5      [        U
5      -  -  S-
  nUR                  5       R                  [        R                  5      nXR                  5       -
  n[        R                  " US:  [        R                  " U5      U5      n[        R                  " US:  [        R                  " U5      U5      n[        R                  " XS-
  :  [        R                   " U5      U5      n[        R                  " XS-
  :  [        R"                  " XS-
  5      U5      nUS-  S-   R                  5       R                  [        R                  5      nSU-
  n[        R                  " U	[        R                  US9nUS-   [        U5      [        U	5      -  -  S-
  nUR                  5       R                  [        R                  5      nUUR                  5       -
  n[        R                  " US:  [        R                  " U5      U5      n[        R                  " US:  [        R                  " U5      U5      n[        R                  " UUS-
  :  [        R                   " U5      U5      n[        R                  " UUS-
  :  [        R"                  " UUS-
  5      U5      nUS-  S-   R                  5       R                  [        R                  5      nSU-
  nUR%                  SS5      R                  [        R&                  5      nUR                  [        R                  5      nUR)                  5       nUS-   R)                  5       nUR)                  5       nUS-   R)                  5       nUS S 2US S 2S 4   US S S 24   4   nUS S 2US S 2S 4   US S S 24   4   nUS S 2US S 2S 4   US S S 24   4   nUS S 2US S 2S 4   US S S 24   4   n UR                  SU	S5      n!UR                  SU	S5      n"UR                  SSU
5      n#UR                  SSU
5      n$U"U$U-  U#U-  -   -  U!U$U-  U#U -  -   -  -   n%U%S-   S	-	  n%U%R%                  SS5      R                  [        R&                  5      n&U&R                  X4X5      R                  UR*                  S
9$ )Nr   g      ?r   rW   r   i      i       )ri   )r   viewr   maxr   r   roundrk   arangero   r   floorrp   int32where
zeros_like	ones_like	full_likeclampuint8r   ri   )'rI   r   r   
batch_sizechannelsr   r   r   scaletarget_heighttarget_width
target_colsrc_colsrc_col_floorsrc_col_fracweight_rightweight_left
target_rowsrc_rowsrc_row_floorsrc_row_fracweight_bottom
weight_topimage_uint8image_int32col_left	col_rightrow_top
row_bottompixel_top_leftpixel_top_rightpixel_bottom_leftpixel_bottom_rightweight_bottom_3dweight_top_3dweight_right_3dweight_left_3dinterpresults'                                          r1   _resizeSLANeXtImageProcessor._resizeG  s   
 /4kk+
f

:0&@DKK,s6/AAfn-U]+\\,emmFS
#eu\7J(JKcQ**5;;7!4!4!66{{=1#4e6F6F|6TVbcMA$5u7G7G7VXef{{=AI#=u|?\^jkQY&qy(QS`
 %t+c188:==ekkJ\)\\-u}}VT
#fm8L(LMPSS**5;;7!4!4!66{{=1#4e6F6F|6TVbcMA$5u7G7G7VXef{{=FQJ#>P\@]_klVaZ'QR
)SUb
 &,s299;>>u{{KM)
kk!S),,U[[9!nnU[[1 %%'"Q&,,.	$$&#a'--/
$Q4(8(47:K%KL%aD)99T1W;M&MN':ag+>q@Q(QR(Jq$w,?4QR7AS)ST(--aB"=!<&++Aq,?$))!Q=^+o.OO
1B B_WiEi ijk G$+a%((5{{:MPPW\WbWbPccr0   images	do_resizeresamplez"tvF.InterpolationMode | int | Nonedo_center_crop	crop_size
do_rescalerescale_factordo_normalize
image_meanN	image_stddo_padpad_sizedisable_groupingreturn_tensorsc           	         Ub$  [        5       (       d  [        R                  S5        [        XS9u  nn0 nUR	                  5        H"  u  nnU(       a  U R                  UUS9nUUU'   M$     [        UU5      n[        UUS9u  nn0 nUR	                  5        H8  u  nnU(       a  U R                  UU5      nU R                  UXxXU5      nUUU'   M:     [        UU5      nU(       a  U R                  UXS9n[        SU0US9$ )Nz&Resampling is not supported in SLANeXt)r=  )r   r   )r<  r=  r   )datatensor_type)r   loggerwarning_oncer   itemsr/  r   center_croprescale_and_normalizepadr   )rI   r1  r2  r   r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  rJ   grouped_imagesgrouped_images_indexresized_images_groupedr   stacked_imagesresized_imagesprocessed_images_groupedprocessed_imagess                            r1   _preprocess!SLANeXtImageProcessor._preprocess  s/   & (@(B(B HI 0EV/o,,!#%3%9%9%;!E>!%N!N,:"5) &< ((>@TU 0E^fv/w,,#% %3%9%9%;!E>!%!1!1.)!L!77
LV_N /=$U+ &< **BDXY#xx(88xo.2B!CQ_``r0   rJ   c                 F   > [         TU ]  " S0 UD6  U R                  5         g rC   )rF   rX   init_decoderrH   s     r1   rX   SLANeXtImageProcessor.__init__  s    "6"r0   c                    / SQnU[        S5       Vs/ s H  nSUS-    S3PM     sn-  nU[        S5       Vs/ s H  nSUS-    S3PM     sn-  nSU;  a  UR                  S5        SU;   a  UR                  S5        S	/U-   S
/-   n[        U5       VVs0 s H  u  p#X2_M	     snnU l        Xl        / SQU l        U R                  S	   U l        U R                  S
   U l        gs  snf s  snf s  snnf )a  
Initialize the decoder vocabulary for table structure recognition.

Builds a character dictionary mapping HTML table structure tokens (e.g., `<thead>`, `<tr>`, `<td>`, colspan/
rowspan attributes) to integer indices. The dictionary includes special `"sos"` (start-of-sequence) and
`"eos"` (end-of-sequence) tokens. Merged `<td></td>` tokens are used in place of standalone `<td>` tokens
when applicable.
)
z<thead>z</thead>z<tbody>z</tbody>z<tr>z</tr><td><td>z</td>   z
 colspan="r   "z
 rowspan="	<td></td>rU  soseos)rU  rV  rZ  N)	r   r   remove	enumeraterE   	charactertd_tokenbos_ideos_id)rI   dict_characterichars       r1   rR  "SLANeXtImageProcessor.init_decoder  s    
 	%)D)QZAwa0)DD%)D)QZAwa0)DDn,!!+.^#!!&)>1UG;,5n,EF,ETW,EF	'4ii&ii& ED Gs   C&C+C0c                    UR                   U l        U R                  SS n[        U R                  5      [        U R                  5      /n[        U R                  5      nUR                  SS9nUR                  SS9R                  n/ nUR                  S   n[        U5       H  n/ n	/ n
[        UR                  S   5       H[  n[        XXU4   5      nUS:  a  X:X  a    O@X;   a  M&  U R                  U   nU	R                  U5        U
R                  X(U4   5        M]     UR                  U	5        [        R                  " U
5      R                  5       R                  5       nM     / SQUS   -   / SQ-   nUWS.$ )a  
Post-process the raw model outputs to decode the predicted table structure into an HTML token sequence.

Converts the model's predicted probability distributions over the structure vocabulary into a sequence of
HTML tokens representing the table structure. The decoded tokens are wrapped with `<html>`, `<body>`, and
`<table>` tags to form a complete HTML table structure.

Args:
    outputs ([`SLANeXtForTableRecognitionOutput`]):
        Raw outputs from the SLANeXt model. The `last_hidden_state` field contains the predicted probability
        distributions over the structure vocabulary at each decoding step, with shape
        `(batch_size, max_text_length, num_classes)`.

Returns:
    `dict`: A dictionary containing:
        - **structure** (`list[str]`): The predicted HTML table structure as a list of tokens, wrapped with
          `<html>`, `<body>`, and `<table>` tags.
        - **structure_score** (`float`): The mean confidence score across all predicted tokens.
r   rW   r   r   )z<html>z<body>z<table>)z</table>z</body>z</html>)	structurestructure_score)r   predr-   ra  rb  r   r  valuesr   r   r_  r   rk   r   meanitem)rI   outputsstructure_probsignored_tokensend_idxstructure_idxstructure_str_listr  batch_indexstructure_list
score_listpositionchar_idxtextri  rh  s                   r1   post_process_table_recognition4SLANeXtImageProcessor.post_process_table_recognition  sn   ( --	))Aa.dkk*C,<=dkk"'..1.5)--!-4;;"((+
 ,KNJ!-"5"5a"89}(-BCDa<H$7-~~h/%%d+!!/x2G"HI : %%n5#kk*5::<AACO - 46H6KKNpp	&?KKr0   )ra  r_  rE   rb  rj  r`  ) r)   r*   r+   r,   r3  r   r9  r   r:  r   r<  do_convert_rgbr2  r6  r8  r;  r   r/  listboolr   strr   r   rO  r   r   rX   rR  rz  r/   rP   rQ   s   @r1   r   r   9  sz    H&J$IC(D,HNIJLF@d@d @d 
	@dD0a^$0a 0a 	0a
 70a 0a 0a 0a 0a 0a DK'$.0a 4;&-0a t0a T/0a +0a  j(4/!0a$ 
%0ad!5 "'H.L .Lr0   r   )r   r8   r   r   r   r   )Mr   dataclassesr   rk   torch.nnrY   torch.nn.functional
functionalrm   $torchvision.transforms.v2.functional
transformsv2tvFhuggingface_hub.dataclassesr    r   r   activationsr   backbone_utilsr   configuration_utilsr	   image_processing_backendsr
   image_processing_utilsr   image_transformsr   r   image_utilsr   r   r   modeling_outputsr   modeling_utilsr   processing_utilsr   r   utilsr   r   r   r   r   utils.genericr   r   utils.import_utilsr   utils.output_capturingr   got_ocr2.configuration_got_ocr2r   got_ocr2.modeling_got_ocr2r    r!   
get_loggerr)   rB  r$   r3   r8   ModulerS   r   r   r   r   r   r   r   r   __all__r(   r0   r1   <module>r     s     !     2 2 . & " 9 3 ; 2 E P P / - 4 l l C * 5 A 
		H	% CD-   E	3 	 CD ($  (  E (F+bii +B +A_ +A\	/ 	
, 
01f+ 1fh 
	5 	5  	5 
!7 

. 	:VL. VL  VLrr0   