§
    ’©ºj‹6  ã            .       ój
  — d dl Z d dlmZ d dlmZmZmZmZmZm	Z	 d dl
Z
d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dl m!Z! d dl"m#Z# d dl$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 ddgiZ2e/sddgZ3e4e5e	e5e4e5e	e6e5         e6e7         f         f         f         f         Z8e	e8e6e8         f         Z9	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dod!e	e6e5         e4e5ef         f         d"e	e6e5         e4e5ef         f         d#ee5         d$ee7         d%e:d&ee         d'ed(eeee4e5ef         gef                  d)e:d*e:d+ee	e5e
j;        f                  d,e7d-e7d.e7d/e:d0e5d1e:d2ee5         d3ee5         d4e4e5e	ee6e<         e5f         f         f(d5„Z=	 	 	 dpd!e	e5ee5         f         d"ee	e5ee5         f                  d6e7d7e:d8eee<                  d4efd9„Z>d!e	e5e6e5         f         d"e	e5e6e5         f         d4efd:„Z?	 	 	 	 	 	 dqd!e	e5ee5         f         d"ee	e5ee5         f                  d>e7d?e7d@e<dAe:dBe:dCe:d4e	ee@eef         f         fdD„ZA	 	 	 	 	 	 drd!e	e5ee5         f         d"ee	e5ee5         f                  dHedI         dCe:dJe<dKe<dLe<dMe<d4e	ee@eef         f         fdN„ZB	 	 	 	 	 	 	 	 	 	 	 	 dsd!e	e5ee5         f         d"e	e5ee5         f         d#e	e5e jC        f         dSe<dTed*e:dJee<         d@ee<         d+ee	e5e
j;        f                  d,ee7         d-e7d.e7d)e:dCe:d4e	ee@eef         f         fdU„ZDd!e	e5e6e5         f         d"e	e5e6e5         f         d4efdV„ZEdtd!ed"edWee7         d4efdX„ZF	 	 	 	 	 dud!e	e5ee5         f         d"e	e5ee5         eee5                  f         d[ed\         d]e:d^eee5ge5f                  d_eee5gee5         f                  d`e	e5e@e5daf         f         d4e4e5ef         fdb„ZG	 	 	 	 	 dvd!ee5         d"eee5                  d6e7d7e:ddede         dAe:d8eee<                  d4efdf„ZHd!e	e4e5e5f         e6e4e5e5f                  f         d"e9d4e4e5ef         fdg„ZI	 	 	 	 	 dwd!e	e5ee5         f         d"ee	e5ee5         f                  dhe:die:dAe:dje:dCe:d4e	ee@eee         f         f         fdk„ZJd!e	e5e6e5         f         d"e	e5e6e5         f         d4efdl„ZKd!e	e5e6e5         f         d"e	e5e6e5         f         d4efdm„ZLd!e	e5e6e5         f         d"e	e5e6e5         f         d4efdn„ZMdS )xé    N)ÚSequence)ÚAnyÚCallableÚListÚLiteralÚOptionalÚUnion)ÚTensor)ÚModule)Ú
bert_score)Ú
bleu_score)Úchar_error_rate)Ú
chrf_score)Úextended_edit_distance)Ú$_ALLOWED_INFORMATION_MEASURE_LITERAL)Úinfolm)Úmatch_error_rate)Ú
perplexity)Úrouge_score)Úsacre_bleu_score)Úsquad)Útranslation_edit_rate)Úword_error_rate)Úword_information_lost)Úword_information_preserved)Ú_TRANSFORMERS_GREATER_EQUAL_4_4)Ú_deprecated_root_import_funcÚ_rouge_scoreÚnltkÚ_bert_scoreÚ_infolmFé   é@   é   ÚenÚpredsÚtargetÚmodel_name_or_pathÚ
num_layersÚ
all_layersÚmodelÚuser_tokenizerÚuser_forward_fnÚverboseÚidfÚdeviceÚ
max_lengthÚ
batch_sizeÚnum_threadsÚreturn_hashÚlangÚrescale_with_baselineÚbaseline_pathÚbaseline_urlÚreturnc                 ó¨   — t          dd¦  «         t          di d| “d|“d|“d|“d|“d|“d	|“d
|“d|“d|	“d|
“d|“d|“d|“d|“d|“d|“d|“d|“ŽS )af  Wrapper for deprecated import.

    >>> preds = ["hello there", "general kenobi"]
    >>> target = ["hello there", "master kenobi"]
    >>> score = _bert_score(preds, target)
    >>> from pprint import pprint
    >>> pprint(score)
    {'f1': tensor([1.0000, 0.9961]),
     'precision': tensor([1.0000, 0.9961]),
     'recall': tensor([1.0000, 0.9961])}

    r   Útextr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   © )r   r   )r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   s                      úx/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/torchmetrics/functional/text/_deprecated.pyr    r    '   s  € õB ! ¨vÑ6Ô6Ð6Ýð ð ð Øˆeðàˆvðð .Ð-ðð �:ð	ð
 �:ðð ˆeðð &�~ðð (˜ðð �ðð ˆCðð ˆvðð �:ðð �:ðð  �Kðð  �Kðð  ˆTð!ð" 4Ð3ð#ð$ $�mð%ð& "�\ð'ð ó    Ún_gramÚsmoothÚweightsc                 óJ   — t          dd¦  «         t          | ||||¬¦  «        S )zÍWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> _bleu_score(preds, target)
    tensor(0.7598)

    r   r;   ©r&   r'   r?   r@   rA   )r   r   rC   s        r=   Ú_bleu_scorerD   `   s.   € õ ! ¨vÑ6Ô6Ð6Ý˜E¨&¸ÈÐX_Ð`Ñ`Ô`Ð`r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )z÷Wrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> _char_error_rate(preds=preds, target=target)
    tensor(0.3415)

    r   r;   ©r&   r'   )r   r   rF   s     r=   Ú_char_error_raterG   s   ó(   € õ !Ð!2°FÑ;Ô;Ð;Ý ¨vÐ6Ñ6Ô6Ð6r>   é   é   ç       @Ún_char_orderÚn_word_orderÚbetaÚ	lowercaseÚ
whitespaceÚreturn_sentence_level_scorec           
      óP   — t          dd¦  «         t          | |||||||¬¦  «        S )zÍWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> _chrf_score(preds, target)
    tensor(0.8640)

    r   r;   ©r&   r'   rL   rM   rN   rO   rP   rQ   )r   r   rS   s           r=   Ú_chrf_scorerT   €   sC   € õ$ ! ¨vÑ6Ô6Ð6ÝØØØ!Ø!ØØØØ$?ð	ñ 	ô 	ð 	r>   ç333333Ó?çš™™™™™É?ç      ð?Úlanguage)r%   ÚjaÚalphaÚrhoÚdeletionÚ	insertionc           
      óP   — t          dd¦  «         t          | |||||||¬¦  «        S )züWrapper for deprecated import.

    >>> preds = ["this is the prediction", "here is an other sample"]
    >>> target = ["this is the reference", "here is another one"]
    >>> _extended_edit_distance(preds=preds, target=target)
    tensor(0.3078)

    r   r;   ©r&   r'   rX   rQ   rZ   r[   r\   r]   )r   r   r_   s           r=   Ú_extended_edit_distancer`   Ÿ   sD   € õ$ !Ð!9¸6ÑBÔBÐBÝ!ØØØØ$?ØØØØð	ñ 	ô 	ð 	r>   úbert-base-uncasedç      Ð?Úkl_divergenceTÚtemperatureÚinformation_measurec                 ó\   — t          dd¦  «         t          | |||||||||	|
|||¬¦  «        S )a<  Wrapper for deprecated import.

    >>> preds = ['he read the book because he was interested in world history']
    >>> target = ['he was interested in world history because he read the book']
    >>> _infolm(preds, target, model_name_or_path='google/bert_uncased_L-2_H-128_A-2', idf=False)
    tensor(-0.1784)

    r   r;   ©r&   r'   r(   rd   re   r/   rZ   rN   r0   r1   r2   r3   r.   rQ   )r   r   rg   s                 r=   r!   r!   ¾   sU   € õ0 ! ¨6Ñ2Ô2Ð2ÝØØØ-ØØ/ØØØØØØØØØ$?ðñ ô ð r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )zøWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> _match_error_rate(preds=preds, target=target)
    tensor(0.4444)

    r   r;   rF   )r   r   rF   s     r=   Ú_match_error_rateri   é   s(   € õ !Ð!3°VÑ<Ô<Ð<Ý %°Ð7Ñ7Ô7Ð7r>   Úignore_indexc                 óF   — t          dd¦  «         t          | ||¬¦  «        S )zõWrapper for deprecated import.

    >>> from torch import rand, randint
    >>> preds = rand(2, 8, 5)
    >>> target = randint(5, (2, 8))
    >>> target[0, 6:] = -100
    >>> _perplexity(preds, target, ignore_index=-100)
    tensor(5.8540)

    r   r;   ©r&   r'   rj   )r   r   rl   s      r=   Ú_perplexityrm   ö   s)   € õ ! ¨vÑ6Ô6Ð6Ý˜E¨&¸|ÐLÑLÔLÐLr>   Úbest©Úrouge1Úrouge2ÚrougeLÚ	rougeLsumÚ
accumulate)Úavgrn   Úuse_stemmerÚ
normalizerÚ	tokenizerÚ
rouge_keys.c           	      óN   — t          dd¦  «         t          | ||||||¬¦  «        S )a´  Wrapper for deprecated import.

    >>> preds = "My name is John"
    >>> target = "Is your name John"
    >>> from pprint import pprint
    >>> pprint(_rouge_score(preds, target))
    {'rouge1_fmeasure': tensor(0.7500),
        'rouge1_precision': tensor(0.7500),
        'rouge1_recall': tensor(0.7500),
        'rouge2_fmeasure': tensor(0.),
        'rouge2_precision': tensor(0.),
        'rouge2_recall': tensor(0.),
        'rougeL_fmeasure': tensor(0.5000),
        'rougeL_precision': tensor(0.5000),
        'rougeL_recall': tensor(0.5000),
        'rougeLsum_fmeasure': tensor(0.5000),
        'rougeLsum_precision': tensor(0.5000),
        'rougeLsum_recall': tensor(0.5000)}

    r   r;   ©r&   r'   rt   rv   rw   rx   ry   )r   r   r{   s          r=   r   r     s@   € õ: ! °Ñ7Ô7Ð7ÝØØØØØØØðñ ô ð r>   Ú13aÚtokenize)Únoner|   ÚzhÚintlÚcharc           	      óN   — t          dd¦  «         t          | ||||||¬¦  «        S )zÓWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> _sacre_bleu_score(preds, target)
    tensor(0.7598)

    r   r;   ©r&   r'   r?   r@   r}   rO   rA   )r   r   rƒ   s          r=   Ú_sacre_bleu_scorer„   .  sA   € õ" !Ð!3°VÑ<Ô<Ð<ÝØØØØØØØðñ ô ð r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )a3  Wrapper for deprecated import.

    >>> preds = [{"prediction_text": "1976", "id": "56e10a3be3433e1400422b22"}]
    >>> target = [{"answers": {"answer_start": [97], "text": ["1976"]},"id": "56e10a3be3433e1400422b22"}]
    >>> _squad(preds, target)
    {'exact_match': tensor(100.), 'f1': tensor(100.)}

    r   r;   rF   )r   r   rF   s     r=   Ú_squadr†   K  s'   € õ ! ¨&Ñ1Ô1Ð1Ý�u VÐ,Ñ,Ô,Ð,r>   Ú	normalizeÚno_punctuationÚasian_supportc           	      óN   — t          dd¦  «         t          | ||||||¬¦  «        S )zØWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> _translation_edit_rate(preds, target)
    tensor(0.1538)

    r   r;   ©r&   r'   r‡   rˆ   rO   r‰   rQ   )r   r   r‹   s          r=   Ú_translation_edit_raterŒ   X  sA   € õ" !Ð!8¸&ÑAÔAÐAÝ ØØØØ%ØØ#Ø$?ðñ ô ð r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )z÷Wrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> _word_error_rate(preds=preds, target=target)
    tensor(0.5000)

    r   r;   rF   )r   r   rF   s     r=   Ú_word_error_raterŽ   u  rH   r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )zðWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> _word_information_lost(preds, target)
    tensor(0.6528)

    r   r;   rF   )r   r   rF   s     r=   Ú_word_information_lostr�   ‚  s(   € õ !Ð!8¸&ÑAÔAÐAÝ  u°VÐ<Ñ<Ô<Ð<r>   c                 óD   — t          dd¦  «         t          | |¬¦  «        S )zõWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> _word_information_preserved(preds, target)
    tensor(0.3472)

    r   r;   rF   )r   r   rF   s     r=   Ú_word_information_preservedr’   �  s(   € õ !Ð!=¸vÑFÔFÐFÝ%¨E¸&ÐAÑAÔAÐAr>   )NNFNNNFFNr"   r#   r$   Fr%   FNN)r$   FN)rI   rJ   rK   FFF)r%   FrK   rU   rV   rW   )ra   rb   rc   TNNNNr#   r   TF)N)rn   FNNro   )r$   Fr|   FN)FFTFF)NÚosÚcollections.abcr   Útypingr   r   r   r   r   r	   Útorchr
   Útorch.nnr   Ú!torchmetrics.functional.text.bertr   Ú!torchmetrics.functional.text.bleur   Ú torchmetrics.functional.text.cerr   Ú!torchmetrics.functional.text.chrfr   Ú torchmetrics.functional.text.eedr   Ú#torchmetrics.functional.text.infolmr   Ú+_INFOLM_ALLOWED_INFORMATION_MEASURE_LITERALr   Ú torchmetrics.functional.text.merr   Ú'torchmetrics.functional.text.perplexityr   Ú"torchmetrics.functional.text.rouger   Ú'torchmetrics.functional.text.sacre_bleur   Ú"torchmetrics.functional.text.squadr   Ú torchmetrics.functional.text.terr   Ú torchmetrics.functional.text.werr   Ú torchmetrics.functional.text.wilr   Ú torchmetrics.functional.text.wipr   Útorchmetrics.utilities.importsr   Útorchmetrics.utilities.printsr   Ú__doctest_requires__Ú__doctest_skip__ÚdictÚstrÚlistÚintÚSQUAD_SINGLE_TARGET_TYPEÚSQUAD_TARGETS_TYPEÚboolr0   Úfloatr    rD   rG   ÚtuplerT   r`   ÚPathLiker!   ri   rm   r   r„   r†   rŒ   rŽ   r�   r’   r<   r>   r=   ú<module>r¶      s5  ðØ 	€	€	€	Ø $Ð $Ð $Ð $Ð $Ð $Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @à €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø <Ð <Ð <Ð <Ð <Ð <Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø CÐ CÐ CÐ CÐ CÐ Cðð ð ð ð ð ð 7Ð 6Ð 6Ð 6Ð 6Ð 6Ø =Ð =Ð =Ð =Ð =Ð =Ø >Ð >Ð >Ð >Ð >Ð >Ø :Ð :Ð :Ð :Ð :Ð :Ø DÐ DÐ DÐ DÐ DÐ DØ 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø BÐ BÐ BÐ BÐ BÐ BØ <Ð <Ð <Ð <Ð <Ð <Ø BÐ BÐ BÐ BÐ BÐ BØ GÐ GÐ GÐ GÐ GÐ GØ JÐ JÐ JÐ JÐ JÐ JØ FÐ FÐ FÐ FÐ FÐ Fà'¨6¨(Ð3Ð à&ð 2Ø% yÐ1Ðà  U¨3°°S¸%ÀÀSÄ	È4ÐPSÌ9Ð@TÔ:UÐ5UÔ0VÐ+VÔ%WÐ WÔXÐ ØÐ3°TÐ:RÔ5SÐSÔTÐ ð )-Ø $ØØ"ØØOSØØØ15ØØØØØØ"'Ø#'Ø"&ð'6ð 6Ø��c”˜D  f Ô-Ð-Ô.ð6à�$�s”)˜T # v +Ô.Ð.Ô/ð6ð ! œð6ð ˜”ð	6ð
 ð6ð �FÔð6ð ð6ð ˜h¨°°S¸&°[Ô0AÐ'BÀFÐ'JÔKÔLð6ð ð6ð 
ð6ð �U˜3 ¤Ð,Ô-Ô.ð6ð ð6ð ð6ð ð6ð ð6ð  ð!6ð"  ð#6ð$ ˜C”=ð%6ð& ˜3”-ð'6ð( 
ˆ#ˆu�V˜T %œ[¨#Ð-Ô.Ð
.Ô/ð)6ð 6ð 6ð 6ðx ØØ)-ðað aØ��h˜s”mÐ#Ô$ðaà�U˜3 ¨¤Ð-Ô.Ô/ðað ðað ð	að
 �h˜u”oÔ&ðað ðað að að að&
7˜E # t¨C¤y .Ô1ð 
7¸5ÀÀdÈ3ÄiÀÔ;Pð 
7ÐU[ð 
7ð 
7ð 
7ð 
7ð  ØØØØØ(-ðð Ø��h˜s”mÐ#Ô$ðà�U˜3 ¨¤Ð-Ô.Ô/ðð ðð ð	ð
 ðð ðð ðð "&ðð ˆ6�5˜ ˜Ô(Ð(Ô)ðð ð ð ðD %)Ø(-ØØØØðð Ø��h˜s”mÐ#Ô$ðà�U˜3 ¨¤Ð-Ô.Ô/ðð �jÔ!ðð "&ð	ð
 ðð 
ðð ðð ðð ˆ6�5˜ ˜Ô(Ð(Ô)ðð ð ð ðD 3FØØGVØØ!Ø Ø15Ø $ØØØØ(-ð(ð (Ø��h˜s”mÐ#Ô$ð(à�#�x ”}Ð$Ô%ð(ð ˜c 2¤;Ð.Ô/ð(ð ð	(ð
 Eð(ð 
ð(ð �EŒ?ð(ð �5Œ/ð(ð �U˜3 ¤Ð,Ô-Ô.ð(ð ˜”ð(ð ð(ð ð(ð ð(ð "&ð(ð ˆ6�5˜ ˜Ô(Ð(Ô)ð(ð (ð (ð (ðV
8˜U 3¨¨S¬	 >Ô2ð 
8¸EÀ#ÀtÈCÄyÀ.Ô<Qð 
8ÐV\ð 
8ð 
8ð 
8ð 
8ðMð M�vð M vð M¸XÀc¼]ð MÐV\ð Mð Mð Mð Mð$ *0ØØ15Ø:>Ø.Yð&ð &Ø��h˜s”mÐ#Ô$ð&à�#�x ”} h¨x¸¬}Ô&=Ð=Ô>ð&ð ˜Ô&ð&ð ð	&ð
 ˜ 3 %¨ *Ô-Ô.ð&ð ˜ # ¨°¬Ð!5Ô6Ô7ð&ð �c˜5  c œ?Ð*Ô+ð&ð 
ˆ#ˆvˆ+Ôð&ð &ð &ð &ðX ØØ=BØØ)-ðð Ø�CŒ=ðà�X˜c”]Ô#ðð ðð ð	ð
 Ð9Ô:ðð ðð �h˜u”oÔ&ðð ðð ð ð ð:
-�%˜˜S #˜Xœ¨¨T°#°s°(¬^Ô(<Ð<Ô=ð 
-ÐGYð 
-Ð^bÐcfÐhnÐcnÔ^oð 
-ð 
-ð 
-ð 
-ð  Ø ØØØ(-ðð Ø��h˜s”mÐ#Ô$ðà�U˜3 ¨¤Ð-Ô.Ô/ðð ðð ð	ð
 ðð ðð "&ðð ˆ6�5˜  f¤Ð-Ô.Ð.Ô/ðð ð ð ð:
7˜E # t¨C¤y .Ô1ð 
7¸5ÀÀdÈ3ÄiÀÔ;Pð 
7ÐU[ð 
7ð 
7ð 
7ð 
7ð
= %¨¨T°#¬Y¨Ô"7ð 
=ÀÀsÈDÐQTÌIÀ~ÔAVð 
=Ð[að 
=ð 
=ð 
=ð 
=ð
B u¨S°$°s´)¨^Ô'<ð 
BÀeÈCÐQUÐVYÔQZÈNÔF[ð 
BÐ`fð 
Bð 
Bð 
Bð 
Bð 
Bð 
Br>   