
    ]i                         S r SSKJr  SSKJrJr  SSKJr  SSKJr  SSK	r
SSKJr  SSKJr  S	\
R                  S
\4S jrS	\
R                  S\4S jr\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       rg)z'
Basic configuration for Dora is here.
    )	Namespace)	dataclassfield)fnmatch)PathN)
DictConfig)	OmegaConfdataargsc                     U R                    HH  n[        U[        5      (       d   e[        X5      (       d  M,  [	        X5      nUc  M<  [        XU5        MJ     g)z>Update the given dataclass from the argument parser args.
    N)__dict__
isinstancestrhasattrgetattrsetattr)r
   r   keyvalues       F/mnt/rpi/tmp/demucs-venv-sys/lib/python3.13/site-packages/dora/conf.pyupdate_from_argsr      sJ     }}#s####4D&E 5)     cfgc                 *   [         R                  " USS9n[        U[        5      (       d   eUR	                  5        HS  u  p4[        U[
        5      (       d   e[        X5      (       a  [        XU5        M:  [        SU R                   SU 35      e   g)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
3Cc4    iik
#s####4Du% ?4>>2B C??Be"E F F "r   c                      \ rS rSr% SrSr\\S'   Sr\	\S'   Sr
\\S'   S	r\\S
'   Sr\R                  \   \S'   Sr\\S'   Sr\R                  \   \S'   \" \S9r\R*                  \   \S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\R                  \   \S'   Sr\R                  \   \S'   Sr\R                  \   \S'   Srg)SlurmConfig.   a  
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____firstlineno____doc__r&   int__annotations__r(   floatr)   r+   r,   tpOptionalr.   r   r/   r   listr2   Listr4   r6   r7   boolr9   r:   r;   r<   __static_attributes__r=   r   r   r#   r#   .   s    @ D#MKD#L#&*M2;;s#*Is $GR[[$5E2773<5OSJ#t# s  $GR[[$ CS	  $GR[[$r   r#   c                   R    \ rS rSr% SrSr\\S'   Sr\\S'   Sr	\\S'   Sr
\\S'   Srg	)
SubmitRulesa   a  
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_doner=   N)r>   r?   r@   rA   rB   rO   rJ   rD   rP   rQ   rR   rK   r=   r   r   rM   rM   a   s1     E4FDGTL$r   rM   c                   n    \ rS rSr% SrSr\\S'   Sr\\S'   Sr	\\S'   Sr
\\S'   S	r\\S
'   Sr\\S'   Srg)
ShepConfigv   z}
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arraysr=   N)r>   r?   r@   rA   rB   rV   r   rD   rW   rX   rZ   r\   r]   rK   r=   r   r   rT   rT   v   sE     HcE3GS%OS%#OS#FCr   rT   c                   R  ^  \ rS rSr% Sr\" S5      r\\S'   \" \	S9r
\R                  \   \S'   Sr\\S'   S	r\R"                  \   \S
'   S	r\R"                  \   \S'   Sr\\S'   Sr\\S'   \" \S9r\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   S\S\4S jrU 4S jrSrU =r$ )
DoraConfig   a  
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dirr0   r:   Fgit_saveNsharedgrid_packagezhistory.jsonhistoryxpsshepzrendezvous.txtrendezvous_fileuse_rendezvousgrids_gridscodes_codesarg_namereturnc                 N    U R                    H  n[        X5      (       d  M    g   g)zMReturn True if the given argument name should be excluded from
the signature.TF)r:   r   )selfrn   patterns      r   is_excludedDoraConfig.is_excluded   s%     ||Gx)) $ r   c                 d   > US;   a  SSK Jn  Ub  [        U" U5      5      n[        TU ]  X5        g )N)ra   rc   r%   )to_absolute_path)rb   rv   r   super__setattr__)rq   namer   rv   r   s       r   rx   DoraConfig.__setattr__   s2    $$2 -e45D(r   r=   )r>   r?   r@   rA   rB   r   ra   rD   r   rH   r:   rF   rI   r   rb   rJ   rc   rG   rd   re   rf   rT   rg   rh   ri   rk   rm   rs   rx   rK   __classcell__)r   s   @r   r_   r_      s    $ [!C!!$7GRWWS\7Hd $FBKK$%)L"++c") "GS!CZ8D*8+OS+ ND FCFCC D ) )r   r_   )rB   argparser   dataclassesr   r   r   pathlibr   typingrF   omegaconf.dictconfigr   	omegaconfr	   Anyr   r!   r#   rM   rT   r_   r=   r   r   <module>r      s     (    + *266 * *FBFF F F /% /% /%d   ( 
 
 
 1) 1) 1)r   