�
���go� � �b � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m
Z
mZmZ ddl
Z
ddlZddlmZ ddlmZ dd lmZ dd
lmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ eeeeeeee e"e#ei e�e!�e$ed
�Z0 e/j1 e2� � Z3 G d� d� � Z4dZ5dZ6i dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d'�d(d)�d*d+�d,d-�d.d/�d0d1�Z7g d2�Z8d3� Z9d4� Z:d5� Z;d6� Z<d7� Z=d8� Z>e G d9� d:� � � � Z?d;� Z@d<� ZAd=� ZBdEd?�ZCd@� ZDdA� ZEdB� ZFg dC�ZGdD� ZHdS )Fz'Configuration base class and utilities.� N)� dataclass)�Path)�Any�Optional�Union)�
model_info)�HFValidationError� )�__version__)�,MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES�!MODEL_FOR_CAUSAL_LM_MAPPING_NAMES�MODEL_FOR_CTC_MAPPING_NAMES�,MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES�*MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES�*MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES�!MODEL_FOR_MASKED_LM_MAPPING_NAMES�(MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES�*MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES�,MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES�/MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES�(MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES�0MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES�,MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES�6MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES)�ParallelMode)�MODEL_CARD_NAME�cached_file�is_datasets_available�is_offline_mode�is_tf_available�is_tokenizers_available�is_torch_available�logging)�text-generation�image-classification�image-segmentation� fill-mask�object-detection�question-answering�text2text-generation�text-classification�table-question-answering�token-classification�audio-classification�automatic-speech-recognitionzzero-shot-image-classificationzimage-text-to-textc �~ � e Zd ZdZd� Zd� Zed� � � Zed� � � Zed� � � Z d� Z
d� Zd � Zd
� Z
d� ZdS )
� ModelCarda
Structured Model Card class. Store model card as well as methods for loading/downloading/saving model cards.
Please read the following paper for details and explanation on the sections: "Model Cards for Model Reporting" by
Margaret Mitchell, Simone Wu, Andrew Zaldivar, Parker Barnes, Lucy Vasserman, Ben Hutchinson, Elena Spitzer,
Inioluwa Deborah Raji and Timnit Gebru for the proposal behind model cards. Link: https://arxiv.org/abs/1810.03993
Note: A model card can be loaded and saved to disk.
c
�� � t j dt � � |� di � � | _ |� di � � | _ |� di � � | _ |� di � � | _ |� di � � | _ |� di � � | _ |� di � � | _
|� d i � � | _ |� d
i � � | _ |�
� � D ]N\ }} t | ||� � �# t $ r*}t � d|� d|� d
| � �� � |�d }~ww xY wd S )NzTThe class `ModelCard` is deprecated and will be removed in version 5 of Transformers�
model_details�intended_use�factors�metrics�evaluation_data�
training_data�quantitative_analyses�ethical_considerations�caveats_and_recommendationsz
Can't set z with value z for )�warnings�warn�
FutureWarning�popr3 r4 r5 r6 r7 r8 r9 r: r; �items�setattr�AttributeError�logger�error)�self�kwargs�key�value�errs �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/transformers/modelcard.py�__init__zModelCard.__init__[ sw � ��
�b�dq�
�
�
� $�Z�Z���<�<���"�J�J�~�r�:�:����z�z�)�R�0�0����z�z�)�R�0�0���%�z�z�*;�R�@�@���#�Z�Z���<�<���%+�Z�Z�0G��%L�%L��"�&,�j�j�1I�2�&N�&N��#�+1�:�:�6S�UW�+X�+X��(� !�,�,�.�.� � �J�C��
���c�5�)�)�)�)��!�
�
�
����M�#�M�M�5�M�M�t�M�M�N�N�N�� �����
���� � s �(D:�:
E.�%E)�)E.c �� � t j � |� � r&t j � |t � � }n|}| � |� � t � d|� �� � dS )zKSave a model card object to the directory or file `save_directory_or_file`.zModel card saved in N)�os�path�isdir�joinr �to_json_filerC �info)rE �save_directory_or_file�output_model_card_files rJ �save_pretrainedzModelCard.save_pretrainedr sp � �
�7�=�=�/�0�0� <�%'�W�\�\�2H�/�%Z�%Z�"�"�%;�"����0�1�1�1����C�+A�C�C�D�D�D�D�D� c � � |� dd� � }|� dd� � }|� dd� � }|� dd� � }ddi}|�||d <