
    bi                     L    d dl mZmZ d dlmZ d dlmZ e G d de             Zy)    )	dataclassfield)Optional)TrainingArgumentsc                       e Zd ZU dZ edddi      Zeed<    edddi      Zeed	<    ed
ddi      Z	e
e   ed<    edddi      Zeed<    edddi      Ze
e   ed<    edddi      Ze
e   ed<    ed
ddi      Ze
e   ed<    edddi      Zeed<    edddi      Zeed<    edddi      Zeed<    ed
dd i      Ze
e   ed!<    fd"Z xZS )#	PRMConfiga1  
    Configuration class for the [`PRMTrainer`].

    This class includes only the parameters that are specific to PRM training. For a full list of training arguments,
    please refer to the [`~transformers.TrainingArguments`] documentation. Note that default values in this class may
    differ from those in [`~transformers.TrainingArguments`].

    Using [`~transformers.HfArgumentParser`] we can turn this class into
    [argparse](https://docs.python.org/3/library/argparse#module-argparse) arguments that can be specified on the
    command line.

    Parameters:
        max_length (`int` or `None`, *optional*, defaults to `1024`):
            Maximum length of the sequences (prompt + completion) used for truncation.
        max_prompt_length (`int` or `None`, *optional*, defaults to `512`):
            Maximum length of the prompt used for truncation.
        max_completion_length (`int` or `None`, *optional*, defaults to `None`):
            Maximum length of the completion used for truncation. The completion is the concatenation of the steps.
        disable_dropout (`bool`, *optional*, defaults to `True`):
            Whether to disable dropout in the model.
        step_separator (`str`, *optional*, defaults to `"\n"`):
            Separator used to separate each step of the reasoning process.
        train_on_last_step_only (`bool`, *optional*, defaults to `False`):
            Whether to train only on the last step.
        dataset_num_proc (`int`, *optional*, defaults to `None`):
            Number of processes to use for processing the dataset.
    gh㈵>helpz$The initial learning rate for AdamW.)defaultmetadatalearning_rate
   zLog every X updates steps. Should be an integer or a float in range `[0,1)`. If smaller than 1, will be interpreted as ratio of total training steps.logging_stepsNzWhether to use bf16 (mixed) precision instead of 32-bit. Requires Ampere or higher NVIDIA architecture or Intel XPU or using CPU (use_cpu) or Ascend NPU. If not set, it defaults to `True` if `fp16` is not set.bf16TzWhether or not to average tokens across devices. If enabled, will use all_reduce to synchronize num_tokens_in_batch for precise loss calculation. Reference: https://github.com/huggingface/transformers/issues/34242 average_tokens_across_devicesi   zJMaximum length of the sequences (prompt + completion) used for truncation.
max_lengthi   z1Maximum length of the prompt used for truncation.max_prompt_lengthzgMaximum length of the completion used for truncation. The completion is the concatenation of the steps.max_completion_lengthz<Whether to disable dropout in the model and reference model.disable_dropout
z>Separator used to separate each step of the reasoning process.step_separatorFz'Whether to train only on the last step.train_on_last_step_onlyz6Number of processes to use for processing the dataset.dataset_num_procc                 v    | j                   | j                   n| j                   | _         t        |           y )N)r   fp16super__post_init__)self	__class__s    Q/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/trl/trainer/prm_config.pyr   zPRMConfig.__post_init__o   s*    '+yy'8Odii	    )__name__
__module____qualname____doc__r   r   float__annotations__r   r   r   boolr   r   intr   r   r   r   strr   r   r   __classcell__)r   s   @r   r   r      s   : !@AM5  ! D
M5  ! !
D(4.  +0 E
+!4  !&fg!J  (-MN(x}  ,1 
,8C=  "XYOT   Z[NC  %*CD%T  ',RS'hsm 
   r    r   N)dataclassesr   r   typingr   transformersr   r    r    r   <module>r/      s/    )  * \ ! \  \ r    