a
    d                     @   s:   d dl Z d dlmZ ddlmZ ddlmZ dd	d
ZdS )    N)load_file_from_url   )BiSeNet)ParseNetbisenetFcudac                 C   s   | dkrt dd}d}n*| dkr4tdddd}d}nt|  d	t|d
dd |d}tj|dd d}|j|dd |  ||}|S )Nr      )Z	num_classzPhttps://github.com/xinntao/facexlib/releases/download/v0.2.0/parsing_bisenet.pthparseneti   )Zin_sizeZout_sizeZ
parsing_chzQhttps://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pthz is not implemented.zfacexlib/weightsT)urlZ	model_dirprogress	file_namesave_dirc                 S   s   | S )N )Zstoragelocr   r   b/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/facexlib/parsing/__init__.py<lambda>       z$init_parsing_model.<locals>.<lambda>)Zmap_location)strict)	r   r   NotImplementedErrorr   torchloadZload_state_dictevalto)Z
model_nameZhalfZdeviceZmodel_rootpathmodelZ	model_urlZ
model_pathZload_netr   r   r   init_parsing_model   s    


r   )r   Fr   N)r   Zfacexlib.utilsr   r   r   r	   r   r   r   r   r   r   <module>   s   