CoolFace
Apppublic

PCMS-AI/MSP

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
inference.cpython-39.pyc13 linesDownload Raw Back to __pycache__
1a

2q��d+�@s*dZddlZd3dd�Zdd�Zdd	�ZdS)zG4 * The Inference of RAM and Tag2Text Models5 * Written by Xinyu Huang6�N�NonecCs�t���&|j|dddd�\}}Wd�n1s40Y|dksV|dksV|dkrh|dd|dfSg}|�|�dd	��t���&|j||ddd�\}}Wd�n1s�0Y|d|d|dfSdS)7N�2T)Z	tag_input�8max_lengthZreturn_tag_predict��nonerr�,z | )�torch�no_grad�generate�append�replace)�image�modelZ	input_tag�captionZtag_predictZinput_tag_list�r�+d:\recognize-anything-main\ram\inference.py�inference_tag2texts"9�(10�(rcCsFt���|�|�\}}Wd�n1s,0Y|d|dfS�Nr)rr	Zgenerate_tag)r
r�tags�tags_chineserrr�
inference_ram!s11,rcCs:t���|�|�}Wd�n1s(0Y|dSr)rr	Zgenerate_tag_openset)r
rrrrr�inference_ram_openset)s12(r)r)�__doc__rrrrrrrr�<module>s13