o
    i                     @   sn   d Z ddlZddlmZ ee jd Zeeej	vr%ej	
dee ddlZe dejfddZdS )z
Video-only sampling: start frame -> full video.
No text, no actions; single path used by sample_video_from_start_frame_simple.py.
Self-contained: no imports from unified_video_action.
    N)Path   x0c                 C   s   |j \}}}}|||fdksJ d|j  | j| }| d}t| jj}	|	d
d|	ddd}
| jj||
|jjjj|jjjj|jjjj|jjjjd\}}|d }| j|}|||	ddd}|S )zU
    x0: (B, 3, 256, 256) in [-1, 1]
    returns: (B, T, 3, 256, 256) in [-1, 1]
    )      r   zexpected (B,3,256,256), got g(\?r   )bszcondnum_itercfgcfg_scheduletemperaturer   r   )shape	vae_modelencodefloatsamplemul_intmodeln_frames	unsqueezerepeatsample_tokenspolicyautoregressive_model_paramsr	   r
   r   r   decodeview)r   r
   r   bchw	posteriorz0r   r   tokens_zpred r'   @/data/cameron/vidgen/unified_video_action/simple_uva/sampling.pysample_video_from_start_frame   s$   





r)   )__doc__syspathlibr   __file__resolveparentsZ_REPOstrpathinserttorchno_gradTensorr)   r'   r'   r'   r(   <module>   s    