o
    پi                     @   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|s(tj||}tj|s(J d|  tj| d  }|dkrVt|}dd t	|D }W d    |S 1 sOw   Y  |S |dkrwt|d}t
|}W d    |S 1 spw   Y  |S J d
| d)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   O/home/ubuntu/.local/lib/python3.10/site-packages/timm/data/readers/class_map.py
<dictcomp>   s    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)map_or_filenamerootclass_map_pathclass_map_extfclass_to_idxr   r   r	   load_class_map   s.   



r   )r   )r   r   r   r   r   r   r	   <module>   s    