+
    ƒ°ñj(  ã                   ó¤   € ^ RI Ht ^RIHtHt ^RIHt  ! R R]4      t ! R R]4      t ! R R	]P                  4      t
 ! R
 R]4      tRR ltR# )é    )Úsd1_clip)ÚQwenImageTokenizerÚQwenImageTEModel)ÚQwen25_7BVLIc                   óV   a a€ ] tR t^t oR/ 3V 3R lltRV3R lV 3R llltRtVtV ;t# )ÚKandinsky5TokenizerNc                ón   <€ \         SV `  WR 7       RV n        \        P                  ! WR 7      V n        R# )©Úembedding_directoryÚtokenizer_dataaŸ  <|im_start|>system
You are a prompt engineer. Describe the video in detail.
Describe how the camera moves or shakes, describe the zoom and view angle, whether it follows the objects.
Describe the location of the video, main characters or objects and their action.
Describe the dynamism of the video and presented actions.
Name the visual style of the video: whether it is a professional footage, user generated content, some kind of animation, video game or screen content.
Describe the visual effects, postprocessing and transitions if they are presented in the video.
Pay attention to the order of key actions shown in the scene.<|im_end|>
<|im_start|>user
{}<|im_end|>N)ÚsuperÚ__init__Úllama_templater   ÚSDTokenizerÚclip_l©Úselfr   r   Ú	__class__s   &&&€ÚBC:\Ai_Coding\apps\studio\ComfyUI\comfy\text_encoders\kandinsky5.pyr   ÚKandinsky5Tokenizer.__init__   s2   ø€ Ü‰ÑÐ-@ÐÔ`ð IˆÔÜ×*Ò*Ð?RÔrˆŽó    c                ó    <€ V ^8„  d   QhRS[ /# )é   Útext)Ústr)ÚformatÚ__classdict__s   "€r   Ú__annotate__Ú Kandinsky5Tokenizer.__annotate__   s   ø€ ÷ ñ ©ñ r   c                ój   <€ \         SV `  ! W3/ VB pV P                  P                  ! W3/ VB VR &   V# )Úl)r   Útokenize_with_weightsr   )r   r   Úreturn_word_idsÚkwargsÚoutr   s   &&&, €r   r"   Ú)Kandinsky5Tokenizer.tokenize_with_weights   s9   ø€ Ü‰gÒ+¨DÑLÀVÑLˆØ—;‘;×4Ò4°TÑUÈfÑUˆˆC‰àˆ
r   )r   r   )F)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r"   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   r   s   @@r   r   r      s   ù‡ € Ø+/À÷ s÷
÷ õ r   r   c                   ó:   a a€ ] tR t^t oR/ 3V 3R lltRtVtV ;t# )ÚKandinsky5TokenizerImageNc                ó6   <€ \         SV `  WR 7       RV n        R# )r
   zÚ<|im_start|>system
You are a promt engineer. Describe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>
<|im_start|>user
{}<|im_end|>N)r   r   r   r   s   &&&€r   r   Ú!Kandinsky5TokenizerImage.__init__   s   ø€ Ü‰ÑÐ-@ÐÔ`ð ~ˆÖr   )r   ©r'   r(   r)   r*   r   r+   r,   r-   r.   s   @@r   r0   r0      s   ù‡ € Ø+/À÷ ~÷ ~r   r0   c                   óB   a a€ ] tR t^t oRRRRR/ 3V 3R lltRtVtV ;t# )ÚQwen25_7BVLIModelÚcpuÚhiddenNTc                ó˜   <€ VP                  R R4      pVe   VP                  4       pWvR&   \        SV `  WV/ VRR/R\        WUVR7       R# )Úllama_quantization_metadataNÚquantization_metadataÚpadi[P F)ÚdeviceÚlayerÚ	layer_idxÚtextmodel_json_configÚdtypeÚspecial_tokensÚlayer_norm_hidden_stateÚmodel_classÚenable_attention_masksÚreturn_attention_masksÚmodel_options)ÚgetÚcopyr   r   r   )	r   r<   r=   r>   r@   Úattention_maskrF   r9   r   s	   &&&&&&& €r   r   ÚQwen25_7BVLIModel.__init__   s�   ø€ Ø&3×&7Ñ&7Ð8UÐW[Ó&\Ð#Ø&Ò2Ø)×.Ñ.Ó0ˆMØ5PÐ1Ñ2Ü‰Ñ ¸yÐ`bÐjoð  BGð  IOð  APð  joô  }Ið  bpð  gtÐö  	ur   © éÿÿÿÿr3   r.   s   @@r   r5   r5      s    ù‡ € Ø#¨8¸rÈÐ^bÐrt÷ u÷ ur   r5   c                   ól   a a€ ] tR t^"t oRR/ 3V 3R lltV 3R ltV 3R ltV 3R ltV 3R ltRt	Vt
V ;t# )	ÚKandinsky5TEModelr6   Nc                óz   <€ \         \        V `  WR \        VR7       \        P
                  ! WRVR7      V n        R# )Ú	qwen25_7b)r<   r@   ÚnameÚ
clip_modelrF   F)r<   r@   Úreturn_projected_pooledrF   N)r   r   r   r5   r   ÚSDClipModelr   )r   r<   r@   rF   r   s   &&&&€r   r   ÚKandinsky5TEModel.__init__#   sE   ø€ ÜÔ Ñ.°fÐP[Ôhyð  JWÐ.ô  	XÜ×*Ò*°&Ð_dð  uBô  CˆŽr   c                ó|   <€ \         SV `  VRR7      w  r#pV P                  P                  VR,          4      w  rVW&V3# )é   )Útemplate_endr!   rL   )r   Úencode_token_weightsr   )r   Útoken_weight_pairsÚcondÚpÚextraÚl_outÚl_pooledr   s   &&     €r   rY   Ú&Kandinsky5TEModel.encode_token_weights'   sD   ø€ Ü™Ñ5Ð6HÐWYÐ5ÓZ‰ˆ�ØŸ+™+×:Ñ:Ð;MÈcÕ;RÓS‰ˆà˜uÐ$Ð$r   c                ó\   <€ \         SV `  V4       V P                  P                  V4       R # ©N)r   Úset_clip_optionsr   )r   Úoptionsr   s   &&€r   rc   Ú"Kandinsky5TEModel.set_clip_options-   s"   ø€ Ü‰Ñ  Ô)Ø�‰×$Ñ$ WÖ-r   c                óX   <€ \         SV `  4        V P                  P                  4        R # rb   )r   Úreset_clip_optionsr   )r   r   s   &€r   rg   Ú$Kandinsky5TEModel.reset_clip_options1   s   ø€ Ü‰Ñ"Ô$Ø�‰×&Ñ&Ö(r   c                óf   <€ R V9   d   V P                   P                  V4      # \        SV `  V4      # )z*text_model.encoder.layers.1.mlp.fc1.weight)r   Úload_sdr   )r   Úsdr   s   &&€r   rj   ÚKandinsky5TEModel.load_sd5   s/   ø€ Ø7¸2Ô=Ø—;‘;×&Ñ& rÓ*Ð*ä‘7‘? 2Ó&Ð&r   )r   )r'   r(   r)   r*   r   rY   rc   rg   rj   r+   r,   r-   r.   s   @@r   rN   rN   "   s+   ù‡ € Ø#¨4¸r÷ Cõ%õ.õ)÷'õ 'r   rN   Nc                 ó0   a a€  ! V V3R  lR\         4      pV# )c                   óB   <a a€ ] tR t^<t oRR/ 3V VV3R lltRtVtV ;t# )Úte.<locals>.Kandinsky5TEModel_r6   Nc                óh   <€ Se   VP                  4       pSVR&   Se   Sp\        SV `	  WVR7       R # )Nr9   )r<   r@   rF   )rH   r   r   )r   r<   r@   rF   r   Údtype_llamar9   s   &&&&€€€r   r   Ú'te.<locals>.Kandinsky5TEModel_.__init__=   s?   ø€ Ø*Ò6Ø -× 2Ñ 2Ó 4�Ø?Z�Ð;Ñ<ØÒ&Ø#�Ü‰GÑ FÀ}ÐÖUr   rK   r3   )r   r   rq   r9   s   @@€€r   ÚKandinsky5TEModel_ro   <   s   ú‡ € Ø"'¨tÀ2÷ 	V÷ 	Vñ 	Vr   rs   )rN   )rq   r9   rs   s   ff r   Útert   ;   s    ù€ ÷Vð VÔ.ô Vð Ðr   )NN)Úcomfyr   Ú
qwen_imager   r   Úllamar   r   r0   rT   r5   rN   rt   rK   r   r   Ú<module>rx      sP   ðÝ ß <Ý ô
Ð,ô 
ô~Ð2ô ~ôu˜×,Ñ,ô uô'Ð(ô 'ö2	r   