
    Z j                     f    S r SSKJr  SSKJrJrJrJrJr  SSK	J
r
Jr  \ " S S\5      5       rS/rg)z 
Processor class for LayoutXLM.
   )ProcessorMixin)BatchEncodingPaddingStrategyPreTokenizedInput	TextInputTruncationStrategy)
TensorTypeauto_docstringc            (       ~  ^  \ rS rSrSU 4S j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\
S\
S\\-  S-  S\4&S jj5       rS r\S 5       rSrU =r$ )LayoutXLMProcessor   Nc                 $   > [         TU ]  X5        g )N)super__init__)selfimage_processor	tokenizerkwargs	__class__s       ڃ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/layoutxlm/processing_layoutxlm.pyr   LayoutXLMProcessor.__init__   s    4    text	text_pairboxesword_labelsadd_special_tokenspadding
truncation
max_lengthstridepad_to_multiple_ofreturn_token_type_idsreturn_attention_maskreturn_overflowing_tokensreturn_special_tokens_maskreturn_offsets_mappingreturn_lengthverbosereturn_tensorsreturnc                    U R                   R                  (       a  Ub  [        S5      eU R                   R                  (       a  Ub  [        S5      eUSL a  USL a  [        S5      eU R                  UUS9nUb;  U R                   R                  (       a   Uc  [        U[        5      (       a  U/nUS   nU R
                  " S0 SUb  UOUS   _S	Ub  UOS _S
Ub  UOUS
   _SU_SU_SU_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_UD6nUR                  S5      nUSL a  U R                  UUS   5      nUUS'   U$ )NzdYou cannot provide bounding boxes if you initialized the image processor with apply_ocr set to True.zaYou cannot provide word labels if you initialized the image processor with apply_ocr set to True.TFzKYou cannot return overflowing tokens without returning the offsets mapping.)imagesr*   wordsr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   pixel_valuesoverflow_to_sample_mappingimage )r   	apply_ocr
ValueError
isinstancestrr   popget_overflowing_images)r   r-   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r   featuresencoded_inputss                          r   __call__LayoutXLMProcessor.__call__   s   2 ))u/@v  )){/Fs  %,1G51Pjkk ''vn'U  4 4 > >9CT$$$v )I 
)x/@
#,#8id
 !,%(72C
 $	

  2
 
 "
 "
 
  2
 #8
 #8
 '@
 (B
 $:
  (!
" #
$ *'
. n-$,00Hd9efF"(wr   c                     / nU H  nUR                  X   5        M     [        U5      [        U5      :w  a#  [        S[        U5       S[        U5       35      eU$ )Nz`Expected length of images to be the same as the length of `overflow_to_sample_mapping`, but got z and )appendlenr4   )r   r-   r0   images_with_overflow
sample_idxs        r   r8   )LayoutXLMProcessor.get_overflowing_imagesi   sr    !4J ''(:; 5 #$,F(GG,-.eC8R4S3TV 
 $#r   c                 
    / SQ$ )N)	input_idsbboxattention_maskr1   r2   )r   s    r   model_input_names$LayoutXLMProcessor.model_input_namesw   s    ??r   r2   )NN)NNNNTFNN    NNNFFFFTN)__name__
__module____qualname____firstlineno__r   r
   r   r   listintboolr6   r   r   r	   r   r;   r8   propertyrG   __static_attributes____classcell__)r   s   @r   r   r      s   5  [_HL@D:>#'056:!%)--1-1*/+0',#26)J ++d9o=EV@WWJ %t,='>>E	J
 DId49o!66=J #Yd3i047J !J o-J 3J!33J $JJ J  $JJ  $d{J  $d{J $(J  %)!J" !%#J$ %J& 'J( j(4/)J, 
-J JX$ @ @r   r   N)__doc__processing_utilsr   tokenization_utils_baser   r   r   r   r   utilsr	   r
   r   __all__r2   r   r   <module>rY      sD    / w w / a@ a@ a@H  
 r   