
     ~jk              	          S r SSKr\R                  R                  SS5        SSKrSSKJr  SSKJr	  \	R                  " 5         \R                  " \R                  S   \R                  S9r\R                  5         \" \R                  5      S:  a  \" \R                  S   5      OS	r\R&                  " S
5        \R(                  " S\S5      r\R,                  " 5          \" \R/                  \5      5      r\R2                  \S-
     " \SS2S4   5      rSSS5        \R7                  S5      R9                  5       R;                  5       R=                  S5      R?                  S5        \R7                  S5      R9                  5       R;                  5       R=                  S5      R?                  S5        \R7                  S5      R9                  5       R;                  5       R=                  S5      R?                  S5        \ " S\!" \RD                  5      S\!" \RD                  5      S\S-
  5        g! , (       d  f       GN!= f)a  Torch reference of the Music3 RVQ depth decoder.

Imports MiniMaxMusic3RVQDepthDecoder from the reference project ../../diffusers.
Dumps a seeded random projected sequence, the hidden states, and the logits
of the matching codebook head (sequence of S predicts codebook S-1).
Run from tests/ directory. All paths relative to CWD.

Usage:
    ./mm3-depth-ref.py <checkpoint_dir> [seq_len]
    Nz../../diffusers/src)MiniMaxMusic3RVQDepthDecoder)logging   )torch_dtype      i+  i   float32zparity/depth_seq.binzparity/depth_hidden_ref.binzparity/depth_logits_ref.binseqz	-> hiddenzlogits head)#__doc__syspathinserttorch>diffusers.models.transformers.minimax_music3_rvq_depth_decoderr   diffusers.utilsr   diffusers_loggingdisable_progress_barfrom_pretrainedargvr
   modelevallenintSmanual_seedrandnr   no_grad
projectionhiddenaudio_headslogitssqueeze
contiguousnumpyastypetofileprinttupleshape     mm3-depth-ref.py<module>r.      s  	  ( )  9  & & ($44SXXa[emm\ 

CHH)Cq   # kk!Q
]]_5##C()Fq1u%fQUm4F  A    ! ! # * *9 5 < <=S T q     $ $ & - -i 8 ? ?@] ^ q     $ $ & - -i 8 ? ?@] ^ eU399{E&,,,?PQTUPU V _s    7H11
I 