
    Ch                    D    S r SSKJr  SSKrSSKrSSKJr   " S S5      rg)a@  
This file contains deprecated code that can only be used with the old `model.fit`-style Sentence Transformers v2.X training.
It exists for backwards compatibility with the `model.old_fit` method, but will be removed in a future version.

Nowadays, with Sentence Transformers v3+, it is recommended to use the `SentenceTransformerTrainer` class to train models.
See https://www.sbert.net/docs/sentence_transformer/training_overview.html for more information.

Instead, you should create a `datasets` `Dataset` for training: https://huggingface.co/docs/datasets/create_dataset
    )annotationsN   )InputExamplec                  D    \ rS rSrSrS rS
S jr\S 5       rS r	S r
Srg	)NLIDataReader   z@Reads in the Stanford NLI dataset and the MultiGenre NLI datasetc                    Xl         g Ndataset_folder)selfr   s     c/var/www/html/shao/venv/lib/python3.13/site-packages/sentence_transformers/readers/NLIDataReader.py__init__NLIDataReader.__init__   s    ,    c           
        [         R                  " [        R                  R	                  U R
                  SU-   5      SSS9R                  5       n[         R                  " [        R                  R	                  U R
                  SU-   5      SSS9R                  5       n[         R                  " [        R                  R	                  U R
                  SU-   5      SSS9R                  5       n/ nSn[        X4U5       HX  u  pn
SX4-  nUS	-  nUR                  [        XU	/U R                  U
5      S
95        SUs=:  a  [        U5      ::  d  MS  O  MW    U$    U$ )z
data_splits specified which data split to use (train, dev, test).
Expects that self.dataset_folder contains the files s1.$data_split.gz,  s2.$data_split.gz,
labels.$data_split.gz, e.g., for the train split, s1.train.gz, s2.train.gz, labels.train.gz
zs1.rtzutf-8)modeencodingzs2.zlabels.r   z%s-%dr   )guidtextslabel)gzipopenospathjoinr   	readlineszipappendr   	map_labellen)r   filenamemax_exampless1s2labelsexamplesid
sentence_a
sentence_br   r   s               r   get_examplesNLIDataReader.get_examples   s,    YYrww||D$7$79IJQU`ghrrtYYrww||D$7$79IJQU`ghrrtGGLL,,i(.BC$Y`

)+ 	 -0-@)JEh^+D!GBOOLdz:RZ^ZhZhinZopq<03x=00 .A r   c                     SSSS.$ )Nr   r      )contradiction
entailmentneutral r3   r   r   
get_labelsNLIDataReader.get_labels1   s    !"!BBr   c                4    [        U R                  5       5      $ r
   )r"   r4   )r   s    r   get_num_labelsNLIDataReader.get_num_labels5   s    4??$%%r   c                `    U R                  5       UR                  5       R                  5          $ r
   )r4   striplower)r   r   s     r   r!   NLIDataReader.map_label8   s#     !4!4!677r   r   N)r   )__name__
__module____qualname____firstlineno____doc__r   r,   staticmethodr4   r7   r!   __static_attributes__r3   r   r   r   r      s/    J-0 C C&8r   r   )rA   
__future__r   r   r    r   r   r3   r   r   <module>rF      s"    #  	 &8 &8r   