CoolFace
Apppublic

hololens/stable-diffusion-webui-depthmap-script

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes
net_tools.cpython-312.pyc21 linesDownload Raw Back to __pycache__
12��f���:�ddlZddlZddlZddlmZd�Zd�Zd�Zy)�N)�OrderedDictc��|dk(ry	|jd�}t|�dk(rt�|dSddj|dd�z}t	j3|�}t
||d�S#t$rtd|��wxYw)	z�Helper to return a function object by name. func_name must identify a4    function in this module or the path to a function relative to the base5    'modeling' module.6    �N�.�rzlib.�����zFailed to f1ind function: %s)	�split�len�globals�join�	importlib�
import_module�getattr�	Exception�print)�	func_name�parts�module_name�modules    �EF:\3dpicmaker\stable-diffusion-webui-depthmap-script\lib\net_tools.py�get_funcrs���7�B��������$���u�:��?��9�U�1�X�&�&��s�x�x��c�r�8�3�3���(�(��5���v�u�R�y�)�)����
�,�i�8�
��s�.A2�:A2�2B	c���tjj|j�r�t	d|jz�tj|j�}|� |jt|dd�d��|� |jt|dd�d��|jt|dd�d��~t9jj�yy)	z10    Load checkpoint.11    zloading checkpoint %sN�shift_modelzmodule.T)�strict�focal_model�depth_model)�os�path�isfile�	load_ckptr�torch�load�load_state_dict�strip_prefix_if_present�cuda�empty_cache)�argsrrr�12checkpoints     rr r s���13�w�w�~�~�d�n�n�%�
�%����6�7��Z�Z����/�14��"��'�'�(?�15�=�@Y�[d�(e�+/�
(�
1��"��'�'�(?�16�=�@Y�[d�(e�+/�
(�
1��#�#�$;�J�}�<U�W`�$a�+/�	$�	1��
�1718��� �&�c����t|j��}t�fd�|D��s|St�}|j	�D]\}}|||j�d�<�|S)Nc3�@�K�|]}|j�����y�w)N)�19startswith)�.0�key�prefixs  �r�	<genexpr>z*strip_prefix_if_present.<locals>.<genexpr>0s�����6�#�s�~�~�f�%�6�s�r)�sorted�keys�allr�items�replace)�20state_dictr/r2�stripped_state_dictr.�values `    rr$r$.sh����*�/�/�#�$�D��6��6�6���%�-�� �&�&�(�=�21��U�7<��C�K�K���3�4�=��r))r
r!r�collectionsrrr r$�r)r�<module>r;s ����	�#��(!�&r)