o
    H!i
                     @   s4   d dl Z ddlmZ ddlmZ G dd deZdS )    N   )BaseTrainer   )MODELSc                   @   s*   e Zd ZdZeZdd ZdefddZdS )
UadTrainerzUad Model Trainerc                 C   sb   | j | jjd | jjdur| j | jj | jjr-| jjdkr/| j j| jjdd dS dS dS )zupdate training configZ
SegDatasetN T)Zis_backbone)	Z
pdx_configZupdate_datasetglobal_configZdataset_dirtrain_configZnum_classesZupdate_num_classesZpretrain_weight_pathZupdate_pretrained_weights)self r   u/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/paddlex/modules/anomaly_detection/trainer.pyupdate_config   s   
zUadTrainer.update_configreturnc                 C   s   d|   i}tjdd | jjdur| jj|d< | jjdur%| jj|d< | jjdur1| jj|d< | jjdurC| jjdkrC| jj|d< | j	j
durO| j	j
|d	< | jjrY| jj|d
< | jjrgd|d< | jj|d< | jdd|d< | jdd|d< |S )zget key-value arguments of model training function

        Returns:
            dict: the arguments of training function.
        ZdeviceZFLAGS_npu_jit_compileN
batch_sizelearning_rateepochs_itersr   resume_pathsave_dirZ	log_itersTZdo_evalZsave_intervalZdy2stFampZOFF)Z
get_deviceosenvironpopr	   r   r   r   r   r   outputZlog_intervalZeval_intervalget)r
   Z
train_argsr   r   r   get_train_kwargs(   s*   zUadTrainer.get_train_kwargsN)	__name__
__module____qualname____doc__r   entitiesr   dictr   r   r   r   r   r      s
    r   )r   baser   Z
model_listr   r   r   r   r   r   <module>   s   