
    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 LayoutLMv3.
   )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$ )LayoutLMv3Processor   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/layoutlmv3/processing_layoutlmv3.pyr   LayoutLMv3Processor.__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 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.)imagesr*   wordsr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   pixel_valuesToverflow_to_sample_mapping )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__LayoutLMv3Processor.__call__   s   0 ))u/@v  )){/Fs 
 ''vn'U  4 4 > >9CT$$$v )I 
)x/@
#,#8id
 !,%(72C
 $	

  2
 
 "
 "
 
  2
 #8
 #8
 '@
 (B
 $:
  (!
" #
$ *'
. n-$,00Hd9efF)/~&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lenr3   )r   r-   r0   images_with_overflow
sample_idxs        r   r7   *LayoutLMv3Processor.get_overflowing_imagese   sr    !4J ''(:; 5 #$,F(GG,-.eC8R4S3TV 
 $#r   c                 
    / SQ$ )N)	input_idsbboxattention_maskr/   r1   )r   s    r   model_input_names%LayoutLMv3Processor.model_input_namess   s    FFr   r1   )NN)NNNNTFNN    NNNFFFFTN)__name__
__module____qualname____firstlineno__r   r
   r   r   listintboolr5   r   r   r	   r   r:   r7   propertyrF   __static_attributes____classcell__)r   s   @r   r   r      s   5  [_HL@D:>#'056:!%)--1-1*/+0',#26)F ++d9o=EV@WWF %t,='>>E	F
 DId49o!66=F #Yd3i047F !F o-F 3J!33F $JF F  $JF  $d{F  $d{F $(F  %)!F" !%#F$ %F& 'F( j(4/)F, 
-F FP$ G Gr   r   N)__doc__processing_utilsr   tokenization_utils_baser   r   r   r   r   utilsr	   r
   r   __all__r1   r   r   <module>rX      sD    / w w / ]G. ]G ]G@ !
!r   