o
    ni                     @  s`  d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ e dd Zejdd	i id
dejejddejdddejddddejddddejddddejdddddejdddd dejd!d"d#dd$ejd%dd&dd$ejd'ddd(dejd)ddd*dejd+dd,d-											d=d>d;d<ZdS )?zwBeta versions of wandb CLI commands.

These commands are experimental and may change or be removed in future versions.
    )annotationsN)
UsageErrorWandbCoreNotAvailableError)get_core_pathc               
   C  s   ddl } | jjdd | j rtd| jj dzt  W dS  tyD } z| j	d|  t
j|dd	d
 W Y d}~dS d}~ww )z9Beta versions of wandb CLI commands. Requires wandb-core.r   N
wandb_beta)process_contextzMwandb beta commands can only be used with wandb-core. Please make sure that `z` is not set.z using `wandb beta`. failed with redT)fgerr)	wandb.env_sentryconfigure_scopeenvis_require_legacy_servicer   _REQUIRE_LEGACY_SERVICEr   r   	exceptionclicksecho)wandbe r   L/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/wandb/cli/beta.pybeta   s&   
r   syncdefault_mapzUpload a training run to W&B)namecontext_settingshelp	wandb_dir   T)exists)nargstypez--idrun_idzThe run you want to upload to.)r   z	--projectz-pz"The project you want to upload to.z--entityz-ezThe entity to scope to.z--skip-consoleFzSkip console logs)is_flagdefaultr   z--appendz
Append runz	--includez-iz,Glob to include. Can be used multiple times.)r   multiplez	--excludez,Glob to exclude. Can be used multiple times.z--mark-synced/--no-mark-syncedzMark runs as syncedz--skip-synced/--no-skip-syncedzSkip synced runsz	--dry-runz-Perform a dry run without uploading anything.)r$   r   
str | Noneprojectentityskip_consoleboolappendincludeexcludeskip_syncedmark_synceddry_runreturnNonec                 C  sv  dd l }ddlm} t }|rM|D ]:}tt||}|D ]+}| s&qdd |dD }t	|dkr?t
d| d qt	|dkrJ|| qqn|d	d
 t|dD  |D ]}tt||}|D ]}| stqm||v r}|| qmq_|	rt }|D ]&}dd |dD }t	|dkrt
d| d qt	|dkr|| q||8 }|rt	|dkrtjddd td |std d S td |D ]
}td|  q|rd S tjj  |jjtt	|| d9}g }|D ]!}dd |dD d }|jtj|||||||
d}|| q|j|D ]}q$W d    d S 1 s4w   Y  d S )Nr   )	cpu_countc                 S     g | ]}|  r|qS r   is_file.0pr   r   r   
<listcomp>m       zsync_beta.<locals>.<listcomp>z*.wandbr   z(Multiple wandb files found in directory z
, skippingc                 S  s   h | ]}|j qS r   )parentr8   r   r   r   	<setcomp>s   s    zsync_beta.<locals>.<setcomp>z
**/*.wandbc                 S  r5   r   r6   r8   r   r   r   r;      r<   z*.wandb.syncedz/Multiple wandb.synced files found in directory z$id can only be set for a single run.T)r
   zNo runs to sync.zFound runs:z  )max_workersc                 S  r5   r   r6   r8   r   r   r   r;      r<   )r#   r(   r)   r*   r,   r0   )concurrent.futuresmultiprocessingr4   setlistpathlibPathglobis_dirlenprintaddupdateremover   echosysexitr   sdkwandb_setupsetupfuturesProcessPoolExecutorminsubmit_syncr,   as_completed)ctxr   r#   r(   r)   r*   r,   r-   r.   r/   r0   r1   
concurrentr4   pathspatternmatching_dirsdwandb_filessynced_pathspathwandb_synced_filesexecutorrS   
wandb_filefuture_r   r   r   	sync_beta+   s   5
 






$rg   )NNNNFFNNTTF)r#   r'   r(   r'   r)   r'   r*   r+   r,   r+   r-   r'   r.   r'   r/   r+   r0   r+   r1   r+   r2   r3   )__doc__
__future__r   rD   rN   r   r   wandb.errorsr   r   
wandb.utilr   groupr   commandpass_contextargumentrE   optionrg   r   r   r   r   <module>   sz    
*