o
    1i"                     @  s   d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
 e
  eG dd dZeG d	d
 d
ZeG dd dZeG dd dZeG dd dZeG dd dZdS )zsCentralized configuration for the encoding pipeline.

All tunables in one place. CLI overrides via argparse flags.
    )annotationsN)	dataclassfield)Pathload_dotenvc                   @  s   e Zd ZU eddZded< eddZded< eddZded< e	d	d
 dZ
ded< dZded< dZded< dZded< dZded< dZded< dZded< dS )R2ConfigR2_ENDPOINT_URL strendpoint_urlR2_ACCESS_KEY_IDaccess_key_idR2_SECRET_ACCESS_KEYsecret_access_keyc                   C  s
   dddS )Nz
pt-englishzpt-indic)englishindic r   r   r   7/home/ubuntu/bench-codecs/codecbench/pipeline/config.py<lambda>   s   zR2Config.<lambda>default_factoryzdict[str, str]source_bucketszpretrain-encodedoutput_bucketxcodecxcodec_bucketz"nikil_new/indic_step_00198000.ckptxcodec_ckpt_key	metafilesmetafiles_bucket   intmax_download_workersi   download_chunk_sizeN)__name__
__module____qualname__osgetenvr   __annotations__r   r   r   r   r   r   r   r   r!   r"   r   r   r   r   r      s   
 r   c                   @  s   e Zd ZU eddZded< eddZded< eddZded< d	Z	ded
< dZ
ded< dZded< dZded< dZded< dS )SupabaseConfigURLr
   r   urlSUPABASE_ADMIN	admin_keySUPABASE_ANONanon_keyencoding_videosvideos_tableworker_encodersworkers_tableencoding_shardsshards_table   r    heartbeat_interval_siX  claim_timeout_sN)r#   r$   r%   r&   r'   r+   r(   r-   r/   r1   r3   r5   r7   r8   r   r   r   r   r)   #   s   
 r)   c                   @  s   e Zd ZU dZded< dZded< dZded< dZded< d	Zd
ed< dZ	d
ed< dZ
d
ed< dZded< dZded< dZded< dS )	VADConfigg      @floatmin_segment_sg      >@max_segment_sg      ?min_speech_duration_s	thresholdi,  r    min_silence_duration_msd   speech_pad_ms>  sample_rateg     r@chunk_threshold_schunk_size_sg       @chunk_overlap_sN)r#   r$   r%   r;   r(   r<   r=   r>   r?   rA   rC   rD   rE   rF   r   r   r   r   r9   1   s   
 r9   c                   @  sn   e Zd ZU dZded< dZded< dZded< d	Zded
< dZded< dZ	ded< dZ
ded< dZded< dS )CodecConfigzHKUSTAudio/xcodec2r   xcodec2_model_idNz
str | Nonexcodec2_custom_ckptzrepos/Spark-TTS-0.5Bbicodec_model_dirzrepos/Spark-TTSspark_tts_reporB   r    	target_srg      @r:   chunk_seconds   xcodec_batch_size   bicodec_batch_size)r#   r$   r%   rH   r(   rI   rJ   rK   rL   rM   rO   rQ   r   r   r   r   rG   A   s   
 rG   c                   @  s   e Zd ZU dZded< eddZded< dZded< dZ	d	ed
< dZ
d	ed< dZd	ed< dZd	ed< dZd	ed< dZded< dZded< dZd	ed< dZd	ed< dZded< dS )WorkerConfigr
   r   	worker_idVAST_OFFER_IDlocaloffer_idgpu_namer   r    prefetch_videosextract_workersrN   ffmpeg_threads   ready_queue_depth2   shard_pack_countz/tmp/pipelinelocal_tmp_dirTboolparallel_encodei  oom_segment_threshold   max_retriesuse_async_pipelineN)r#   r$   r%   rS   r(   r&   r'   rV   rW   rX   rY   rZ   r\   r^   r_   ra   rb   rd   re   r   r   r   r   rR   M   s   
 rR   c                   @  sv   e Zd ZU eedZded< eedZded< ee	dZ
ded< eedZded	< eedZd
ed< edddZdS )PipelineConfigr   r   r2r)   supabaser9   vadrG   codecrR   workerreturn'PipelineConfig'c                 C  s   t   |  S )Nr   )clsr   r   r   from_envf   s   zPipelineConfig.from_envN)rl   rm   )r#   r$   r%   r   r   rg   r(   r)   rh   r9   ri   rG   rj   rR   rk   classmethodro   r   r   r   r   rf   ^   s   
 rf   )__doc__
__future__r   r&   dataclassesr   r   pathlibr   dotenvr   r   r)   r9   rG   rR   rf   r   r   r   r   <module>   s&    