+
    ƒ°ñjÐ  ã                   óþ   € R t ^ RIt^ RIHt RtRt ! R R]P                  P                  P                  4      t	 ! R R]P                  P                  P                  4      t ! R	 R
]P                  4      tRR ltR# )af  Boogu-Image text encoder: full Qwen3-VL-8B, last hidden state (4096-dim).

Boogu uses the final hidden state of Qwen3-VL as the per-token instruction feature
(num_instruction_feature_layers=1, reduce_type=mean -> just the last layer).
The model itself is the standard Qwen3-VL TE, only the chat template differs
(a fixed system prompt and no <think> block).
N)Úsd1_clipz{You are a helpful assistant that generates high-quality images based on user instructions. The instructions are as follows.a0  Describe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.c                   óR   a a€ ] tR t^t oR/ 3V 3R lltRR. R3V 3R lltRtVtV ;t# )ÚBooguTokenizerNc                óÀ   <€ \         SV `  WR R7       R\        ,           R,           V n        R\        ,           R,           V n        R\        ,           R,           V n        R# )Ú
qwen3vl_8b)Úembedding_directoryÚtokenizer_dataÚ
model_typez<|im_start|>system
z)<|im_end|>
<|im_start|>user
{}<|im_end|>
zT<|im_end|>
<|im_start|>user
<|vision_start|><|image_pad|><|vision_end|>{}<|im_end|>
N)ÚsuperÚ__init__ÚBOOGU_T2I_SYSTEMÚllama_templateÚBOOGU_DROP_SYSTEMÚllama_template_imagesÚllama_template_drop)Úselfr   r   Ú	__class__s   &&&€Ú=C:\Ai_Coding\apps\studio\ComfyUI\comfy\text_encoders\boogu.pyr   ÚBooguTokenizer.__init__   sZ   ø€ Ü‰ÑÐ-@ÐlxÐÔyà4Ô7GÕGÐJxÕxˆÔØ%;Ô>OÕ%Oð  Slõ  &lˆÔ"à#9Ô<MÕ#MÐP~Õ#~ˆÖ ó    Fc                ó    <€ Vf2   \        V4      ^ 8X  d"   VP                  4       R8X  d   V P                  p\        SV `  ! V3RVRVRVRV/VB # )NÚ Úreturn_word_idsr   ÚimagesÚprevent_empty_text)ÚlenÚstripr   r
   Útokenize_with_weights)r   Útextr   r   r   r   Úkwargsr   s   &&&&&&,€r   r   Ú$BooguTokenizer.tokenize_with_weights   sz   ø€ ØÒ!¤c¨&£k°QÔ&6¸4¿:¹:»<È2Ô;MØ!×5Ñ5ˆNÜ‰wÒ,¨Tñ  sÀ?ð  sÐcqð  sð  {Að  sð  Vhð  sð  lrñ  sð  	sr   )r   r   r   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   Ú__classdict__s   @@r   r   r      s+   ù‡ € Ø+/À÷ ð ;@ÐPTÐ]_Ðty÷ s÷ sr   r   c                   ó@   a a€ ] tR t^#t oRRR/ R3V 3R lltRtVtV ;t# )ÚBooguQwen3VLClipModelÚcpuNTr   c                ó:   <€ \         SV `  WW4VR 7       RV n        R# ))ÚdeviceÚdtypeÚattention_maskÚmodel_optionsr	   TN)r
   r   Úlayer_norm_hidden_state)r   r.   r/   r0   r1   r	   r   s   &&&&&&€r   r   ÚBooguQwen3VLClipModel.__init__$   s'   ø€ Ü‰Ñ ÀNð  }GÐô  	Hà'+ˆÖ$r   )r2   ©r!   r"   r#   r$   r   r%   r&   r'   r(   s   @@r   r+   r+   #   s   ù‡ € Ø#¨4ÀÐTVÐco÷ ,÷ ,r   r+   c                   ó<   a a€ ] tR t^*t oRR/ 3V 3R lltRtVtV ;t# )ÚBooguTEModelr,   Nc                ó2   <€ R  p\         SV `  WRWCR7       R# )c                  ó    € \        R/ V BR R/B # )r	   r   © )r+   )Úkws   ,r   Ú<lambda>Ú'BooguTEModel.__init__.<locals>.<lambda>,   s   € Ô"7Ñ"V¸"Ñ"VÈÓ"Vr   r   )r.   r/   ÚnameÚ
clip_modelr1   N)r
   r   )r   r.   r/   r1   r>   r   s   &&&& €r   r   ÚBooguTEModel.__init__+   s   ø€ ÙVˆ
Ü‰Ñ ¸,ÐS]ÐÖ{r   r9   r4   r(   s   @@r   r6   r6   *   s   ù‡ € Ø#¨4¸r÷ |÷ |r   r6   c                 ó0   a a€  ! V V3R  lR\         4      pV# )c                   óB   <a a€ ] tR t^1t oRR/ 3V VV3R lltRtVtV ;t# )Úte.<locals>.BooguTEModel_r,   Nc                óh   <€ Se   SpSe   VP                  4       pSVR&   \        SV `	  WVR7       R # )NÚquantization_metadata)r.   r/   r1   )Úcopyr
   r   )r   r.   r/   r1   r   Údtype_llamaÚllama_quantization_metadatas   &&&&€€€r   r   Ú"te.<locals>.BooguTEModel_.__init__2   s?   ø€ ØÒ&Ø#�Ø*Ò6Ø -× 2Ñ 2Ó 4�Ø9T�Ð5Ñ6Ü‰GÑ FÀ}ÐÖUr   r9   r4   )r   r)   rF   rG   s   @@€€r   ÚBooguTEModel_rB   1   s   ú‡ € Ø"'¨tÀ2÷ 	V÷ 	Vñ 	Vr   rI   )r6   )rF   rG   rI   s   ff r   ÚterJ   0   s   ù€ ÷Vð Vœô Vð Ðr   )NN)Ú__doc__Úcomfy.text_encoders.qwen3vlÚcomfyr   r   r   Útext_encodersÚqwen3vlÚQwen3VLTokenizerr   ÚQwen3VLClipModelr+   ÚSD1ClipModelr6   rJ   r9   r   r   Ú<module>rS      s{   ðñó #Ý ð QÐ ð GÐ ôs�U×(Ñ(×0Ñ0×AÑAô sô,˜E×/Ñ/×7Ñ7×HÑHô ,ô|�8×(Ñ(ô |ö	r   