Files
INTUIA/Programa final/spacy/cli/__pycache__/benchmark_speed.cpython-312.pyc
T

76 lines
9.6 KiB
Plaintext
Raw Normal View History

2026-03-15 13:27:50 +00:00
Ë
=û góãóHddlZddlZddlmZddlmZddlmZmZm Z ddl
Z
ddl Z ddl m Z ddl
mZddlmZdd lmZdd
lmZdd lmZd d
lmZmZmZmZmZej:ddddœ¬«edd¬«eddd¬«edddd d¬«eddd¬«eddd d!¬«ed"d#d$d%¬&«ed'd(d)dd*¬«edd+d,d-¬«fd.e j<d/ed0ed1e e d2e!d3e d4e d5e d6e efd7„«Z"Gd8„d9«Z#Gd:„d;«Z$d<ed=eed1e e d>e
jJfd?„Z&d<ed=eed4e d1e d@e!d>e
jJf dA„Z'e
jPdBfd>e
jJfdC„Z)d=eed>e fdD„Z*dEe
jJfdF„Z+dEe
jJfdG„Z,d<ed=eed5e d1e e d>e
jJf
dH„Z-y)IéN)Úislice)ÚPath)ÚIterableÚListÚOptional)Útqdm)Úmsgé)Úutil)ÚLanguage)ÚDoc)ÚCorpusé)ÚArgÚOptÚ
benchmark_cliÚ import_codeÚ setup_gpuÚspeedT)Úallow_extra_argsÚignore_unknown_options)Úcontext_settings.zModel name or path)Úhelpz3Location of binary evaluation data in .spacy format)rÚexistsz --batch-sizez-bz Override the pipeline batch size)ÚminrFz --no-shufflezDo not shuffle benchmark dataéÿÿÿÿz--gpu-idz-gzGPU ID or -1 for CPUé2z --batchesz&Minimum number of batches to benchmarké)rréz--warmupz-wz-Number of iterations over the data for warmupz--codez-czNPath to Python file with additional code (registered functions) to be importedÚctxÚmodelÚ data_pathÚ
batch_sizeÚ
no_shuffleÚuse_gpuÚ n_batchesÚ
warmup_epochsÚ code_pathc óòt|«t|d¬«tj|«} ||n | j}t |«}
|
| «D cgc]} | j Œ} } t| «dk(rtjdd¬«td|d «t| | ||«t«td
|d «t| | ||| «}
t«t|
«t|
«ycc} w) zu
Benchmark a pipeline. Expects a loadable spaCy pipeline and benchmark
data in the binary .spacy format.
F)r%ÚsilentNrz-Cannot benchmark speed using an empty corpus.r)ÚexitszWarming up for z
epochs...z
Benchmarking z batches...)rrr Ú
load_modelr#rÚ predictedÚlenr ÚfailÚprintÚwarmupÚ benchmarkÚprint_outliersÚprint_mean_with_ci)r r!r"r#r$r%r&r'r(ÚnlpÚcorpusÚegÚdocsÚwpss úZC:\Users\garci\AppData\Roaming\Python\Python312\site-packages\spacy/cli/benchmark_speed.pyÚbenchmark_speed_clir;s×ô* ÔÜ
g 
/‰/˜
€CØ5¸3¿>¹>€JÜ

€FÙ#)¨#¤;Ó /¡;˜RˆBLL ;€DÐ 
ˆ4ƒyA‚~Ü ÐÕ ˆO˜M˜?¨*Ð

ˆ3m  „GÜ ˆM˜)˜ 

C˜˜y¨*¸*°nÓ
E€Cä „GÜÜùò 0sÁC4cóeZdZdZdZdZy)Ú time_contextz'Register the running time of a context.có8tj«|_|S©N)ÚtimeÚ perf_counterÚstart)Úselfs r:Ú __enter__ztime_context.__enter__CsÜ×(ˆŒ
؈ ócóPtj«|jz
|_yr?)r@rArBÚelapsed)rCÚtypeÚvalueÚ tracebacks r:Ú__exit__ztime_context.__exit__GsÜ×*¨T¯Z©ZÑ7ˆ rEN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rDrK©rEr:r=r=@sÙó8rEr=có^eZdZUdZeed<eed<eed<eed<dejddfd „Zy)
Ú QuartileszVCalculate the q1, q2, q3 quartiles and the inter-quartile range (iqr)
of a sample.Úq1Úq2Úq3ÚiqrÚsampleÚreturnNcóâtj|d«|_tj|d«|_tj|d«|_|j|jz
|_y)NgÐ?gà?gè?)ÚnumpyÚquantilerSrTrUrV)rCrWs r:Ú__init__zQuartiles.__init__TsLÜ—.¨ÓŒÜ—.‘. ¨ÓŒÜ—.‘. ¨ÓŒØ—7‘7˜TŸW™WÑ$ˆrE) rLrMrNrOÚfloatÚ__annotations__rZÚndarrayr\rPrEr:rRrRKs4ñð ƒIØ
ƒIØ
ƒIØ ƒJð%˜uŸ}™}ðô%rErRr5r8rXcóf|jt|dd¬«|¬«}g} t«5}tt ||r|n |j
««}ddd«t
«dk(rn*t|«}|j|jz «Œotj|«S#1swYŒWxYw)doc)ÚunitÚdisable)r#r) Úpiperr=Úlistrr#r.Ú count_tokensÚappendrGrZÚarray)r5r8r#r9rGÚ
batch_docsÚn_tokenss r:Úannotaterk[sð 8‰8”D˜ E°4Ô8ÀZˆ P€DØ
€CØ
Ü
Œ^˜Üt©:™Z¸3¿>¹>Óˆô ˆz‹?˜aÒ Ø Ü 
Ó+ˆØ
8˜gŸo™oÑ ô ;‰; Ð÷ˆ^ús ­$B'Â'B0Úshufflec
óJ|rHt||z«Dcgc]0}|jtj|«j«Œ2}}nCt||z«Dcgc],}|j||t |«zj«Œ.}}t
|||«Scc}wcc}wr?)ÚrangeÚmake_docÚrandomÚchoiceÚtextr.rk)r5r8r&r#rlÚ
bench_docsÚis r:r2r2mñô˜9 zÑ
á2ð
L‰LœŸ tÓ  ñ
ô˜9 zÑ
á2ð
L‰L˜˜a¤# d£)™mÑ  ð
ô
 ZÓ 0ùò
ùò

s “5BÁ1B i'cóttjˆˆfdt|«D«tj«S)z9Apply a statistic to repeated random samples of an array.c 3ó€K|]5}tjjt«d¬««Œ7y­w)T)ÚreplaceN)rZrprqr.)Ú.0rsÚ statisticÚxs €€r:ú <genexpr>zbootstrap.<locals>.<genexpr>…s8øèø€ð
á&ñ
”e—l‘l×)¨!¬S°«V¸B× &ùsƒ;>)rZÚfromiterrnÚfloat64)r{rzÚ
iterationss`` r:Ú bootstrapr€s/ù€ä >‰>ô
ä˜