a
    d                     @   s   d dl Z d dlZdddZdS )    N c                 C   s   t | trtsJ d| S | }tj|sPtj||}tj|sPJ d|  tj| d  }|dkrt|"}dd t	|D }W d    q1 s0    Y  nR|dkrt|d}t
|}W d    q1 s0    Y  nd	sJ d
| d|S )Nz class_map dict must be non-emptyz+Cannot locate specified class map file (%s)z.txtc                 S   s   i | ]\}}|  |qS  )strip).0kvr   r   d/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/timm/data/readers/class_map.py
<dictcomp>       z"load_class_map.<locals>.<dictcomp>z.pklrbFz&Unsupported class map file extension (z).)
isinstancedictospathexistsjoinsplitextloweropen	enumeratepickleload)Zmap_or_filenamerootZclass_map_pathZclass_map_extfZclass_to_idxr   r   r	   load_class_map   s     

2*r   )r   )r   r   r   r   r   r   r	   <module>   s   