Ë
    Áš¾jê  ã                   ó2  — d Z ddlmZmZmZmZmZmZmZ ddl	m
Z
 ddlZddlZddlmZmZ ddlmZ ddlmZmZmZ dd	lmZmZ dddd
d e«       dfdee   dee   dee   dedeeeef      dee   deee      defd„Zdddd
d e«       fdee   dee   dee   dedeeeef      dee   defd„Zde
fd„Zdddd
d e«       fde
dedee   dee   dee   dedeeeef      dee   fd„Zde
deeeef      fd„Zde
fd„Zde
deeeef      deegef   fd„Z y)z1
A logger that logs training activity to MLflow.
é    )ÚDictÚAnyÚTupleÚCallableÚListÚOptionalÚIO)Ú
ModuleTypeN)ÚLanguageÚload)ÚSimpleFrozenListé   )Údict_to_dotÚdot_to_dictÚmatcher_for_regex_patterns)Úsetup_default_console_loggerÚLoggerTFÚrun_idÚexperiment_idÚrun_nameÚnestedÚtagsÚremove_config_valuesÚlog_custom_statsÚreturnc                 ó  ‡ ‡‡‡‡‡‡‡— t        «       Št        j                  t        j                  fdt        dt
        dt
        dt        t        t        t        t        f   gdf   t        g df   f   fˆˆˆˆˆˆ ˆˆfd„}|S )a�  Creates a logger that interoperates with the MLflow framework.

    Args:
        run_id (Optional[str]):
            Unique ID of an existing MLflow run to which parameters and metrics are logged. Can be omitted if `experiment_id` and `run_id` are provided. Defaults to None.
        experiment_id (Optional[str]):
            ID of an existing experiment under which to create the current run. Only applicable when `run_id` is `None`. Defaults to None.
        run_name (Optional[str]):
            Name of new run. Only applicable when `run_id` is `None`. Defaults to None.
        nested (bool):
            Controls whether run is nested in parent run. `True` creates a nested run. Defaults to False.
        tags (Optional[Dict[str, Any]]):
            A dictionary of string keys and values to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run. Defaults to None.
        remove_config_values (List[str]):
            A list of values to exclude from the config before it is uploaded to MLflow. Defaults to an empty list.
        log_custom_stats (Optional[List[str]]):
            A list of regular expressions that will be applied to the info dictionary passed to the logger. Statistics and metrics that match these regexps will be automatically logged. Defaults to None.

    Returns:
        LoggerT: Logger instance.
    ÚnlpÚstdoutÚstderrr   Nc           
      ó–   •‡— t        ‰«      Št        ‰| ‰‰‰‰	‰‰
«       dt        t        t        t
        f      fˆˆfd„}dˆfd„}||fS )NÚinfoc                 ó8   •— t        ‰| «       t        ‰| ‰«       y ©N)Ú_log_step_mlflowÚ_log_custom_stats)r!   Ú
match_statÚmlflows    €€ú^/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/spacy_loggers/mlflow.pyÚlog_stepz8mlflow_logger_v2.<locals>.setup_logger.<locals>.log_step@   s   ø€ Ü˜V TÔ*Ü˜f d¨JÕ7ó    c                  ó   •— t        ‰ «       y r#   ©Ú_finalize_mlflow©r'   s   €r(   Úfinalizez8mlflow_logger_v2.<locals>.setup_logger.<locals>.finalizeD   s   ø€ Ü˜VÕ$r*   ©r   N)r   Ú_setup_mlflowr   r   Ústrr   )r   r   r   r)   r/   r&   r   r   r'   r   r   r   r   r   s        @€€€€€€€€r(   Úsetup_loggerz&mlflow_logger_v2.<locals>.setup_logger1   s[   ù€ ô 0Ð0@ÓAˆ
ÜØØØØØØØØ ô		
ð	8œ8¤D¬¬c¨¡NÑ3ö 	8õ	%ð ˜Ð!Ð!r*   ©Ú_import_mlflowÚsysr   r   r   r	   r   r   r   r2   r   )	r   r   r   r   r   r   r   r3   r'   s	   ``````` @r(   Úmlflow_logger_v2r7      sv   ÿ€ ô< Ó€Fô %(§J¡J¼S¿Z¹Zñ"Üð"Ü!ð"Ü8:ð"ä	Œxœœc¤3˜h™Ð(¨$Ð.Ñ/´¸"¸d¸(Ñ1CÐCÑ	D÷"ô "ð0 Ðr*   c                 ó   ‡ ‡‡‡‡‡‡— t        «       Št        j                  t        j                  fdt        dt
        dt
        dt        t        t        t        t        f   gdf   t        g df   f   fˆˆˆˆˆ ˆˆfd„}|S )a¡  Creates a logger that interoperates with the MLflow framework.

    Args:
        run_id (Optional[str]):
            Unique ID of an existing MLflow run to which parameters and metrics are logged. Can be omitted if `experiment_id` and `run_id` are provided. Defaults to None.
        experiment_id (Optional[str]):
            ID of an existing experiment under which to create the current run. Only applicable when `run_id` is `None`. Defaults to None.
        run_name (Optional[str]):
            Name of new run. Only applicable when `run_id` is `None`. Defaults to None.
        nested (bool):
            Controls whether run is nested in parent run. `True` creates a nested run. Defaults to False.
        tags (Optional[Dict[str, Any]]):
            A dictionary of string keys and values to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run. Defaults to None.
        remove_config_values (List[str]):
            A list of values to exclude from the config before it is uploaded to MLflow. Defaults to an empty list.

    Returns:
        LoggerT: Logger instance.
    r   r   r   r   Nc           
      ó¤   •‡‡— t        | ||«      \  ŠŠt        ‰| ‰‰‰‰	‰‰
«       dt        t        t        t
        f      fˆˆfd„}dˆˆfd„}||fS )Nr!   c                 ó.   •—  ‰| «       t        ‰| «       y r#   )r$   )r!   Úconsole_log_stepr'   s    €€r(   r)   z8mlflow_logger_v1.<locals>.setup_logger.<locals>.log_step{   s   ø€ Ù˜TÔ"Ü˜V TÕ*r*   c                  ó*   •—  ‰ «        t        ‰«       y r#   r,   )Úconsole_finalizer'   s   €€r(   r/   z8mlflow_logger_v1.<locals>.setup_logger.<locals>.finalize   s   ø€ ÙÔÜ˜VÕ$r*   r0   )r   r1   r   r   r2   r   )r   r   r   r)   r/   r=   r;   r   r'   r   r   r   r   r   s        @@€€€€€€€r(   r3   z&mlflow_logger_v1.<locals>.setup_loggerj   sk   ú€ ô .JØ�˜ó.
Ñ*ÐÐ*ô 	ØØØØØØØØ ô		
ð	+œ8¤D¬¬c¨¡NÑ3ö 	+ö	%ð ˜Ð!Ð!r*   r4   )r   r   r   r   r   r   r3   r'   s   `````` @r(   Úmlflow_logger_v1r>   M   sv   þ€ ô6 Ó€Fô %(§J¡J¼S¿Z¹Zñ"Üð"Ü!ð"Ü8:ð"ä	Œxœœc¤3˜h™Ð(¨$Ð.Ñ/´¸"¸d¸(Ñ1CÐCÑ	D÷"ó "ð6 Ðr*   c                  ó\   — 	 dd l } ddl m}m}m}m}m} | S # t        $ r t        d«      ‚w xY w)Nr   )Ú	start_runÚ
log_metricÚlog_metricsÚlog_artifactÚend_runz°The 'mlflow' library could not be found - did you install it? Alternatively, specify the 'ConsoleLogger' in the 'training.logger' config section, instead of the 'MLflowLogger'.)r'   r@   rA   rB   rC   rD   ÚImportError)r'   r@   rA   rB   rC   rD   s         r(   r5   r5   ˆ   s?   € ð
Û÷	
õ 	
ð €Møô ò 
ÜðOó
ð 	
ð
ús   ‚ –+r'   r   c                 ó¶  — |j                   j                  «       }t        |«      }	|D ]  }
|	|
= Œ t        |	«      }| j	                  |||||¬«       t        |	j                  «       «      }t        dt        |«      d«      D �cg c]
  }|||dz    ‘Œ }}|D ]7  }| j                  |D ��ci c]  \  }}|j                  dd«      |“Œ c}}«       Œ9 y c c}w c c}}w )N)r   r   r   r   r   r   éd   ú@Ú )ÚconfigÚinterpolater   r   r@   ÚlistÚitemsÚrangeÚlenÚ
log_paramsÚreplace)r'   r   r   r   r   r   r   r   rJ   Ú
config_dotÚfieldÚconfig_dot_itemsÚiÚconfig_dot_batchesÚbatchÚkÚvs                    r(   r1   r1   �   sú   € ð �Z‰Z×#Ñ#Ó%€FÜ˜VÓ$€JØ%ò ˆØ�uÑðä˜Ó$€Fà
×ÑØØ#ØØØð ô ô ˜J×,Ñ,Ó.Ó/Ðä/4°Q¼Ð<LÓ8MÈsÓ/SöØ*+Ð˜˜Q ™WÒ%ðÐð ð $ò EˆØ×Ñ¸U×C±T°Q¸˜1Ÿ9™9 S¨"Ó-¨qÑ0ÓCÕDñEùòùó Ds   ÂCÂ(Cr!   c           
      óR  — |€y |d   }|d   }|d   }|j                  dd «      }|�| j                  d|«       |r6| j                  |j                  «       D ��ci c]  \  }}d|› �|“Œ c}}«       t	        |t
        «      r\| j                  t        |«      j                  «       D ��ci c](  \  }}t	        |t        «      st	        |t        «      r||“Œ* c}}«       |r=|t        |d   «      d   k(  r(t        |«      }| j                  j                  |d«       y y y c c}}w c c}}w )	NÚscoreÚother_scoresÚlossesÚoutput_pathÚloss_Úcheckpointsr   Úbest)ÚgetrA   rB   rM   Ú
isinstanceÚdictr   ÚfloatÚintÚmaxr   ÚspacyÚ	log_model)	r'   r!   r[   r\   r]   r^   rX   rY   r   s	            r(   r$   r$   ½   s"  € ð €|Øà�‰M€EØ˜Ñ'€LØ�(‰^€FØ—(‘(˜=¨$Ó/€KØÐØ×Ñ˜' 5Ô)ÙØ×Ñ°v·|±|³~×F©t¨q°!˜e A 3˜K¨™NÓFÔGÜ�,¤Ô%Ø×Ñô (¨Ó5×;Ñ;Ó=÷á�A�qÜ˜a¤Ô'¬:°a¼Ô+=ð �1‘óô	
ñ �u¤ D¨Ñ$7Ó 8¸Ñ ;Ò;Ü�;ÓˆØ�‰×Ñ˜s FÕ+ð <€{ùó Gùós   ÁD
Â(-D#
c                 ó$   — | j                  «        y r#   )rD   r.   s    r(   r-   r-   Ù   s   € ð ‡N�NÕr*   Úmatcherc                 ó¨   — |�J|j                  «       D ��ci c]  \  }} ||«      sŒ||“Œ }}}t        |«      r| j                  |«       y y y c c}}w r#   )rM   rO   rB   )r'   r!   rk   rX   rY   Úmatcheds         r(   r%   r%   ß   sS   € ð ÐØ$(§J¡J£L×?™D˜A˜q±G¸AµJ�1�a‘4Ð?ˆÑ?ÜˆwŒ<Ø×Ñ˜wÕ'ð ð ùÛ?s
   –A§A)!Ú__doc__Útypingr   r   r   r   r   r   r	   Útypesr
   Úosr6   rh   r   r   Ú
spacy.utilr   Úutilr   r   r   r   r   r2   Úboolr7   r>   r5   r1   r$   r-   r%   © r*   r(   ú<module>rv      s<  ðñ÷ B× AÑ AÝ Û 	Û 
ç  Ý 'ß FÑ Fß 7ð
 !Ø#'Ø"ØØ%)Ù&6Ó&8Ø,0ñ8Ø�S‰Mð8à˜C‘=ð8ð �s‰mð8ð ð	8ð
 �4˜˜S˜‘>Ñ
"ð8ð ˜s™)ð8ð ˜t C™yÑ)ð8ð ó8ðz !Ø#'Ø"ØØ%)Ù&6Ó&8ñ8Ø�S‰Mð8à˜C‘=ð8ð �s‰mð8ð ð	8ð
 �4˜˜S˜‘>Ñ
"ð8ð ˜s™)ð8ð ó8ðv˜
ó ð0 !Ø#'Ø"ØØ%)Ù&6Ó&8ñEØðEà	ðEð �S‰MðEð ˜C‘=ð	Eð
 �s‰mðEð ðEð �4˜˜S˜‘>Ñ
"ðEð ˜s™)óEð@,Øð,à
�4˜˜S˜‘>Ñ
"ó,ð8Øóð(Øð(Ø& t¨C°¨H¡~Ñ6ð(ØAIÈ3È%ÐQUÈ+ÑAVô(r*   