o
    ¾e¦iM  ã                   @   sf   d Z ddlmZmZ ddlmZmZmZ ddlm	Z	 ddl
mZmZmZ eG dd„ de	ƒƒZdgZd	S )
z
Processor class for Nougat.
é    )ÚOptionalÚUnion)ÚPreTokenizedInputÚ	TextInputÚTruncationStrategyé   )ÚProcessorMixin)ÚPaddingStrategyÚ
TensorTypeÚauto_docstringc                B       sÄ  e Zd Z‡ fdd„Ze																																		d.dedB d	edB d
eeef dB dddedB dedB dedB dedB dee	B dB dedB de	e
e	 B dB de	e
e	 B dB ded deedf dB deeB e
e B e
e B dB deeB e
e B e
e B dB deeB e
e B e
e B dB dedeeB eB deeB eB dB dedB ded ed!edB d"eeB dB d#edB d$edB d%ed&ed'ed(ed)ef@d*d+„ƒZd,d-„ Z‡  ZS )/ÚNougatProcessorc                    s   t ƒ  ||¡ d S )N)ÚsuperÚ__init__)ÚselfÚimage_processorÚ	tokenizer©Ú	__class__© új/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/nougat/processing_nougat.pyr      s   zNougatProcessor.__init__NÚchannels_firstTFr   Údo_crop_marginÚ	do_resizeÚsizeÚresampleÚPILImageResamplingÚdo_thumbnailÚdo_align_long_axisÚdo_padÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanÚ	image_stdÚdata_formatÚChannelDimensionÚinput_data_formatÚ	text_pairÚtext_targetÚtext_pair_targetÚadd_special_tokensÚpaddingÚ
truncationÚ
max_lengthÚstrideÚis_split_into_wordsÚpad_to_multiple_ofÚreturn_tensorsÚreturn_token_type_idsÚreturn_attention_maskÚreturn_overflowing_tokensÚreturn_special_tokens_maskÚreturn_offsets_mappingÚreturn_lengthÚverbosec#           %      C   sø   |du r|du rt dƒ‚|dur'| j|f|||||||	|
|||||||dœŽ}#|durh| j|fi d|“d|“d|“d|“d|“d	|“d
|“d|“d|“d|“d|“d|“d|“d|“d|“d| “d|!“d|"“Ž}$|du rn|#S |du rt|$S |$d |#d< |#S )ag  
        do_crop_margin (`bool`, *optional*):
            Whether to automatically crop white margins from document images. When enabled, the processor detects
            and removes white space around the edges of document pages, which is useful for processing scanned
            documents or PDFs with large margins.
        do_thumbnail (`bool`, *optional*):
            Whether to create a thumbnail version of the image. When enabled, a smaller version of the image is
            generated alongside the main processed image, which can be useful for preview or faster processing.
        do_align_long_axis (`bool`, *optional*):
            Whether to automatically align images so that the longer axis is horizontal. When enabled, portrait
            images are rotated to landscape orientation, which is typically better for document processing tasks.
        NzBYou need to specify either an `images` or `text` input to process.)r   r   r   r   r   r   r   r   r    r!   r"   r#   r1   r$   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   Ú	input_idsÚlabels)Ú
ValueErrorr   r   )%r   ÚimagesÚtextr   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   ÚinputsÚ	encodingsr   r   r   Ú__call__   sˆ   2ÿðÿþýüûúùø	÷
öõôóòñðïîízNougatProcessor.__call__c                 O   s   | j j|i |¤ŽS )zÊ
        This method forwards all its arguments to NougatTokenizer's [`~PreTrainedTokenizer.post_process_generation`].
        Please refer to the docstring of this method for more information.
        )r   Úpost_process_generation)r   ÚargsÚkwargsr   r   r   rA   †   s   z'NougatProcessor.post_process_generation)"NNNNNNNNNNNNNNr   NNNNTFNNr   FNNNNFFFFT)Ú__name__Ú
__module__Ú__qualname__r   r   ÚboolÚdictÚstrÚintÚfloatÚlistr   r   r   r   r	   r   r
   r@   rA   Ú__classcell__r   r   r   r   r      sÎ    Ýüûúùø	÷
öõ
ôóòñðïîíìë
êéèçæå
äãâá à!ß"Þ#Ýfr   N)Ú__doc__Útypingr   r   Ú$transformers.tokenization_utils_baser   r   r   Úprocessing_utilsr   Úutilsr	   r
   r   r   Ú__all__r   r   r   r   Ú<module>   s   
s