o
    h8                     @   s   d dl Z d dlmZmZ d dlmZ d dlmZmZ ddl	m
Z
 ddlmZ ddlmZ e eZeeejG d	d
 d
eZdS )    N)	dataclassfield)Path)OptionalUnion   )GenerationConfig)TrainingArguments)add_start_docstringsc                       s   e Zd ZU dZedddidZeed< edddidZeed< ed	dd
idZ	e
e ed< ed	ddidZe
e ed< ed	ddidZe
eeeef  ed<  fddZ  ZS )Seq2SeqTrainingArgumentsa  
    Args:
        predict_with_generate (`bool`, *optional*, defaults to `False`):
            Whether to use generate to calculate generative metrics (ROUGE, BLEU).
        generation_max_length (`int`, *optional*):
            The `max_length` to use on each evaluation loop when `predict_with_generate=True`. Will default to the
            `max_length` value of the model configuration.
        generation_num_beams (`int`, *optional*):
            The `num_beams` to use on each evaluation loop when `predict_with_generate=True`. Will default to the
            `num_beams` value of the model configuration.
        generation_config (`str` or `Path` or [`~generation.GenerationConfig`], *optional*):
            Allows to load a [`~generation.GenerationConfig`] from the `from_pretrained` method. This can be either:

            - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
              huggingface.co.
            - a path to a *directory* containing a configuration file saved using the
              [`~GenerationConfig.save_pretrained`] method, e.g., `./my_model_directory/`.
            - a [`~generation.GenerationConfig`] object.
    Fhelpz%Whether to use SortishSampler or not.)defaultmetadatasortish_samplerzFWhether to use generate to calculate generative metrics (ROUGE, BLEU).predict_with_generateNzThe `max_length` to use on each evaluation loop when `predict_with_generate=True`. Will default to the `max_length` value of the model configuration.generation_max_lengthzThe `num_beams` to use on each evaluation loop when `predict_with_generate=True`. Will default to the `num_beams` value of the model configuration.generation_num_beamsz^Model id, file path or url pointing to a GenerationConfig json file, to use during prediction.generation_configc                    s6   t   }| D ]\}}t|tr| ||< q	|S )z
        Serializes this instance while replace `Enum` by their values and `GenerationConfig` by dictionaries (for JSON
        serialization support). It obfuscates the token values by removing their value.
        )superto_dictitems
isinstancer   )selfdkv	__class__ v/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/transformers/training_args_seq2seq.pyr   P   s   

z Seq2SeqTrainingArguments.to_dict)__name__
__module____qualname____doc__r   r   bool__annotations__r   r   r   intr   r   r   strr   r   r   __classcell__r   r   r   r   r      s0   
 		r   )loggingdataclassesr   r   pathlibr   typingr   r   generation.configuration_utilsr   training_argsr	   utilsr
   	getLoggerr    loggerr#   r   r   r   r   r   <module>   s   
