Ë
    O/æjÉ  ã                   ó  — 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       úL/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/dora/conf.pyÚupdate_from_argsr      sO   € ð �}‰}ò *ˆÜ˜#œ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ò F‰
ˆˆUÜ˜#œsÔ#Ð#Ð#Ü�4˜ÔÜ�D˜#˜uÕ%ä  ?°4·>±>Ð2Bð C?Ø?B¸eð"Eó Fð FñF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	<   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<   dZ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j                  e   ed!<   d
Z"ee   d
z  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.
        dependents (int): if > 0, start a number of dependent jobs. Requeuing
            will be deactivated and rely on dependent jobs instead.
        container_chdir (bool): set to True when using a container image to chdir.
        force_chdir (bool or None): same as container_chdir, kept for compat.
        srun_args (list[str]): extra srun args, useful for using a container image.
        python (str or None): indicate to submitit to use an alternative python.

    ..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Úaccountr   Ú
dependentsÚcontainer_chdirÚforce_chdirÚ	srun_argsÚpythonÚnodelist)#Ú__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?   r@   rA   © r   r   r#   r#   .   s?  … ñ%ðL €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�[‰[˜ÑÓ$Ø€J�ÓØ!€O�TÓ!Ø%)€K�—‘˜TÑ"Ó)Ù#°DÔ9€Iˆr�w‰w�s‰|Ó9Ø#€FˆB�K‰K˜ÑÓ#Ø!%€Hˆd�3‰i˜$ÑÔ%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)
rB   rC   rD   rE   rQ   rM   rG   rR   rS   rT   rN   r   r   rP   rP   m   s1   … ñð €Eˆ4ÓØ€FˆDÓØ€GˆTÓØ€L�$Ôr   rP   c                   ót   — 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<   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_filezjob.jsonÚjson_job_fileÚby_idÚorphansÚsubmititÚsubmitit_folderÚlatestÚlatest_submititÚarraysN)rB   rC   rD   rE   rW   r   rG   rX   rY   rZ   r\   r^   r_   rN   r   r   rV   rV   ‚   sO   … ñð €HˆcÓØ#€M�3Ó#Ø€Eˆ3ÓØ€GˆSÓØ%€O�SÓ%Ø#€O�SÓ#Ø€FˆCÔr   rV   c                   ó–  ‡ — 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<    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.
        post_git_save_commands (list[str]): sequence of commands to run on a fresh git clone.
        local_code (bool): if True, copies the git clone into /tmp before running.
        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_saveÚpost_git_save_commandsÚ
local_codeNÚ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   )Úselfrq   Úpatterns      r   Úis_excludedzDoraConfig.is_excludedº   s)   € ð —|‘|ò 	ˆGÜ�x Õ)Ùð	ð r   c                 ó`   •— |dv rddl m} |�t         ||«      «      }t        ‰| �  ||«       y )N)rb   rf   r$   )Úto_absolute_path)rc   rx   r   ÚsuperÚ__setattr__)rt   Únamer   rx   r   s       €r   rz   zDoraConfig.__setattr__Â   s4   ø€ ØÐ$Ñ$Ý2ØÐ ÜÑ-¨eÓ4Ó5�Ü‰Ñ˜D %Õ(r   )rB   rC   rD   rE   r   rb   rG   r   rK   r9   rI   rL   r   rc   rM   rd   re   rf   rJ   rg   rh   ri   rV   rj   rk   rl   rn   rp   rv   rz   Ú__classcell__)r   s   @r   ra   ra   ‘   sì   ø… ññ( �[Ó!€CˆÓ!Ù!°$Ô7€GˆR�W‰W�S‰\Ó7Ø€HˆdÓÙ+0ÀÔ+FÐ˜BŸG™G C™LÓFØ€J�ÓØ $€FˆB�K‰K˜ÑÓ$Ø%)€L�"—+‘+˜cÑ"Ó)ð "€GˆSÓ!Ø€CˆÓá¨ZÔ8€Dˆ*Ó8Ø+€O�SÓ+Ø €N�DÓ à€FˆCÓØ€FˆCÓð Cð ¨Dó ÷)ð )r   ra   )rE   Úargparser   Údataclassesr   r   r   Úpathlibr   ÚtypingrI   Úomegaconf.dictconfigr   Ú	omegaconfr	   ÚAnyr   r!   r#   rP   rV   ra   rN   r   r   ú<module>r„      s·   ðñõ ß (Ý Ý Û å +Ý ð*˜2Ÿ6™6ð *¨ó *ðF˜BŸF™Fð F¨ó Fð ÷;&ð ;&ó ð;&ð| ÷ð ó ðð( ÷ð ó ðð ÷5)ð 5)ó ñ5)r   