o
    i,                     @   s   d dl Z d dlmZmZmZ d dlmZ d dlmZ d dl	m
Z
 g dZg dZedd	G d
d dZe ZeedeejdgdeejdgddZedddeddddd g deddddd g ddZdZdZe
 ZdZdZdedefdd Zd!ZdS )"    N)	dataclassfieldreplace)	safe_openMultiModalGuiderParams)SpatioTemporalScaleFactors)	      ?g?g?gffffff?g333333?皙?333333?      ?        )r
   r   r   r   T)frozenc                   @   s   e Zd ZU 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< edd dZeed< edd dZeed< edefddZedefddZdS )PipelineParams
   seedi   stage_1_heighti   stage_1_widthy   
num_framesg      8@
frame_rate(   num_inference_stepsc                   C   s   t ddddddgdS )N      @r	   ffffff?r      	cfg_scale	stg_scalerescale_scalemodality_scale	skip_step
stg_blocksr    r#   r#   N/home/ubuntu/LTX-2/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py<lambda>#       zPipelineParams.<lambda>)default_factoryvideo_guider_paramsc                   C   s   t ddddddgdS )N      @r	   r   r   r   r   r   r   r#   r#   r#   r$   r%   -   r&   audio_guider_paramsreturnc                 C      t | jd S N   )intr   selfr#   r#   r$   stage_2_height7      zPipelineParams.stage_2_heightc                 C   r,   r-   )r/   r   r0   r#   r#   r$   stage_2_width;   r3   zPipelineParams.stage_2_widthN)__name__
__module____qualname__r   r/   __annotations__r   r   r   r   floatr   r   r(   r   r*   propertyr2   r4   r#   r#   r#   r$   r      s"   
 
r         )r"   )r   r(   r*      i   i  r   r   g?r   r)   r	   )r   r   r   r(   r*   !      z2.3checkpoint_pathr+   c                 C   s   t t}z$t| dd}| pi }W d   n1 sw   Y  |dd}W n ty:   |d|  t Y S w |	t
rBtS |d|pHd tS )	zDetect pipeline params from checkpoint metadata.
    Reads the ``model_version`` field from the safetensors config metadata.
    Returns ``LTX_2_3_PARAMS`` when the version starts with "2.3",
    otherwise falls back to ``LTX_2_PARAMS``.
    pt)	frameworkNmodel_version z@Could not read checkpoint metadata from %s, using LTX-2 defaultsz.Using LTX_2_PARAMS for checkpoint (version=%s)unknown)logging	getLoggerr5   r   metadataget	ExceptionwarningLTX_2_PARAMS
startswith_LTX_2_3_MODEL_VERSION_PREFIXLTX_2_3_PARAMSinfo)r@   loggerfrH   versionr#   r#   r$   detect_paramsh   s   

rT   a6  blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts.)rF   dataclassesr   r   r   safetensorsr   ltx_core.components.guidersr   ltx_core.typesr   DISTILLED_SIGMA_VALUESSTAGE_2_DISTILLED_SIGMA_VALUESr   rL   r(   r*   rO   LTX_2_3_HQ_PARAMSDEFAULT_LORA_STRENGTHDEFAULT_IMAGE_CRFdefaultVIDEO_SCALE_FACTORSVIDEO_LATENT_CHANNELSrN   strrT   DEFAULT_NEGATIVE_PROMPTr#   r#   r#   r$   <module>   sZ    &