+
    Pj
                         ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIHt ] P                  ! ]
4      t ! R R4      tRtRtR	 R
 lt ! R R]4      tR# )    N)nn)BaseConditionerTokenizedText)download_if_necessaryc                   H   a  ] tR t^t o RtV 3R lR ltV 3R lR ltRtV tR# )SentencePieceTokenizera~  This tokenizer should be used for natural language descriptions.
For example:
["he didn't, know he's going home.", 'shorter sentence'] =>
[[78, 62, 31,  4, 78, 25, 19, 34],
[59, 77, PAD, PAD, PAD, PAD, PAD, PAD]]

Args:
    n_bins (int): should be equal to the number of elements in the sentencepiece tokenizer.
    tokenizer_path (str): path to the sentencepiece tokenizer model.

c                *   < V ^8  d   QhRS[ RS[RR/# )   nbinstokenizer_pathreturnNintstr)format__classdict__s   "u/Users/ahmed/devFolder/Ultron/claude-voice/gateway/.venv/lib/python3.14/site-packages/pocket_tts/conditioners/text.py__annotate__#SentencePieceTokenizer.__annotate__   s"     
 
c 
3 
4 
    c                   \         P                  R V4       \        V4      p\        P                  ! \        V4      4      V n        WP                  P                  4       8X  g'   Q RV P                  P                  4        RV R24       hR# )z'Loading sentencepiece tokenizer from %sz'sentencepiece tokenizer has vocab size=z but nbins=z was specifiedN)loggerinfor   sentencepieceSentencePieceProcessorr   sp
vocab_size)selfr   r   s   &&&r   __init__SentencePieceTokenizer.__init__   su    =~N.~>66s>7JK**,, 	
5dgg6H6H6J5K;W\V]]kl	
,r   c                &   < V ^8  d   QhRS[ RS[/# )r
   textr   r   r   )r   r   s   "r   r   r   "   s     X XS X] Xr   c           	         \        \        P                  ! V P                  P	                  V\
        R 7      4      R,          4      # ))out_type)N:NNN)r   torchtensorr   encoder   )r   r"   s   &&r   __call__SentencePieceTokenizer.__call__"   s,    U\\$''...*LMgVWWr   )r   N)	__name__
__module____qualname____firstlineno____doc__r   r)   __static_attributes____classdictcell__)r   s   @r   r   r      s      

 
X Xr   r   i  zehf://kyutai/pocket-tts-without-voice-cloning/tokenizer.model@d4fdd22ae8c8e1cb3634e150ebeff1dab2d16df3c                $    V ^8  d   QhR\         /# )r
   r   )r   )r   s   "r   r   r   -   s     T T5 Tr   c                 *    \        \        \        4      # )zReturn a SentencePieceTokenizer with the default model path and vocab size.

Downloads the tokenizer model from HuggingFace on first use.
)r   DEFAULT_TOKENIZER_N_BINSDEFAULT_TOKENIZER_PATH r   r   get_default_tokenizerr7   -   s    
 "":<RSSr   c                   f   a a ] tR t^5t oRtV3R lV 3R lltV3R lR ltV3R lR ltRtVt	V ;t
# )	LUTConditionera7  Lookup table TextConditioner.

Args:
    n_bins (int): Number of bins.
    dim (int): Hidden dim of the model (text-encoder/LUT).
    output_dim (int): Output dim of the conditioner.
    tokenizer (str): Name of the tokenizer.
    possible_values (list[str] or None): list of possible values for the tokenizer.
c                2   < V ^8  d   QhRS[ RS[RS[ RS[ /# )r
   n_binsr   dim
output_dimr   )r   r   s   "r   r   LUTConditioner.__annotate__@   s)     8 8s 8C 8c 8s 8r   c                   < \         SV `  W4R 7       \        W4      V n        \        P
                  ! V^,           V P                  4      V n        R# ))r<   r=   N)superr   r   	tokenizerr   	Embeddingr<   embed)r   r;   r   r<   r=   	__class__s   &&&&&r   r   LUTConditioner.__init__@   s9    S8/G\\&1*dhh7
r   c                &   < V ^8  d   QhRS[ RS[/# )r
   xr   r#   )r   r   s   "r   r   r>   E   s     % % % %r   c                    V P                  V4      pV^ ,          P                  V P                  P                  P                  4      p\        V4      # r   )rA   torC   weightdevicer   )r   rG   tokenss   && r   prepareLUTConditioner.prepareE   s=    "djj//667V$$r   c                :   < V ^8  d   QhRS[ RS[P                  /# )r
   inputsr   )r   r&   Tensor)r   r   s   "r   r   r>   J   s      ] u|| r   c                6    V P                  V^ ,          4      pV# rI   )rC   )r   rQ   embedss   && r   _get_conditionLUTConditioner._get_conditionJ   s    F1I&r   )rC   rA   )r+   r,   r-   r.   r/   r   rN   rU   r0   r1   __classcell__)rD   r   s   @@r   r9   r9   5   s-     8 8
% %
  r   r9   )loggingr   r&   r   pocket_tts.conditioners.baser   r   pocket_tts.utils.utilsr   	getLoggerr+   r   r   r4   r5   r7   r9   r6   r   r   <module>r\      sW        G 8			8	$X X2   ? T_ r   