Ë
    @çiÒ  ã                   ó  — d 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	Z
ddlmZ ddlmZ d	e
j                  d
efd„Zd	e
j                  defd„Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Zy)z'
Basic configuration for Dora is here.
é    )Ú	Namespace)Ú	dataclassÚfield)Úfnmatch)ÚPathN)Ú
DictConfig)Ú	OmegaConfÚdataÚargsc                 óœ   — | j                   D ]=  }t        |t        «      sJ ‚t        ||«      sŒ"t	        ||«      }|€Œ1t        | ||«       Œ? y)z>Update the given dataclass from the argument parser args.
    N)Ú__dict__Ú
isinstanceÚstrÚhasattrÚgetattrÚsetattr)r
   r   ÚkeyÚvalues       ú^/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/dora/conf.pyÚupdate_from_argsr      sJ   € ð �}Œ}ˆÜ˜#œsÔ#Ð#Ð#Ü�4˜ÕÜ˜D #Ó&ˆEØÑ Ü˜˜c 5Õ)ñ ó    Úcfgc                 ó  — t        j                  |d¬«      }t        |t        «      sJ ‚|j	                  «       D ]K  \  }}t        |t
        «      sJ ‚t        | |«      rt        | ||«       Œ2t        d| j                  › d|› �«      ‚ y)z6Update the given dataclass from the hydra config.
    T)ÚresolvezObject of type z does not have an attribute N)
r	   Úto_containerr   ÚdictÚitemsr   r   r   ÚAttributeErrorÚ	__class__)r
   r   Údctr   r   s        r   Úupdate_from_hydrar!      s‹   € ô ×
 Ñ
  ¨dÔ
3€CÜ�cœ4Ô Ð Ð Ø—i‘i–k‰
ˆˆUÜ˜#œsÔ#Ð#Ð#Ü�4˜ÔÜ�D˜#˜uÕ%ä  ?°4·>±>Ð2Bð C?Ø?B¸eð"Eó Fð Fñ "r   c                   óŽ  — e Zd ZU dZdZeed<   dZeed<   dZ	eed<   dZ
eed	<   d
Zej                  e   ed<   dZeed<   d
Zej                  e   ed<    ee¬«      Zej(                  e   ed<   dZeed<   dZeed<   dZeed<   dZeed<   d
Zej                  e   ed<   d
Zej                  e   ed<   d
Zej                  e   ed<   y
)ÚSlurmConfiga+  
    Configuration when scheduling a job.
    This differs slightly from Slurm/Submitit params because this will
    automatically scale some values based on the number of GPUs.

    Args:
        gpus (int): number of total GPUs to schedule. Number of nodes
            and tasks per nodes will be automatically inferred.
        mem_per_gpu (float): amount of memory in GB to schedule
            per gpus.
        time (int): maximum duration for the job in minutes.
        cpus_per_gpu (int): number of cpus per gpu, this will set
            the `cpus_per_task` automatically, based on the
            number of gpus and `one_task_per_node`, unless `cpus_per_task`
            is explicitely provided.
        cpus_per_task (int or None): number of cpus per task.
        partition (str): partition name
        comment (str): comment for the job.
        setup (List[str]): list of shell commands to execute
            before the actual command. Use it for `module load`.
        max_num_timeout (int): maximum number of requeue.
        one_task_per_node (bool): if True, schedules a single task
            per node, otherwise, will schedule one task per gpu (default is False).
        array_parallelism (int): when using job arrays, how many tasks can run
            in parallel.
        qos: (str or None): qos param for slurm.
        account: (str or None): account param for slurm.

    ..warning:: this assumes one task per GPU.
        Set `one_task_per_node` if you do not want that.
        Tasks without any gpus are not really supported at the moment.
    é   Úgpusé(   Úmem_per_gpui°  Útimeé
   Úcpus_per_gpuNÚcpus_per_taskÚlearnlabÚ	partitionÚcomment©Údefault_factoryÚsetupé   Úmax_num_timeoutÚ Ú
constraintFÚone_task_per_nodeé   Úarray_parallelismÚexcludeÚqosÚaccount)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   ÚintÚ__annotations__r'   Úfloatr(   r*   r+   ÚtpÚOptionalr-   r   r.   r   Úlistr1   ÚListr3   r5   r6   Úboolr8   r9   r:   r;   © r   r   r#   r#   .   sÛ   … ñð@ €Dˆ#ƒMØ€K�ÓØ€Dˆ#ÓØ€L�#ÓØ&*€M�2—;‘;˜sÑ#Ó*Ø€IˆsÓØ $€GˆR�[‰[˜ÑÓ$Ù°Ô5€Eˆ2�7‰7�3‰<Ó5Ø€O�SÓØ€J�ÓØ#Ð�tÓ#Ø Ð�sÓ Ø $€GˆR�[‰[˜ÑÓ$Ø €Cˆ�‰�SÑ	Ó Ø $€GˆR�[‰[˜ÑÔ$r   r#   c                   óJ   — e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed<   y)ÚSubmitRulesa:  
    Submit rules describe in which case Shepherd will schedule new jobs.

    Args:
        retry (bool): if true, all failed or canceled jobs will be rescheduled.
        update_pending (bool): if true, all pending jobs whose Slurm parameters
            have changed will be replaced.
        update (bool): if true, all pending or running jobs whose Slurm parameters
            have changed will be replaced.
        replace (bool): if true, all running jobs will be replaced by new jobs.
        replace_done (bool): if true, all done jobs will be relaunched.
    FÚretryÚupdateÚreplaceÚreplace_doneN)
r<   r=   r>   r?   rK   rG   rA   rL   rM   rN   rH   r   r   rJ   rJ   a   s1   … ñð €Eˆ4ÓØ€FˆDÓØ€GˆTÓØ€L�$Ôr   rJ   c                   óf   — e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed<   dZ
eed	<   d
Zeed
<   y)Ú
ShepConfigz‰
    Configuration for Shepherd. Mostly naming conventions for folders and files.
    There should be little reasons to change that.
    zjob.pklÚjob_fileÚby_idÚorphansÚsubmititÚsubmitit_folderÚlatestÚlatest_submititÚarraysN)r<   r=   r>   r?   rQ   r   rA   rR   rS   rU   rW   rX   rH   r   r   rP   rP   v   sE   … ñð €HˆcÓØ€Eˆ3ÓØ€GˆSÓØ%€O�SÓ%Ø#€O�SÓ#Ø€FˆCÔr   rP   c                   óR  ‡ — e Zd ZU dZ ed«      Zeed<    ee¬«      Z	e
j                  e   ed<   dZeed<   dZe
j                   e   ed	<   dZe
j                   e   ed
<   dZeed<   dZeed<    ee¬«      Zeed<   dZeed<   dZeed<   dZeed<   dZeed<   dedefd„Zˆ fd„Zˆ xZS )Ú
DoraConfiga<  
    Main Dora configuration. The main parameters to change are the following.

    Args:
        dir (Path or str): path where Dora will save all useful informations, logs.
            This is also where you should store your checkpoints (see `dora.xp.XP`).
        exclude (List[str]): list of patterns of argument names to ignore
            when computing the XP signature and doing deduplication.
            For instance 'num_workers', etc.
        git_save (bool): when True, experiments can only be scheduled from a clean repo.
            A shallow clone of the repo will be made and execution will happen from there.
            This does not impact `dora run` unless you pass the `--git_save` flag.
        shared (Path or None): if provided, the path to a central repository of XPs.
            For the moment, this only supports sharing hyper-params, logs etc. will stay
            in the per user folder.
        grid_package (str or None): if provided, package to look for grids. Default
            to the package with the `train.py` module followed by `.grids`.
    z	./outputsÚdirr/   r9   FÚgit_saveNÚsharedÚgrid_packagezhistory.jsonÚhistoryÚxpsÚshepzrendezvous.txtÚrendezvous_fileÚuse_rendezvousÚgridsÚ_gridsÚcodesÚ_codesÚarg_nameÚreturnc                 óB   — | j                   D ]  }t        ||«      sŒ y y)zUReturn True if the given argument name should be excluded from
        the signature.TF)r9   r   )Úselfrh   Úpatterns      r   Úis_excludedzDoraConfig.is_excluded©   s$   € ð —|”|ˆGÜ�x Õ)Ùð $ð r   c                 ó`   •— |dv rddl m} |�t         ||«      «      }t        ‰| �  ||«       y )N)r[   r]   r$   )Úto_absolute_path)r\   ro   r   ÚsuperÚ__setattr__)rk   Únamer   ro   r   s       €r   rq   zDoraConfig.__setattr__±   s4   ø€ ØÐ$Ñ$Ý2ØÐ ÜÑ-¨eÓ4Ó5�Ü‰Ñ˜D %Õ(r   )r<   r=   r>   r?   r   r[   rA   r   rE   r9   rC   rF   r   r\   rG   r]   rD   r^   r_   r`   rP   ra   rb   rc   re   rg   rm   rq   Ú__classcell__)r   s   @r   rZ   rZ   „   sÊ   ø… ññ$ �[Ó!€CˆÓ!Ù!°$Ô7€GˆR�W‰W�S‰\Ó7Ø€HˆdÓØ $€FˆB�K‰K˜ÑÓ$Ø%)€L�"—+‘+˜cÑ"Ó)ð "€GˆSÓ!Ø€CˆÓá¨ZÔ8€Dˆ*Ó8Ø+€O�SÓ+Ø €N�DÓ à€FˆCÓØ€FˆCÓð Cð ¨Dó ÷)ð )r   rZ   )r?   Úargparser   Údataclassesr   r   r   Úpathlibr   ÚtypingrC   Úomegaconf.dictconfigr   Ú	omegaconfr	   ÚAnyr   r!   r#   rJ   rP   rZ   rH   r   r   Ú<module>r{      s·   ðñõ ß (Ý Ý Û å +Ý ð*˜2Ÿ6™6ð *¨ó *ðF˜BŸF™Fð F¨ó Fð ÷/%ð /%ó ð/%ðd ÷ð ó ðð( ÷
ð 
ó ð
ð ÷1)ð 1)ó ñ1)r   