CoolFace
Apppublic

fred-dev/comfy_ui_ali

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
supported_models_base.cpython-312.pyc41 linesDownload Raw Back to __pycache__
1�

2���g���\�dZddlZddlmZddlmZddlmZGd�d�ZGd	�d3�Zy)a�4    This file is part of ComfyUI.5    Copyright (C) 2024 Comfy6 7    This program is free software: you can redistribute it and/or modify8    it under the terms of the GNU General Public License as published by9    the Free Software Foundation, either version 3 of the License, or10    (at your option) any later version.11 12    This program is distributed in the hope that it will be useful,13    but WITHOUT ANY WARRANTY; without even the implied warranty of14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the15    GNU General Public License for more details.16 17    You should have received a copy of the GNU General Public License18    along with this program.  If not, see <https://www.gnu.org/licenses/>.19�N�)�20model_base)�utils)�latent_formatsc��eZdZd�Zy)�21ClipTargetc�.�||_||_i|_y�N)�clip�	tokenizer�params)�selfrrs   �f/Users/fredrodrigues/Library/CloudStorage/Dropbox/Code/comfyui_hardware/comfy/supported_models_base.py�__init__zClipTarget.__init__s����	�"������N)�__name__�22__module__�__qualname__r�rrrrs��rrc��eZdZiZddd�ZiZgZdZdZiZ	e23jZdgZ
dgZej ej"ej$gZdZdZdZdZdd	iZedd24��Zdd�Zd�Zd
�Zdd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&y)�BASE������@)�	num_heads�num_head_channelsNzfirst_stage_model.zcond_stage_model.g@�fp8Fc��|jD]}||vs|j|||k7s�y|�|jD]}||vs�yy)NFT)�unet_config�
required_keys)�sr�25state_dict�ks    r�matcheszBASE.matches7sU�����A���#�q�}�}�Q�'7�;�q�>�'I����!��_�_���J�&� �%�rc�6�tjjSr26)r�	ModelType�EPS)rr!�prefixs   r�27model_typezBASE.model_typeBs���#�#�'�'�'rc�&�|jddkDS)N�in_channels�)r)rs r�
inpaint_modelzBASE.inpaint_modelEs�����
�.��2�2rc�.�|j�|_|jj�|_|j�|_|jj�|_|j28D]}|j29||j|<� yr30)�copyr�sampling_settings�
latent_format�
optimizations�unet_extra_config)rr�xs   rrz
BASE.__init__Hs}��&�+�+�-���!%�!7�!7�!<�!<�!>���!�/�/�1���!�/�/�4�4�6����'�'�A�"&�"8�"8��";�D���Q��(rc��|j�4tj||j|j||�|��}n(tj||j||�|��}|j�r|j
�|S)N)r(�device)�noise_aug_configr�31SD21UNCLIPr(�	BaseModelr,�set_inpaint)rr!r'r5�outs     r�	get_modelzBASE.get_modelPs~��� � �,��'�'��d�.C�.C�PT�P_�P_�`j�lr�Ps�}C�D�C��&�&�t����32�TZ�8[�dj�k�C������O�O���33rc�r�tj||jD�cic]}|d��c}d��}|Scc}w)N�T)�filter_keys)r�state_dict_prefix_replace�text_encoder_key_prefix)rr!r"s   r�process_clip_state_dictzBASE.process_clip_state_dictYsG���4�4�Z�QU�Qm�Qm�An�Qm�A�!�R�%�Qm�An�}A�B�34����Bos�35436c��|Sr37r�rr!s  r�process_unet_state_dictzBASE.process_unet_state_dict]����rc��|Sr38rrCs  r�process_vae_state_dictzBASE.process_vae_state_dict`rErc�P�d|jdi}tj||�S�Nr=r)r@rr?�rr!�replace_prefixs   r�"process_clip_state_dict_for_savingz'BASE.process_clip_state_dict_for_savingcs*���d�:�:�1�=�>���.�.�z�>�J�Jrc�h�i}|j�|j|d<tj||�S)Nr=)�clip_vision_prefixrr?rJs   r�)process_clip_vision_state_dict_for_savingz.BASE.process_clip_vision_state_dict_for_savinggs6�����"�"�.�!%�!8�!8�N�2���.�.�z�>�J�Jrc�6�ddi}tj||�S)Nr=zmodel.diffusion_model.)rr?rJs   r�"process_unet_state_dict_for_savingz'BASE.process_unet_state_dict_for_savingms ���6�7���.�.�z�>�J�Jrc�P�d|jdi}tj||�SrI)�vae_key_prefixrr?rJs   r�!process_vae_state_dict_for_savingz&BASE.process_vae_state_dict_for_savingqs*���d�1�1�!�4�5���.�.�z�>�J�Jrc�0�||jd<||_y)N�dtype)r�manual_cast_dtype)rrVrWs   r�set_inference_dtypezBASE.set_inference_dtypeus��$)�����!�!2��rr39)r=)r=N)'rrrrr2r�clip_prefixrNr6r/r�LatentFormatr0rSr@�torch�float16�bfloat16�float32�supported_inference_dtypes�memory_usage_factorrW�custom_operations�40scaled_fp8r1�classmethodr#r(r,rr;rArDrGrLrOrQrTrXrrrrrs����K�����41�M��K�������"�/�/�M�*�+�N�2�3��"'�-�-�������!O���������J��E�N�M�����(�3�<�����K�K�K�K�3rr)�__doc__r[r=rrrrrrrr�<module>res.���$
������Y3�Y3r