
    fThw                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJrJrJrJrJrJrJrJr  SS	K J!r!  S
SK"J#r#  \#RH                  " \%5      r&GSS\'S\(S\\\(\'4   \(4   4S jjr)1 Skr*\*RW                  S15      r,\RZ                  R]                  SS5      R_                  5       r0\RZ                  R]                  SS5      R_                  5       r1\RZ                  R]                  SS5      R_                  5       r2\RZ                  R]                  SS5      R_                  5       r3\RZ                  R]                  SS5      R_                  5       r4\!Rj                  " S5      r6Sr7Sr8Sr9Sr:Sr;Sr<S r=S!r>S"r?\)" S#S$S%9u  r@rA\)" S&5      rB\)" S'5      rC\)" S(5      rD\)" S)S$S%9u  rErF\R                  R                  S*5      SLrI\R                  R                  S+5      SLrJ\)" S,5      rK\)" S-5      rL\)" S.5      rM\)" S/5      rN\)" S05      rO\)" S15      rP\)" S2S$S%9u  rQrR\R                  R                  S35      SLrS\)" S45      rT\R                  R                  S55      SLrU\R                  R                  S65      SLrV\)" S75      rW\)" S85      rX\R                  R                  S95      SLrY \R                  RC                  S95      r[\&R                  S:\[ 35        \)" S=5      r^\)" S>5      r_\)" S?5      r`\)" S@S$S%9u  rarb\)" SA5      rc\)" SB5      rd\)" SC5      re\)" SD5      rf\)" SE5      rg\)" SF5      rh\)" SG5      ri\)" SH5      rj\)" SI5      rk\)" SJ5      rl\)" SK5      rm\)" SL5      rn\)" SM5      ro\)" SNS$S%9u  rprq\R                  R                  SO5      SLrr\)" SP5      rsSrt \R                  RC                  SQ5        S$rt\R                  R                  SR5      SLru\)" SS5      rv\)" ST5      rw\)" SU5      rx\)" SV5      ry\)" SW5      rz\)" SX5      r{\)" SY5      r|\)" SZ5      r}\)" S[5      r~\)" S\5      r\)" S]5      r\)" S^5      r\)" S_5      r\)" S`5      r\)" Sa5      r\)" Sb5      r\)" Sc5      r\)" SdS$S%9u  rr\R                  R                  Se5      SLr\(       a   \R                  RC                  Sf5        \R                  R                  Sg5      SLr\)" Sh5      r\)" Si5      r\)" SjS$S%9u  rr\)" Sk5      r\)" Sl5      r\)" Sm5      r\)" Sn5      r\)" So5      r\)" Sp5      r\)" SqS$S%9u  rr\)" Sr5      r\)" SsS$S%9u  rr\)" St5      r\)" Su5      r\)" SvS$S%9u  rr\)" Sw5      r\)" Sx5      r\)" Sy5      r\)" Sz5      r\)" S{5      r\)" S|5      r\)" S}5      rS~rSr\1\,;   aY  \0\*;  aS  \)" SS$S%9u  rr\(       aA  \!Rj                  " \5      \!Rj                  " S5      :  r\(       d  \&GRO                  S\ 35        O\&GRQ                  S5        SrS~rSr\4\*;   a  S$rO\0\,;   a  \1\*;  a  \R                  R                  S5      SLr\(       a-  SrSr\ H  r \R                  RC                  \5      r  O   \SLr\(       a>  \!Rj                  " \5      \!Rj                  " S5      :  a  \&GRQ                  S\ S35        SrO\&GRQ                  S5        \R                  R                  S5      SLr \R                  RC                  S5      r\&R                  S\ 35        \R                  R                  S5      SLr \R                  RC                  S5      r\&R                  S\ 35        S~r\R                  R                  S5      SL=(       d    \R                  R                  S5      SLr \R                  RC                  S5      r\&R                  S\ 35        Sr\2\,;   aD  \)" SS$S%9u  rr\(       a3  \)" SS$S%9u  rr\(       a  \&GRQ                  S\ S\ S35        OS=rrS~=rrSr\3\*;   a'  \)" SS$S%9u  rr\(       a  \&GRQ                  S\ S35        S rS rS rS rS r\74S\'4S jjrS rS rS r\<4S\'4S jjrS rS rS rS rS rS rS rS rS rS r\84S\'4S jjrS rS rS rS rS rS rS rS rS rGSS\\'   4S jjrS\(4S jrS\(4S jrS r\" 5       S 5       r\" 5       S 5       rS rS rS rS rS rS rS rS rS rS rS rS rS r\GSS j5       r\" 5       GSS j5       r\" 5       GSS j5       r\" 5       GSS j5       r\" 5       GSS j5       r\S 5       r\S 5       rS rS rS rS rS rS rS rS rS rS rS rS rS r\=4S\'4S jjrS rS Gr S GrGSS\'4S jjGr\GSS j5       Gr\" 5       S 5       GrS\(4S jGrS Gr\" 5       S 5       Gr\" 5       S\'4S j5       Gr\" 5       GSS\'S\(4S jj5       Gr	\" 5       GSS\'S\(4S jj5       Gr
S GrS GrS GrS GrS GrS Gr\:4S\'4S jjGrS Gr\94S\'4S jjGrS GrS Gr\?4S\'4S jjGrS GrS GrS GrS GrS GrS GrS GrGS  GrGS GrGS Gr GS Gr!\GS 5       Gr"GS Gr#GS Gr$GS Gr%GS Gr&GS	 Gr'GS
 Gr(GS Gr)GS Gr*GS Gr+GS Gr,GS Gr-GS Gr.GS Gr/GS Gr0GS Gr1GS Gr2GS Gr3\>4S\'4GS jjGr4GS Gr5GS Gr6GS Gr7GS Gr8GS Gr9GS Gr:GS Gr;GS Gr<GS Gr=GS  Gr>GS! Gr?GS" Gr@GS# GrAGS$ GrBGS% GrCGS& GrDGS' GrEGS( GrFGS) GrGGS* GrHGS+GrIGS,GrJGS-GrKGS.GrLGS/GrMGS0GrNGS1GrOGS2GrPGS3GrQGS4GrRGS5GrSGS6GrTGS7GrUGS8GrVGS9GrWGS:GrXGS;GrYGS<GrZGS=Gr[GS>Gr\GS?Gr]GS@Gr^GSAGr_GSBGr`GSCGraGSDGrbGSEGrcGSFGrdGSGGreGSHGrfGSIGrgGSJGrhGSKGriGSLGrjGSMGrkGSNGrlGSOGrmGSPGrnGSQGroGSRGrpGSSGrqGSTGrrGSUGrsGSVGrtGSWGruGSXGrvGSYGrwGSZGrxGS[Gry\" / S*\G\I44PS3\G\V44PS5\G\L44PS7\G\M44PS+G\ G\K44PS8\G\Y44PS\G\r44PS9G\G\Q44PS\G\Z44PS=\G\[44PS>\G\]44PSSG\+G\b44PSUG\7G\c44PSVG\8G\d44PS\G\t44PGS\G\G\\44PSF\G\s44PGS]G\G\P44PSY\G\o44PS[G\#G\n44PS_\G\e44PS]G\)G\^44PSbG\G\O44PSeG\G\W44PGS^G\5G\h44PSkG\*G\_44PGS_\G\X44PSlG\&G\`44PSnG\0G\i44PSpG\3G\a44PSGG\1G\j44PSHG\2G\l44PSoG\!G\N44PS\G\R44PSs\G\S44PGS`G\"G\m44PSaG\G\f44PS#\G\p44PSG\:G\q44PGSaG\?G\u44PSAG\@G\v44PST\G\w44PGSbG\AG\x44PS6\G\J44PS|G\GG\y44PSDG\'G\g44P5      GrzGSc Gr{ " GSd GSeG\|5      Gr}GSf Gr~\\'   Gr\G\\\'\\'   4   4   Gr " GSg GSh\5      Gr " GSi GSjG\5      GrGSGSk\'S\4GSl jjGr " GSm GSn\5      Gr\" 5       S\\'\'\'4   4GSo j5       Gr " GSp GSq5      GrGSrGSs.GSt jGrGSu GSvGSw GSxGSy GSzGS{ GS|GS} GS~GS GS0GrGS Gr\" 5       GS 5       GrGS Gr\" 5       GSGS\'GS\\'   SG\4GS jj5       GrGS Grg! \R                  R                   a     \R                  RC                  S;5      r[\&R                  S:\[ 35         GN! \R                  R                   aZ     \R                  RC                  S<5      r[\&R                  S:\[ 35          GNM! \R                  R                   a    SrY   GNnf = ff = ff = f! \R                  R                   a    Srt GNf = f! \R                  R                   a    Sr G
Nf = f! \R                  R                   a     G	M  f = f! \R                  R                   a    Sr GNf = f! \R                  R                   a    Sr GNf = f! \R                  R                   a    Sr GNdf = f(  zD
Import utilities: Utilities related to imports and our lazy inits.
    N)OrderedDict)Enum)	lru_cache)chain)
ModuleType)AnyDict	FrozenSetListOptionalSetTupleUnion)version   )loggingFpkg_namereturn_versionreturnc                 @   [         R                  R                  U 5      S LnSnU(       a;   [         R                  R	                  U 5      n[        R                  S	U  S
U 35        U(       a  X#4$ U$ ! [         R                  R
                   a    U S:X  aG   [         R                  " U 5      n[        USS5      nSU;   a  UnSn N{Sn N! [         a    Sn  Nf = fU S:X  a5   [         R                  R	                  S5      n N! [         a    Sn  Nf = fSn Nf = f)NN/Atorch__version__devTFquarkz	amd-quarkz	Detected z
 version: )	importlibutil	find_specmetadatar   PackageNotFoundErrorimport_modulegetattrImportError	Exceptionloggerdebug)r   r   package_existspackage_versionpackagetemp_versions         W/var/www/auris/envauris/lib/python3.13/site-packages/transformers/utils/import_utils.py_is_package_availabler,   -   s!   ^^--h7tCNO	' (0088BO2 	y
*_4EFG..9 !!66 	'7"+'55h?G#*7M5#IL,*6)-)." +%*N+ W$+&/&8&8&@&@&MO  +%*N+ "'/	'sS   A2 2$D-C
C

CDC	D$DDDDDD>   1ONYESTRUEAUTOUSE_TF	USE_TORCHUSE_FLAXUSE_TORCH_XLAr-   FORCE_TF_AVAILABLEz1.10z0.26.0z1.2.6z1.12.0z0.10.0z2.2.0z0.2.1z0.0.4z0.4.0z0.5.0
accelerateT)r   apexapollo_torchaqlmvptqavdecordbitsandbyteseetq
fbgemm_gpugalore_torch
lomo_optim	grokadamwschedulefreebs4coloredlogscv2yt_dlpdatasets
detectron2faissz$Successfully imported faiss version z	faiss-cpuz	faiss-gpuftfyg2p_enfast_hadamard_transformintel_extension_for_pytorchjiebajinja2kenlm	keras_nlpLevenshteinlibrosanattennltkonnxopenaioptimum	auto_gptq	gptqmodel
auto_roundawqr   optimum_quantocompressed_tensorspandaspeft
phonemizeruromanpsutilpy3nvmlpyctcdecodepygmentspytesseractpytestpytorch_quantizationrjieba
sacremosessafetensorsscipysentencepieceseqioggufsklearnzscikit-learnsmdistributed	soundfilespacy	sudachipytensorflow_probabilitytensorflow_texttf2onnxtimm
tokenizers
torchaudiotorchao
torchdistxtorchvisionmlx	num2wordshqqtiktokenblobfileliger_kerneltriton
spqr_quantrichkernelsr   r   2.1.0z?Disabling PyTorch because PyTorch >= 2.1 is required but found z'Disabling PyTorch because USE_TF is set
tensorflow)r   ztensorflow-cpuztensorflow-gpuz
tf-nightlyztf-nightly-cpuztf-nightly-gpuztf-nightly-rocmzintel-tensorflowzintel-tensorflow-avx512ztensorflow-rocmztensorflow-macosztensorflow-aarch642z"TensorFlow found but with version z*. Transformers requires version 2 minimum.z-Disabling Tensorflow because USE_TORCH is setessentiaz'Successfully imported essentia version pretty_midiz*Successfully imported pretty_midi version 	torch_ccloneccl_bindings_for_pytorchoneccl_bind_ptz Detected oneccl_bind_pt version flaxjaxzJAX version z, Flax version z available.	torch_xlazTorch XLA version c                      [         $ N)_kenlm_available     r+   is_kenlm_availabler   L      r   c                      [         $ r   )_kernels_availabler   r   r+   is_kernels_availabler   P      r   c                      [         $ r   )_cv2_availabler   r   r+   is_cv2_availabler   T      r   c                      [         $ r   )_yt_dlp_availabler   r   r+   is_yt_dlp_availabler   X      r   c                      [         $ r   )_torch_availabler   r   r+   is_torch_availabler   \  r   r   min_versionc                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_accelerate_availabler   parse_accelerate_versionr   s    r+   is_accelerate_availabler   `  &     eW]]3F%G7==YdKe%eer   c                  B    [        5       (       a  SS Kn [        U S5      $ g)Nr   acceleratorF)r   r   hasattrr   s    r+   is_torch_accelerator_availabler   d  s    um,,r   c                  V    [        5       (       a  SSKn U R                  5       S:X  a  ggg)zz
Check whether pytorch uses deterministic algorithms by looking if torch.set_deterministic_debug_mode() is set to 1 or 2"
r   NFT)r   r   get_deterministic_debug_moder   s    r+   is_torch_deterministicr   m  s*     --/14r   c                      [         $ r   )_hadamard_availabler   r   r+   is_hadamard_availabler   |      r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_hqq_availabler   r   _hqq_versionr   s    r+   is_hqq_availabler     s$    WgmmL9W]];=WWWr   c                      [         $ r   )_pygments_availabler   r   r+   is_pygments_availabler     r   r   c                      [         $ r   )_torch_versionr   r   r+   get_torch_versionr     r   r   c                      [        5       (       d  g[        S:X  a  g[        5       (       a  g[        5       (       a  g[        R
                  " [        5      [        R
                  " S5      :  $ )NFr   Tz2.1.1)r   r   is_torch_mlu_availableis_torch_npu_availabler   r   r   r   r+   is_torch_sdpa_availabler     sP    	5	  ==(GMM',BBBr   c                      [        5       (       d  g[        S:X  a  g[        R                  " [        5      [        R                  " S5      :  $ )NFr   z2.5.0)r   r   r   r   r   r   r+   is_torch_flex_attn_availabler     s8    	5	  ==(GMM',BBBr   c                      [         $ r   )_torchvision_availabler   r   r+   is_torchvision_availabler         !!r   c                      [        5       (       d  g[        R                  " [        5      [        R                  " S5      :  $ )NFz0.15)r   r   r   _torchvision_versionr   r   r+   is_torchvision_v2_availabler     s.    #%% ==-.'--2GGGr   c                      [         $ r   )_galore_torch_availabler   r   r+   is_galore_torch_availabler         ""r   c                      [         $ r   )_apollo_torch_availabler   r   r+   is_apollo_torch_availabler     r   r   c                      [         $ r   )_lomo_availabler   r   r+   is_lomo_availabler         r   c                      [         $ r   )_grokadamw_availabler   r   r+   is_grokadamw_availabler         r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_schedulefree_availabler   r   _schedulefree_versionr   s    r+   is_schedulefree_availabler     s&    "iw}}5J'Kw}}]hOi'iir   c                      [         $ r   )_pyctcdecode_availabler   r   r+   is_pyctcdecode_availabler     r   r   c                      [         $ r   )_librosa_availabler   r   r+   is_librosa_availabler     r   r   c                      [         $ r   )_essentia_availabler   r   r+   is_essentia_availabler     r   r   c                      [         $ r   )_pretty_midi_availabler   r   r+   is_pretty_midi_availabler     r   r   c                  ^    [        5       (       a  SS Kn U R                  R                  5       $ gNr   F)r   r   cudais_availabler   s    r+   is_torch_cuda_availabler     s$    zz&&((r   c                      [        5       (       a/  SS Kn U R                  R                  5       (       d  g[	        S5      $ g)Nr   F	mamba_ssmr   r   r   r   r,   r   s    r+   is_mamba_ssm_availabler     s2    zz&&(((55r   c                     [        5       (       aq  SS Kn U R                  R                  5       (       d  g[	        S5      (       a=  SS Kn[        R                  " UR                  5      [        R                  " S5      :  a  gg)Nr   Fr   2.0.4T)	r   r   r   r   r,   r   r   r   r   )r   r   s     r+   is_mamba_2_ssm_availabler    sX    zz&&(($[11 ==!6!677==;QQr   c                      [        5       (       a/  SS Kn U R                  R                  5       (       d  g[	        S5      $ g)Nr   Fcausal_conv1dr   r   s    r+   is_causal_conv1d_availabler    s2    zz&&(($_55r   c                  8    [        5       (       a  [        S5      $ g)NmambapyF)r   r,   r   r   r+   is_mambapy_availabler    s    $Y//r   c                    [        5       (       a  SS Kn[        UR                  S5      (       a  UR                  R                  R                  5       =(       a$    UR                  R                  R                  5       nU b<  [        R                  " [        5      [        R                  " U 5      :  nU=(       a    UnU$ g)Nr   mpsF)
r   r   r   backendsr	  r   is_builtr   r   r   )r   r   backend_availableflags       r+   is_torch_mps_availabler  
  s    5>>5)) % 2 2 ? ? A cennFXFXFaFaFc&}}^4k8RR$5$>$!$$r   c                  b   [        5       (       d  gSS Kn U R                  R                  5       (       a  U R                  R	                  5       $ [        5       (       a  U R                  R	                  5       $ [        5       (       a  g[        5       (       a  U R                  R	                  5       $ g)NFr   T)
r   r   r   r   is_bf16_supportedis_torch_xpu_availablexpuis_torch_hpu_availabler   npur   s    r+   is_torch_bf16_gpu_availabler    s~    zz  zz++--yy**,,yy**,,r   c                      [        5       $ r   r   r   r   r+   is_torch_bf16_cpu_availabler  (      r   c                  L    [         R                  " S[        5        [        5       $ )NzThe util is_torch_bf16_available is deprecated, please use is_torch_bf16_gpu_available or is_torch_bf16_cpu_available instead according to whether it's used with cpu or gpu)warningswarnFutureWarningr  r   r   r+   is_torch_bf16_availabler  ,  s$     MM	`
 '((r   c                 T   [        5       (       d  g[        5       (       a  [        5       (       a  ggSS Kn UR	                  SSUR
                  U S9nX"-  nSu  pEnUR                  XEXaR
                  U S9nUR                  R                  XaR
                  U S9nU" U5      ng!    g= f)NFTr      dtypedevice)         )	r   r  is_habana_gaudi1r   zerosfloat16randnnn	LayerNorm)	r#  r   x_batchsentence_lengthembedding_dim	embedding
layer_norms	            r+   !is_torch_fp16_available_on_devicer4  7  s    KK1EMM&KAE 18-KK]]ciKj	XX'']]SY'Z
y!  s   A,B# #B'c                     [        5       (       d  gSS KnU S:X  a
  [        5       $ U S:X  a  g UR                  SSUR                  U S9nX"-  ng!    g= f)NFr   r   hpuTr   r!  )r   r   r  r(  bfloat16)r#  r   r-  r.  s       r+   !is_torch_bf16_available_on_devicer8  W  sc    *,,KK1ENN6KBE  s    A Ac                     [        5       (       d  gSS Kn U R                  R                  5       (       a  U R                  R                  c  gU R                  R                  U R                  R                  5       5      R                  S:  a  gg)NFr      T)r   r   r   r   r   get_device_propertiescurrent_devicemajorr   s    r+   is_torch_tf32_availabler>  o  sf    ::""$$(:(:(Bzz''

(A(A(CDJJQNr   c                      [        5       $ r   r  r   r   r+   is_torch_fx_availabler@  |  r  r   c                      [         $ r   )_peft_availabler   r   r+   is_peft_availablerC    r   r   c                      [         $ r   )_bs4_availabler   r   r+   is_bs4_availablerF    r   r   c                      [         $ r   )_tf_availabler   r   r+   is_tf_availablerI        r   c                      [         $ r   )_coloredlogs_availabler   r   r+   is_coloredlogs_availablerM    r   r   c                      [         $ r   )_tf2onnx_availabler   r   r+   is_tf2onnx_availablerP    r   r   c                      [         $ r   )_onnx_availabler   r   r+   is_onnx_availablerS    r   r   c                      [         $ r   )_openai_availabler   r   r+   is_openai_availablerV    r   r   c                      [         $ r   )_flax_availabler   r   r+   is_flax_availablerY    r   r   c                       [         R                  R                  S5      S L=(       a"    [         R                  R	                  S5      S:  $ ! [         R                  R
                   a     gf = f)Nflutezflute-kernelz0.4.1F)r   r   r   r   r   r    r   r   r+   is_flute_availabler\    s\    ~~''0<vASASA[A[\jAkovAvv22 s   A	A A-,A-c                      [         $ r   )_ftfy_availabler   r   r+   is_ftfy_availabler_    r   r   c                      [         $ r   )_g2p_en_availabler   r   r+   is_g2p_en_availablerb    r   r   c                     U (       a  U(       a   S5       e[         (       d  gSSKnU(       a  UR                  R                  5       S;   $ U (       a  UR                  R                  5       S:H  $ g)z
Check if `torch_xla` is available. To train a native pytorch job in an environment with torch xla installed, set
the USE_TORCH_XLA to false.
z6The check_is_tpu and check_is_gpu cannot both be true.Fr   N)GPUCUDATPUT)_torch_xla_availabler   runtimedevice_type)check_is_tpucheck_is_gpur   s      r+   is_torch_xla_availablerl    s^     h0hh.  ,,./AA	  ,,.%77r   c                 X    [         R                  R                  S5      b
  [        5       $ g)Ntorch_neuronxF)r   r   r   rl  )check_devices    r+   is_torch_neuroncore_availablerp    s#    ~~0<%''r   c                 \   [         (       a   [        R                  R                  S5      c  gSSKnSSKnU (       a5   UR                  R                  5       nUR                  R                  5       $ [        US5      =(       a    UR                  R                  5       $ ! [         a     gf = f)zQChecks if `torch_npu` is installed and potentially if a NPU is in the environment	torch_npuNFr   r  )r   r   r   r   r   rr  r  device_countr   RuntimeErrorr   )ro  r   rr  r.  s       r+   r   r     s     y~~77DL			&&(A99))++ 5% =UYY%;%;%==  		s   3B 
B+*B+c                    [         (       a   [        R                  R                  S5      c  gSSKnSSKn[        R                  R                  S5      n [        S5      [        R                  S'   UR                  R                  5       nU(       a  U[        R                  S'   U$ [        R                  R                  SS5         U$ ! U(       a  U[        R                  S'   f [        R                  R                  SS5        f = f)zv
Checks if `mlu` is available via an `cndev-based` check which won't trigger the drivers and leave mlu
uninitialized.
	torch_mluNFr   PYTORCH_CNDEV_BASED_MLU_CHECKr   )r   r   r   r   r   rv  osenvirongetstrmlur   pop)ro  r   rv  ,pytorch_cndev_based_mlu_check_previous_value	availables        r+   r   r     s     y~~77DL35::>>Ba3b0B69!f

23II**,	7:fBJJ67  JJNN:DA 8:fBJJ67JJNN:DAs   6C
 
=Dc                    [         (       a   [        R                  R                  S5      c  gSSKnSSKnSn[        (       a3  [        R                  " [        5      [        R                  " U5      :  a  gU (       a5   UR                  R                  5       nUR                  R                  5       $ [        US5      =(       a    UR                  R                  5       $ ! [         a     gf = f)zSChecks if `torch_musa` is installed and potentially if a MUSA is in the environment
torch_musaNFr   z0.33.0musa)r   r   r   r   r   r  r   r   r   r   r  rs  r   rt  r   )ro  r   r  torch_musa_min_versionr.  s        r+   is_torch_musa_availabler    s     y~~77EM%/B!CgmmTjFk!k	

'')A::**,, 5&!?ejj&=&=&??  		s   =3C 
C+*C+c                    ^^ [         (       a@  [        R                  R                  S5      b   [        R                  R                  S5      c  gSn [        (       a3  [
        R                  " [        5      [
        R                  " U 5      :  a  gSSKm[        R                  R                  SS5      S:X  a  SSKn[        TS	5      (       a  TR                  R                  5       (       d  gSSKJs  Js  Jn  UR'                  5       UR(                  R*                  :X  a.  TR,                  R.                  mUU4S
 jnUTR,                  l        g)zQChecks if `torch.hpu` is available and potentially if a HPU is in the environmenthabana_frameworksNzhabana_frameworks.torchFz1.5.0r   PT_HPU_LAZY_MODEr-   r6  c                    > U R                   TR                  :X  a  [        R                  S5        X U'   g T" XU5        g )NzIn-place tensor.masked_fill_(mask, value) is not supported for int64 tensors on Gaudi1. This operation will be performed out-of-place using tensor[mask] = value.)r"  int64r%   warning_once)selfmaskvalueoriginal_masked_fill_r   s      r+   patched_masked_fill_4is_torch_hpu_available.<locals>.patched_masked_fill_/  s:    zzU[[(##` #T
%d%8r   T)r   r   r   r   r   r   r   r   r   rx  ry  rz  habana_frameworks.torchr   r6  r   *habana_frameworks.torch.utils.experimentalutilsexperimental_get_device_typesynDeviceTypesynDeviceGaudiTensormasked_fill_)torch_hpu_min_versionr  htexpr  r  r   s       @@r+   r  r    s     >>##$78@>>##$=>F#/B!CgmmTiFj!j	zz~~(#.#5&5%  		(>(>(@(@>> 5#6#6#E#EE % 9 9	9 %9!r   c                      [        5       (       d  gSS KJs  Js  Jn   U R                  5       U R                  R                  :H  $ NFr   )r  r  r   r  r  r  r  r  )r  s    r+   r'  r'  >  s6    !##>> !!#u':':'I'IIIr   c                      [        5       $ r   r  r   r   r+   is_torchdynamo_availabler  I  r  r   c                      [        5       $ r   r  r   r   r+   is_torch_compile_availabler  M  r  r   c                      [        5       (       d  g SS Kn U R                  R                  5       $ ! [         a+     SS KJn  UR                  5       s $ ! [         a      gf = ff = fr  )r   r   compileris_compilingr$   torch._dynamo_dynamor   dynamos     r+   is_torchdynamo_compilingr  Q  sa    
~~**,, 	*&&(( 		,   0 
A%AA%
A!A% A!!A%c                      [        5       (       d  g SS Kn U R                  R                  5       $ ! [         a+     SS KJn  UR                  5       s $ ! [         a      gf = ff = fr  )r   r   r  is_exportingr$   r  r  r  s     r+   is_torchdynamo_exportingr  d  sa    
~~**,, 	*&&(( 		r  c                      [         R                  R                  S5      c  g[         R                  R                  S5      S L$ )Ntorch_tensorrtFztorch_tensorrt.fxr   r   r   r   r   r+   is_torch_tensorrt_fx_availabler  u  s6    ~~ 019>>##$78DDr   c                      [         $ r   )_datasets_availabler   r   r+   is_datasets_availabler  {  r   r   c                      [         $ r   )_detectron2_availabler   r   r+   is_detectron2_availabler          r   c                      [         $ r   )_rjieba_availabler   r   r+   is_rjieba_availabler    r   r   c                      [         $ r   )_psutil_availabler   r   r+   is_psutil_availabler    r   r   c                      [         $ r   )_py3nvml_availabler   r   r+   is_py3nvml_availabler    r   r   c                      [         $ r   )_sacremoses_availabler   r   r+   is_sacremoses_availabler    r  r   c                      [         $ r   )_apex_availabler   r   r+   is_apex_availabler    r   r   c                      [         $ r   )_aqlm_availabler   r   r+   is_aqlm_availabler    r   r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_vptq_availabler   r   _vptq_versionr   s    r+   is_vptq_availabler    s$    Yw}}];w}}[?YYYr   c                      [         $ r   )_av_availabler   r   r+   is_av_availabler    rJ  r   c                      [         $ r   )_decord_availabler   r   r+   is_decord_availabler    r   r   c                  n     [         R                  " SR                  5       5        g! [         a     gf = f)z
Code comes from *torch.utils.cpp_extension.is_ninja_available()*. Returns `True` if the
[ninja](https://ninja-build.org/) build system is available on the system, `False` otherwise.
zninja --versionTF)
subprocesscheck_outputsplitr$   r   r   r+   is_ninja_availabler    s8    
 1 7 7 9:   s   $' 
44c           	      2   S n[        5       (       a  [        (       d  gU" [        5      nU" [        5      nX#:w  a$  [        R                  SU SU S[         S35        gU (       a1  [        R                  " [        5      [        R                  " U 5      :  $ g)Nc                     [        [        R                  " U 5      R                  5      S-   [        [        R                  " U 5      R                  5      -   $ N.)r{  r   r   r=  minor)full_versions    r+    get_major_and_minor_from_version;is_ipex_available.<locals>.get_major_and_minor_from_version  s;    7==.445;c'--P\B]BcBc>dddr   FzIntel Extension for PyTorch z needs to work with PyTorch z.*, but PyTorch z? is found. Please switch to the matching version and run again.T)r   _ipex_availabler   _ipex_versionr%   warningr   r   )r   r  torch_major_and_minoripex_major_and_minors       r+   is_ipex_availabler    s    e <^L;MJ4*+?*@@\]q\r s*++jl	
 }}]+w}}[/IIIr   c                    [        5       (       d  g[        R                  " [        5      nUR                  S:X  aE  UR
                  S:  a5  [        5       (       a  SSKnO!UR                  S:X  a  UR
                  S:  a  gSSKnU (       a5   UR                  R                  5       nUR                  R                  5       $ [        US5      =(       a    UR                  R                  5       $ ! [         a     gf = f)z
Checks if XPU acceleration is available either via native PyTorch (>=2.6),
`intel_extension_for_pytorch` or via stock PyTorch (>=2.4) and potentially
if a XPU is in the environment.
Fr      r   Nr%  r  )r   r   r   r   r=  r  r  rO   r   r  rs  r   rt  r   )ro  torch_versionrO   r   r.  s        r+   r  r    s     MM.1MaM$7$7!$;.  A%-*=*=*A			&&(A99))++ 5% =UYY%;%;%==  		s   3C- -
C:9C:c                     [        5       (       a  [        (       d  gSS Kn [        R                  " [
        R                  R                  S5      5      [        R                  " S5      :  a  U R                  R                  5       $ g)NFr   r>   z0.43.1T)	r   _bitsandbytes_availabler   r   r   r   r   r   r   r   s    r+   is_bitsandbytes_availabler    s]    '>'> }}Y''//?@7==QYCZZzz&&(( r   c                  Z    [        5       (       d  gSS Kn S[        U S[        5       5      ;   $ )NFr   multi_backendfeatures)r  r>   r"   set)bnbs    r+   'is_bitsandbytes_multi_backend_availabler    s'    $&&gc:su===r   c                     [        5       (       d  g[        S5      (       d  gSS Kn U R                  R	                  5       (       d  [        5       (       d  gU R                  R                  (       aJ  [        R                  " [        R                  R                  S5      5      [        R                  " S5      :  $ U R                  R                  (       aJ  [        R                  " [        R                  R                  S5      5      [        R                  " S5      :  $ [        5       (       aJ  [        R                  " [        R                  R                  S5      5      [        R                  " S5      :  $ g)NF
flash_attnr   r   r   z2.3.3)r   r,   r   r   r   r   r   r   r   r   hipr   s    r+   is_flash_attn_2_availabler    s     .. JJ##%%)?)A)A}}}}Y//77EF'--X_J```			}}Y//77EF'--X_J```		!	!}}Y//77EF'--X_J```r   c                      [        S5      (       d  g[        R                  " [        R                  R                  S5      5      [        R                  " S5      :  $ )Nr  Fr   r,   r   r   r   r   r   r   r+   #is_flash_attn_greater_or_equal_2_10r    s?     ..==++33LABgmmT[F\\\r   library_versionc                     [        S5      (       d  g[        R                  " [        R                  R                  S5      5      [        R                  " U 5      :  $ )Nr  Fr  )r  s    r+   is_flash_attn_greater_or_equalr    s?     ..==++33LABgmmTcFdddr   
accept_devc                    [        S5      (       d  gU(       ah  [        R                  " [        R                  " [        R                  R                  S5      5      R
                  5      [        R                  " U 5      :  $ [        R                  " [        R                  R                  S5      5      [        R                  " U 5      :  $ )z
Accepts a library version and returns True if the current version of the library is greater than or equal to the
given version. If `accept_dev` is True, it will also accept development versions (e.g. 2.7.0.dev20250320 matches
2.7.0).
r   Fr,   r   r   r   r   base_versionr  r  s     r+   is_torch_greater_or_equalr  &  s     !))}}W]]9+=+=+E+Eg+NO\\]ahananb
 
 	
 }}Y//77@AW]]SbEcccr   c                    [        S5      (       d  gU(       ah  [        R                  " [        R                  " [        R                  R                  S5      5      R
                  5      [        R                  " U 5      :  $ [        R                  " [        R                  R                  S5      5      [        R                  " U 5      :  $ )Nhuggingface_hubFr   r  s     r+   #is_huggingface_hub_greater_or_equalr  8  s     !233}}MM),,445FGHUU
]]?+, 	, }}Y//778IJKw}}]lOmmmr   c                      [         $ r   )_torchdistx_availabler   r   r+   is_torchdistx_availabler	  E  r  r   c                      [         $ r   )_faiss_availabler   r   r+   is_faiss_availabler  I  r   r   c                      [         $ r   )_scipy_availabler   r   r+   is_scipy_availabler  M  r   r   c                      [         $ r   )_sklearn_availabler   r   r+   is_sklearn_availabler  Q  r   r   c                      [         $ r   )_sentencepiece_availabler   r   r+   is_sentencepiece_availabler  U  s    ##r   c                      [         $ r   )_is_seqio_availabler   r   r+   is_seqio_availabler  Y  r   r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_is_gguf_availabler   r   _gguf_versionr   s    r+   is_gguf_availabler  ]  s%    \'--">'--P[B\"\\r   c                      [         R                  R                  S5      c  g[         R                  R                  S5      S L$ )NgoogleFzgoogle.protobufr  r   r   r+   is_protobuf_availabler  a  s5    ~~)1>>##$56dBBr   c                     [        5       =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )r   r   r   r   r   s    r+   is_fsdp_availabler!  g  s(    _GMM.$AW]]S^E_$__r   c                      [         $ r   )_optimum_availabler   r   r+   is_optimum_availabler$  k  r   r   c                      [         $ r   )_auto_awq_availabler   r   r+   is_auto_awq_availabler'  o  r   r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_auto_round_availabler   r   _auto_round_versionr   s    r+   is_auto_round_availabler+  s  r   r   c                      [         $ r   )_is_optimum_quanto_availabler   r   r+   is_optimum_quanto_availabler.  w  s    ''r   c                      [         $ r   )_quark_availabler   r   r+   is_quark_availabler1  |  r   r   c                      [         $ r   )_compressed_tensors_availabler   r   r+   is_compressed_tensors_availabler4    s    ((r   c                      [         $ r   )_auto_gptq_availabler   r   r+   is_auto_gptq_availabler7    r   r   c                      [         $ r   )_gptqmodel_availabler   r   r+   is_gptqmodel_availabler:    r   r   c                      [         $ r   )_eetq_availabler   r   r+   is_eetq_availabler=    r   r   c                      [         $ r   )_fbgemm_gpu_availabler   r   r+   is_fbgemm_gpu_availabler@    r  r   c                      [         $ r   )_levenshtein_availabler   r   r+   is_levenshtein_availablerC    r   r   c                  2    [         =(       a    [        S5      $ )Nzoptimum.neuron)r#  r,   r   r   r+   is_optimum_neuron_availablerE    s    I"78H"IIr   c                      [         $ r   )_safetensors_availabler   r   r+   is_safetensors_availablerH    r   r   c                      [         $ r   )_tokenizers_availabler   r   r+   is_tokenizers_availablerK    r  r   c                     [         R                  R                  S5      S Ln U (       a8   [         R                  R	                  S5      n[        R                  SU 35        U $ ! [         R                  R
                   aH     [         R                  R	                  S5      n NZ! [         R                  R
                   a      gf = ff = f)NPILPillowzPillow-SIMDFzDetected PIL version )r   r   r   r   r   r    r%   r&   )_pil_availabler(   s     r+   is_vision_availablerP    s    ^^--e4D@N	'0088BO 	,_,=>? !!66 	"+"4"4"<"<]"K%%:: 	s)   A# #C	B##CC	CC	c                      [         $ r   )_pytesseract_availabler   r   r+   is_pytesseract_availablerS    r   r   c                      [         $ r   )_pytest_availabler   r   r+   is_pytest_availablerV    r   r   c                      [         $ r   )_spacy_availabler   r   r+   is_spacy_availablerY    r   r   c                  0    [        5       =(       a    [        $ r   )rI  _tensorflow_text_availabler   r   r+   is_tensorflow_text_availabler\    s    ;!;;r   c                  0    [        5       =(       a    [        $ r   )r\  _keras_nlp_availabler   r   r+   is_keras_nlp_availabler_    s    ')B.BBr   c                      S[         R                  ;   a  g[         R                  S   R                  n SU " 5       R                  ;  a  [	        S5      eS[
        R                  ;   a"  [
        R                  S   S:  a  [	        S5      e[        R                  R                  S5      S L$ ! [        [        [        4 a     g	f = f)
NmarimoTIPythonIPKernelAppconsoleDATABRICKS_RUNTIME_VERSIONz11.0
databricksF)sysmodulesget_ipythonconfigr#   rx  ry  r   r   r   AttributeErrorKeyError)ri  s    r+   is_in_notebookrm    s    s{{"kk),88 4 44i(('2::5"**Ea:bek:k l++~~''	2$>>K2 s   B+ BB+ +CCc                      [         $ r   )_pytorch_quantization_availabler   r   r+   !is_pytorch_quantization_availablerp    s    **r   c                      [         $ r   )!_tensorflow_probability_availabler   r   r+   #is_tensorflow_probability_availablers    s    ,,r   c                      [         $ r   )_pandas_availabler   r   r+   is_pandas_availablerv    r   r   c                      [         R                  " SS5      n  [        R                  " U 5      n U R	                  SS5      (       d  g [        $ ! [        R
                   a     gf = f)NSM_FRAMEWORK_PARAMS{}*sagemaker_distributed_dataparallel_enabledF)rx  getenvjsonloadsrz  JSONDecodeError_smdistributed_available)sagemaker_paramss    r+   is_sagemaker_dp_enabledr    si    yy!6=::&67##$PRWXX Y
 $#  s   -A A%$A%c                  p   [         R                  " SS5      n  [        R                  " U 5      n SU ;  a  g [         R                  " SS5      n [        R                  " U5      nUR                  SS5      (       d  g [        $ ! [        R                   a     gf = f! [        R                   a     gf = f)NSM_HP_MP_PARAMETERSry  
partitionsFrx  sagemaker_mpi_enabled)rx  r{  r|  r}  r~  rz  r  )smp_optionsmpi_optionss     r+   is_sagemaker_mp_enabledr    s    ))148Kjj-{* + ))148Kjj-6>> ?
 $#    s#   B -B BBB54B5c                  (    S[         R                  ;   $ )NSAGEMAKER_JOB_NAME)rx  ry  r   r   r+   is_training_run_on_sagemakerr    s    2::--r   c                      [         $ r   )_soundfile_availabler   r   r+   is_soundfile_availabler    r   r   c                      [         $ r   )_timm_availabler   r   r+   is_timm_availabler    r   r   c                      [         $ r   )_natten_availabler   r   r+   is_natten_availabler    r   r   c                      [         $ r   )_nltk_availabler   r   r+   is_nltk_availabler    r   r   c                      [         $ r   _torchaudio_availabler   r   r+   is_torchaudio_availabler  !  r  r   c                 ~    [         =(       a1    [        R                  " [        5      [        R                  " U 5      :  $ r   )_torchao_availabler   r   _torchao_versionr   s    r+   is_torchao_availabler  %  s&    _'--0@"AW]]S^E_"__r   c                      [         $ r   r  r   r   r+   is_speech_availabler  )  s      r   c                      [         $ r   )_spqr_availabler   r   r+   is_spqr_availabler  .  r   r   c                      [         $ r   )_phonemizer_availabler   r   r+   is_phonemizer_availabler  2  r  r   c                      [         $ r   )_uroman_availabler   r   r+   is_uroman_availabler  6  r   r   c                    ^  U 4S jnU$ )Nc                  @   > [         (       d  [        S5      eT" U 0 UD6$ )Nz|You need to install pytorch to use this method or class, or activate it with environment variables USE_TORCH=1 and USE_TF=0.)r   r#   )argskwargsfns     r+   wrapper"torch_only_method.<locals>.wrapper;  s.    V 
 t&v&&r   r   )r  r  s   ` r+   torch_only_methodr  :  s    ' Nr   c                      [         $ r   )_is_ccl_availabler   r   r+   is_ccl_availabler  G  r   r   c                      [         $ r   )_sudachipy_availabler   r   r+   is_sudachi_availabler  K  r   r   c                      [         $ r   )_sudachipy_versionr   r   r+   get_sudachi_versionr  O  r   r   c                      [        5       (       d  g[        R                  " [        5      [        R                  " S5      :  $ )NFz0.6.8)r  r   r   r  r   r   r+   is_sudachi_projection_availabler  S  s.    !! ==+,g0FFFr   c                      [         R                  R                  S5      S L=(       a    [        R                  " S5      S L$ )Nrhoknpjumanpp)r   r   r   shutilwhichr   r   r+   is_jumanpp_availabler  \  s0    NN$$X.d:eiAX`dAder   c                  D    [         R                  R                  S5      S L$ )N	pyximportr  r   r   r+   is_cython_availabler  `  s    >>##K0<<r   c                      [         $ r   )_jieba_availabler   r   r+   is_jieba_availabler  d  r   r   c                      [         $ r   )_jinja_availabler   r   r+   is_jinja_availabler  h  r   r   c                      [         $ r   )_mlx_availabler   r   r+   is_mlx_availabler  l  r   r   c                      [         $ r   )_num2words_availabler   r   r+   is_num2words_availabler  p  r   r   c                  (    [         =(       a    [        $ r   )_tiktoken_available_blobfile_availabler   r   r+   is_tiktoken_availabler  t  s    6#66r   c                      [         (       d  g[        R                  " [        R                  R                  S5      5      [        R                  " S5      :  $ )NFr   z0.3.0)_liger_kernel_availabler   r   r   r   r   r   r+   is_liger_kernel_availabler  x  s:    ""==++33NCDV]H^^^r   c                      [         $ r   )_triton_availabler   r   r+   is_triton_availabler    r   r   c                      [         $ r   )_rich_availabler   r   r+   is_rich_availabler    r   r   c                  :    [        S5      (       d  [        S5      eg )Nz2.6aH  Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
See the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434)r  
ValueErrorr   r   r+   check_torch_load_is_safer    s%    $U++b
 	
 ,r   z
{0} requires the PyAv library but it was not found in your environment. You can install it with:
```
pip install av
```
Please note that you may need to restart your runtime after installation.
z
{0} requires the YT-DLP library but it was not found in your environment. You can install it with:
```
pip install yt-dlp
```
Please note that you may need to restart your runtime after installation.
z
{0} requires the PyAv library but it was not found in your environment. You can install it with:
```
pip install decord
```
Please note that you may need to restart your runtime after installation.
z
{0} requires the OpenCV library but it was not found in your environment. You can install it with:
```
pip install opencv-python
```
Please note that you may need to restart your runtime after installation.
ub  
{0} requires the 🤗 Datasets library but it was not found in your environment. You can install it with:
```
pip install datasets
```
In a notebook or a colab, you can install it by executing a cell with
```
!pip install datasets
```
then restarting your kernel.

Note that if you have a local folder named `datasets` or a local python file named `datasets.py` in your current
working directory, python may try to import this instead of the 🤗 Datasets library. You should rename this folder or
that python file if that's the case. Please note that you may need to restart your runtime after installation.
u<  
{0} requires the 🤗 Tokenizers library but it was not found in your environment. You can install it with:
```
pip install tokenizers
```
In a notebook or a colab, you can install it by executing a cell with
```
!pip install tokenizers
```
Please note that you may need to restart your runtime after installation.
aB  
{0} requires the SentencePiece library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/google/sentencepiece#installation and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
aT  
{0} requires the protobuf library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/protocolbuffers/protobuf/tree/master/python#installation and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
aF  
{0} requires the faiss library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/facebookresearch/faiss/blob/master/INSTALL.md and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
a$  
{0} requires the PyTorch library but it was not found in your environment. Checkout the instructions on the
installation page: https://pytorch.org/get-started/locally/ and follow the ones that match your environment.
Please note that you may need to restart your runtime after installation.
a(  
{0} requires the Torchvision library but it was not found in your environment. Checkout the instructions on the
installation page: https://pytorch.org/get-started/locally/ and follow the ones that match your environment.
Please note that you may need to restart your runtime after installation.
a  
{0} requires the PyTorch library but it was not found in your environment.
However, we were able to find a TensorFlow installation. TensorFlow classes begin
with "TF", but are otherwise identically named to our PyTorch classes. This
means that the TF equivalent of the class you tried to import would be "TF{0}".
If you want to use TensorFlow, please use TF classes instead!

If you really do want to use PyTorch please go to
https://pytorch.org/get-started/locally/ and follow the instructions that
match your environment.
a  
{0} requires the TensorFlow library but it was not found in your environment.
However, we were able to find a PyTorch installation. PyTorch classes do not begin
with "TF", but are otherwise identically named to our TF classes.
If you want to use PyTorch, please use those classes instead!

If you really do want to use TensorFlow, please follow the instructions on the
installation page https://www.tensorflow.org/install that match your environment.
z
{0} requires the Beautiful Soup library but it was not found in your environment. You can install it with pip:
`pip install beautifulsoup4`. Please note that you may need to restart your runtime after installation.
aC  
{0} requires the scikit-learn library but it was not found in your environment. You can install it with:
```
pip install -U scikit-learn
```
In a notebook or a colab, you can install it by executing a cell with
```
!pip install -U scikit-learn
```
Please note that you may need to restart your runtime after installation.
a!  
{0} requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the
installation page: https://www.tensorflow.org/install and follow the ones that match your environment.
Please note that you may need to restart your runtime after installation.
aD  
{0} requires the detectron2 library but it was not found in your environment. Checkout the instructions on the
installation page: https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
a  
{0} requires the FLAX library but it was not found in your environment. Checkout the instructions on the
installation page: https://github.com/google/flax and follow the ones that match your environment.
Please note that you may need to restart your runtime after installation.
a8  
{0} requires the ftfy library but it was not found in your environment. Checkout the instructions on the
installation section: https://github.com/rspeer/python-ftfy/tree/master#installing and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
z
{0} requires the python-Levenshtein library but it was not found in your environment. You can install it with pip: `pip
install python-Levenshtein`. Please note that you may need to restart your runtime after installation.
z
{0} requires the g2p-en library but it was not found in your environment. You can install it with pip:
`pip install g2p-en`. Please note that you may need to restart your runtime after installation.
a  
{0} requires the pytorch-quantization library but it was not found in your environment. You can install it with pip:
`pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com`
Please note that you may need to restart your runtime after installation.
z
{0} requires the tensorflow_probability library but it was not found in your environment. You can install it with pip as
explained here: https://github.com/tensorflow/probability. Please note that you may need to restart your runtime after installation.
a  
{0} requires the tensorflow_text library but it was not found in your environment. You can install it with pip as
explained here: https://www.tensorflow.org/text/guide/tf_text_intro.
Please note that you may need to restart your runtime after installation.
z{
{0} requires the torchaudio library but it was not found in your environment. Please install it and restart your
runtime.
a  
{0} requires the pandas library but it was not found in your environment. You can install it with pip as
explained here: https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html.
Please note that you may need to restart your runtime after installation.
z
{0} requires the phonemizer library but it was not found in your environment. You can install it with pip:
`pip install phonemizer`. Please note that you may need to restart your runtime after installation.
z
{0} requires the uroman library but it was not found in your environment. You can install it with pip:
`pip install uroman`. Please note that you may need to restart your runtime after installation.
z
{0} requires the sacremoses library but it was not found in your environment. You can install it with pip:
`pip install sacremoses`. Please note that you may need to restart your runtime after installation.
z
{0} requires the scipy library but it was not found in your environment. You can install it with pip:
`pip install scipy`. Please note that you may need to restart your runtime after installation.
z
{0} requires the keras_nlp library but it was not found in your environment. You can install it with pip.
Please note that you may need to restart your runtime after installation.
z
{0} requires the torchaudio library but it was not found in your environment. You can install it with pip:
`pip install torchaudio`. Please note that you may need to restart your runtime after installation.
z
{0} requires the timm library but it was not found in your environment. You can install it with pip:
`pip install timm`. Please note that you may need to restart your runtime after installation.
a"  
{0} requires the natten library but it was not found in your environment. You can install it by referring to:
shi-labs.com/natten . You can also install it with pip (may take longer to build):
`pip install natten`. Please note that you may need to restart your runtime after installation.
z
{0} requires the numexpr library but it was not found in your environment. You can install it by referring to:
https://numexpr.readthedocs.io/en/latest/index.html.
z
{0} requires the NLTK library but it was not found in your environment. You can install it by referring to:
https://www.nltk.org/install.html. Please note that you may need to restart your runtime after installation.
z
{0} requires the PIL library but it was not found in your environment. You can install it with pip:
`pip install pillow`. Please note that you may need to restart your runtime after installation.
z
{0} requires the PyTesseract library but it was not found in your environment. You can install it with pip:
`pip install pytesseract`. Please note that you may need to restart your runtime after installation.
z
{0} requires the pyctcdecode library but it was not found in your environment. You can install it with pip:
`pip install pyctcdecode`. Please note that you may need to restart your runtime after installation.
z
{0} requires the accelerate library >= {ACCELERATE_MIN_VERSION} it was not found in your environment.
You can install or update it with pip: `pip install --upgrade accelerate`. Please note that you may need to restart your
runtime after installation.
a  
{0} requires the torch ccl library but it was not found in your environment. You can install it with pip:
`pip install oneccl_bind_pt -f https://developer.intel.com/ipex-whl-stable`
Please note that you may need to restart your runtime after installation.
z
{0} requires essentia library. But that was not found in your environment. You can install them with pip:
`pip install essentia==2.1b6.dev1034`
Please note that you may need to restart your runtime after installation.
z
{0} requires the librosa library. But that was not found in your environment. You can install them with pip:
`pip install librosa`
Please note that you may need to restart your runtime after installation.
z
{0} requires the pretty_midi library. But that was not found in your environment. You can install them with pip:
`pip install pretty_midi`
Please note that you may need to restart your runtime after installation.
z
{0} requires the Cython library but it was not found in your environment. You can install it with pip: `pip install
Cython`. Please note that you may need to restart your runtime after installation.
z
{0} requires the jieba library but it was not found in your environment. You can install it with pip: `pip install
jieba`. Please note that you may need to restart your runtime after installation.
z
{0} requires the peft library but it was not found in your environment. You can install it with pip: `pip install
peft`. Please note that you may need to restart your runtime after installation.
z
{0} requires the jinja library but it was not found in your environment. You can install it with pip: `pip install
jinja2`. Please note that you may need to restart your runtime after installation.
z
{0} requires the rich library but it was not found in your environment. You can install it with pip: `pip install
rich`. Please note that you may need to restart your runtime after installation.
levenshteinprotobufspeechtfvisioncythonjinjac                    [        U[        [        45      (       d  U/n[        U S5      (       a  U R                  OU R
                  R                  nSU;   aB  SU;  a<  [        5       (       d-  [        5       (       a  [        [        R                  U5      5      eSU;   aB  SU;  a<  [        5       (       a-  [        5       (       d  [        [        R                  U5      5      e/ nU Hi  n[        U[        5      (       a  UR                  UR                  peO[        U   u  pVU" 5       (       a  MI  UR!                  UR                  U5      5        Mk     U(       a  [        SR#                  U5      5      eg )N__name__r   r   )
isinstancelisttupler   r  	__class__r   rI  r#   PYTORCH_IMPORT_ERROR_WITH_TFformatTF_IMPORT_ERROR_WITH_PYTORCHBackendis_satisfiederror_messageBACKENDS_MAPPINGappendjoin)objr
  namefailedbackendr  msgs          r+   requires_backendsr  6  s#   hu..:"3
333<<9O9OD (t83<N<P<PUdUfUf6==dCDD xG838J8L8LUdUfUf6==dCDDFgw''$1173H3Hs-g6NI{{MM#**T*+  "''&/** r   c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )DummyObjectiR  z
Metaclass for the dummy objects. Any class inheriting from it will return the ImportError generated by
`requires_backend` each time a user tries to access any method of that class.
Tc                    > UR                  S5      (       a  US:w  d  US:X  d  US:X  d  US:X  a  [        TU ]	  U5      $ [        X R                  5        g )Nr.  _from_configis_dummymrocall)
startswithsuper__getattribute__r  	_backends)clskeyr  s     r+   r	  DummyObject.__getattribute__Z  sN    NN3C>$9cZ>OSVZ_S_cfjpcp7+C00#}}-r   r   )	r  
__module____qualname____firstlineno____doc__r  r	  __static_attributes____classcell__r  s   @r+   r  r  R  s    
 H. .r   r  c                 h    [        5       (       a#  SS Kn[        XR                  R                  5      $ gr   )r@  torch.fxr  fxProxy)r-  r   s     r+   is_torch_fx_proxyr  `  s$    !XX^^,,r   c                      ^  \ rS rSrSr   SS\S\S\S\\R                  R                     S\\\\4      S\\\\\   4      4U 4S	 jjjrU 4S
 jrS\S\4S jrS\4S jrS rSrU =r$ )_LazyModuleil  zm
Module class that surfaces all objects but only performs associated imports when the objects are requested.
r  module_fileimport_structuremodule_specextra_objectsexplicit_import_shortcutc                   >^ [         TU ]  U5        0 U l        U(       a  UO0 U l        [	        S UR                  5        5       5      (       Gaj  [        5       U l        0 U l        / U l	        0 nUR                  5        GH  u  p/ n
[        [        [        U	R                  5       5       VVs/ s HC  n[        UR                  S5      S-   5       Vs/ s H  oR                  SU5      S   PM     snPME     snn6 5      nU Hy  mT[         ;   a  [         T   u  pO@[	        U4S jS 5       5      (       a  [#        T5      mTR$                  nO['        ST 35      e U" 5       (       d  U
R)                  T5        My  M{     U R                  R5                  U5      U l        U	R                  5        H}  u  nn[7        U
5      (       a  XR                  U'   U H2  nUU R                  U'   [7        U
5      (       d  M$  XR                  U'   M4     UR9                  U/ 5      R;                  U5        M     U R                  R;                  U[        [        U	R=                  5       6 5      -  5        GM     X l        X@l         [B        RD                  RG                  U5      /U l$        Uc  0 OUU l%        Xl&        Xpl'        g [        UR                  5       5      U l        0 U l        UR                  5        H  u  nnU H  nUU R                  U'   M     M      [        UR                  5       5      [        [        UR=                  5       6 5      -   U l	        X l        X@l         [B        RD                  RG                  U5      /U l$        Uc  0 OUU l%        Xl&        X0l'        g s  snf s  snnf ! [*        R,                  R.                  [0        [2        4 a    U
R)                  T5         GM  f = f)Nc              3   B   #    U  H  n[        U[        5      v   M     g 7fr   r  	frozenset).0r  s     r+   	<genexpr>'_LazyModule.__init__.<locals>.<genexpr>  s     M5Lcz#y))5L   r  r   r   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r%  r  r  s     r+   r&  r'    s     I#g~   =<>FBackend should be defined in the BACKENDS_MAPPING. Offending backend: )(r  __init___object_missing_backend_explicit_import_shortcutanykeysr  _modules_class_to_module__all__itemsr   r  rangecountrsplitr  r  r  r  r  r   r   r    ModuleNotFoundErrorrt  unionlen
setdefaultextendvalues__file____spec__rx  pathdirname__path___objects_name_import_structure)r  r  r  r  r  r  r   rJ  r
  modulemissing_backendskimodule_keyscallabler.  r  rB  r  r  r  s                      @r+   r1  _LazyModule.__init__s  s`    	')$E])Ace&M5E5J5J5LMMMEDM$&D!DL "$4$:$:$< #% " "\`agalalan\op\oWX%q@P:QR:QQXXc1-a0:QR\opq  (G"22&6w&?!IIII&-g&6G'.';';H","hiphq r# 9'zz,33G<  *  ($ !% 3 3K @#)<<>KC+,,<L44S9!'7:--e4/00BR88? "( &00b9@@H $2 ##K#eV]]_6M2N$NOk %=n (M'MWW__[9:DM"/"7B]DMJ%6"   0 5 5 78DM$&D!/557V#E36D))%0 $  8   0 5 5 784GWG^G^G`@a;bbDL'M'MWW__[9:DM"/"7B]DMJ%5"s Sp$ &..CCEXZfg 9(//889s*   ,%NN/NN#N#:O"!O"c                 z   > [         TU ]  5       nU R                   H  nX!;  d  M
  UR                  U5        M     U$ r   )r  __dir__r8  r  )r  resultattrr  s      r+   rS  _LazyModule.__dir__  s8    " LLD!d# ! r   r   c                   ^	 XR                   ;   a  U R                   U   $ XR                  R                  5       ;   am  U R                  U   m	 " U	4S jS[        S9nXl        XR
                  ;  a  SU 3nO*U R
                  U   nUR                  S5      (       d  SU 3nX2l        UnOXR
                  R                  5       ;   a+   U R                  U R
                  U   5      n[        XQ5      nO}XR                  ;   a   U R                  U5      nO[S nU R                  R                  5        H  u  pxX;   d  M  U R                  U5      nM     Uc  [        SU R                   SU 35      e[!        XU5        U$ ! [        [        4 a  n[        SU S35      UeS nAff = f! [        [        4 a  n[        SU S35      UeS nAff = f)	Nc                   .   > \ rS rSr Y rU 4S jrS rSrg),_LazyModule.__getattr__.<locals>.Placeholderi  c                    > [        U T5        g r   )r  )r  r  r  rL  s      r+   r1  5_LazyModule.__getattr__.<locals>.Placeholder.__init__  s    %d,<=r   c                     g r   r   )r  r  r  s      r+   r  1_LazyModule.__getattr__.<locals>.Placeholder.call  s    r   r   N)r  r  r  r  r
  r1  r  r  )rL  s   r+   PlaceholderrY    s    ,	>r   r^  )	metaclasstransformers.zCould not import module 'z4'. Are this object's requirements defined correctly?zmodule z has no attribute )rH  r2  r5  r  r  r7  r  r  _get_moduler"   r=  rt  r6  r3  r9  rk  setattr)
r  r  r^  module_namer  rK  er  rB  rL  s
            @r+   __getattr___LazyModule.__getattr__  s   == ==&&//4466#;;DA  $( 000 -dV4"33D9"--o>>$1+"?K%0"E**//11))$*?*?*EF- ]]"((. E#==CCE> ,,S1E  F }$wt}}o=OPTv%VWWE"- (6 )/v5ij (6 )/v5ijs0   )E= F% =F"FF"%G
5GG
rc  c           	           [         R                  " SU-   U R                  5      $ ! [         a$  n[	        SU R                   SU SU 35      UeS nAff = f)Nr  zFailed to import z@ because of the following error (look up to see its traceback):
)r   r!   r  r$   rt  )r  rc  rd  s      r+   ra  _LazyModule._get_module  sf    	**3+<dmmLL 	#DMM?!K= A!!"% 	s   #& 
AAAc                 `    U R                   U R                  U R                  U R                  44$ r   )r  rI  rC  rJ  r  s    r+   
__reduce___LazyModule.__reduce__   s&    T]]D<R<R STTr   )r8  rC  rG  rD  r7  r3  rJ  r6  rI  r2  rH  )NNN)r  r  r  r  r  r{  IMPORT_STRUCTURE_Tr   r   	machinery
ModuleSpecr	   objectr   r1  rS  r   re  ra  rk  r  r  r  s   @r+   r  r  l  s     AE59CGa6a6 a6 -	a6
 i11<<=a6  S&[ 12a6 #+4T#Y+?"@a6 a6H5 5 5ns U Ur   r  c                       \ rS rSrSrSrg)OptionalDependencyNotAvailablei$  zPInternally used error class for signalling an optional dependency was not found.r   N)r  r  r  r  r  r  r   r   r+   rr  rr  $  s    Zr   rr  rE  c                     Sn[         R                  R                  X5      n[        R                  R                  X#U /S9n[        R                  R                  U5      nUR                  R                  U5        [        R                  U   nU$ )zImports transformers directly

Args:
    path (`str`): The path to the source file
    file (`str`, *optional*): The file to join with the path. Defaults to "__init__.py".

Returns:
    `ModuleType`: The resulting imported module
transformers)submodule_search_locations)rx  rE  r  r   r   spec_from_file_locationmodule_from_specloaderexec_modulerg  rh  )rE  filer  locationspecrK  s         r+   direct_transformers_importr}  (  sq     Dww||D'H>>11$^b]c1dD^^,,T2FKKF#[[FMr   c                       \ rS rSr\R
                  r\R                  r\R                  r
\R                  r\R                  r\R                  r\S\SS 4S j5       rSrg)VersionComparisoni;  version_stringr   c                 n   [         R                  R                  [         R                  R                  [         R                  R                  [         R                  R                  [         R
                  R                  [         R                  R                  [         R                  R                  S.nX   $ )N)r-  z==z!=r/  r.  z>=z<=)r  EQUALr  	NOT_EQUALGREATER_THAN	LESS_THANGREATER_THAN_OR_EQUALLESS_THAN_OR_EQUAL)r  string_to_operators     r+   from_stringVersionComparison.from_stringC  s     #((..#))//#--33"//55",,22#99??#66<<
 "11r   r   N)r  r  r  r  operatoreqr  ner  gtr  ltr  ger  ler  staticmethodr{  r  r  r   r   r+   r  r  ;  s[    KKEI;;LI$KK!2C 2,? 2 2r   r  c                     Sn[         R                  " X5      nU(       a2  UR                  S5      UR                  S5      UR                  S5      4$ [        SU  35      e)Nz#([a-zA-Z0-9_-]+)([!<>=~]+)([0-9.]+)r   r   r$  z Invalid package version string: )rematchgroupr  )package_version_strpatternr  s      r+   split_package_versionr  R  sR    4GHHW2EAAA??;<O;PQRRr   c                   N    \ rS rSrS\4S jrS\4S jrS\4S jr\	S 5       r
Srg	)
r  i\  backend_requirementc                     [        U5      u  U l        U l        U l        U R                  [        ;  a  [        SU R                   35      eg )NzGBackends should be defined in the BACKENDS_MAPPING. Offending backend: )r  package_nameversion_comparisonr   r  r  )r  r  s     r+   r1  Backend.__init__]  sO    CXYlCm@42DL$44YZ^ZkZkYlm  5r   r   c                     [         R                  U R                  5      " [        R                  " [
        R                  R                  U R                  5      5      [        R                  " U R                  5      5      $ r   )r  r  r  r   r   r   r   r  rj  s    r+   r  Backend.is_satisfiede  sU     ,,T-D-DEMM),,44T5F5FGH'--X\XdXdJe
 	
r   c                 d    SU R                    S[        U R                      SU R                   S3$ )Nz	Backend("z", z, "z"))r  r  r  r   rj  s    r+   __repr__Backend.__repr__j  s;    4,,-S1B4CZCZ1[0\\_`d`l`l_mmoppr   c                 T    SU R                    SU R                   U R                   S3$ )Nz{0} requires the z library version zC. That library was not found with this version in your environment.)r  r  r   rj  s    r+   r  Backend.error_messagem  s>     "$"3"3!44EdF]F]E^_c_k_k^l mL M	
r   )r  r   r  N)r  r  r  r  r{  r1  boolr  r  propertyr  r  r   r   r+   r  r  \  s<    C 
d 

q# q 
 
r   r  r   )r
  c                 *  ^^ [        U [        5      (       d  [        S5      e/ mU  Hb  mT[        ;   a  TR	                  T5        M   [        U4S jS 5       5      (       a  TR	                  [        T5      5        MV  [        ST 35      e   U4S jnU$ )z
This decorator enables two things:
- Attaching a `__backends` tuple to an object to see what are the necessary backends for it
  to execute correctly without instantiating it
- The '@requires' string is used to dynamically import objects
zBackends should be a tuple.c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r*  s     r+   r&  requires.<locals>.<genexpr>  s     =_c'>_r+  r,  r0  c                    > TU l         U $ r   )
__backends)funapplied_backendss    r+   inner_fnrequires.<locals>.inner_fn  s    )
r   )r  r  r  r  r  r4  r  )r
  r  r  r  s     @@r+   requiresr  u  s     h&&677&&##G,=_=== ''(89 #ijqir!stt  Or   c                     SU ;   $ )Nmodeling_tf_r   rd  s    r+   <lambda>r    s	    n!r   )r  c                     SU ;   $ )Nmodeling_flax_r   r  s    r+   r  r    s
    !#r   )r   c                     SU ;   $ )N	modeling_r   r  s    r+   r  r    s	    kQr   r   c                 T    U R                  S5      =(       a    U R                  S5      $ )Ntokenization__fastr  endswithr  s    r+   r  r    s    all?+C

70CCr   )r|   c                 T    U R                  S5      =(       a    U R                  S5      $ )Nimage_processing_r  r  r  s    r+   r  r    s    all./GAJJw4GGr   )r  r   r   c                 $    U R                  S5      $ )Nr  )r  r  s    r+   r  r    s    all./r   )r  c                    SU ;  a  / $ SnU R                  5       n[        U5       H  u  p4UR                  S5      (       d  M  UnM!     Uc  / $ X!S nUS   R                  S5      (       d  [        S5      eUS   R	                  S5      (       aT  US   R                  S5      S   R                  S5      R                  S	5       Vs/ s H  oUR                  S
5      PM     sn$ / n[        S[        U5      5       H?  nX'   R                  5       S:X  a  Us  $ UR                  X'   R                  S5      5        MA     U$ s  snf )z
Returns the content of the __all__ variable in the file content.
Returns None if not defined, otherwise returns a list of strings.
r8  Nr   z`fetch__all__ accepts a list of lines, with the first line being the __all__ variable declaration]r-  r   z [],z"' z"', )

splitlines	enumerater  r  r  r  stripr:  r?  r  )file_contentstart_indexlinesindexliner  _all__all__line_indexs           r+   fetch__all__r    s@    $	K##%E '??9%%K (
 	,E8y))n
 	

 Qx-21X^^C-@-C-I-I%-P-V-VWZ-[\-[c		&!-[\\ !&q#e*!5'--/36E4::7CD	 "6  ]s   D?c                 Z
   0 n[         R                  R                  U 5      (       a  [         R                  R                  U 5      n U n/ n[         R                  " U 5       H  nUS:w  am  [         R                  R                  [         R                  R                  X5      5      (       a,  [        [         R                  R                  X5      5      X'   Mv  [         R                  R                  [         R                  R                  X$5      5      (       a  M  UR                  U5        M     SU;   a  UR                  S5        S nU" SU5      (       a(  U" SU5      (       a  U Vs/ s H  nSU;  d  M  UPM     nn0 nU GH  nUR                  S5      (       d  M  [        [         R                  R                  X(5      SS9 nUR                  5       n	S	S	S	5        US	S
 nSn
SnSn[        R                  5        H  u  pU" U5      (       d  M  Un  O   [        5       nSW	;   Gat  U	R!                  S5      n[#        U5       GHS  u  nnUR%                  S5      (       a  UR%                  S5      (       d  M5  SnSU
;   Ga  SnSU
;   a  U
R!                  S5      S   R!                  S5      S   R!                  S5      S   n['        [)        UR!                  S5       Vs/ s H  nU(       d  M  UR+                  S5      PM     sn5      5      nOSUUS-      ;   a  / nUUU  H  nSU;   a  UR!                  S5      S   nSU;   d  SU;   aN  SU;   a(  UR-                  S UR!                  S5       5       5        O UR                  UR+                  S5      5        UR+                  5       S:X  d  M    O   ['        U5      nOSn[/        UU-   5      nUU;  a  0 UU'   XU   ;  a  [        5       UU   U'   UR%                  S5      (       d  UR%                  S5      (       d  S nOhUR%                  S5      (       a  S!OS"nUUS	 R!                  S5      S   R+                  S#5      nUU   U   R1                  U5        UR1                  U5        U(       a  GMO  Un
UnGMV     S$U	;   d  GM#  [3        U	5       HP  nUU;  d  M  [/        U5      nUU;  a  0 UU'   XU   ;  a  [        5       UU   U'   UU   U   R1                  U5        MR     GM     0 UEUEnU$ s  snf ! , (       d  f       GNG= fs  snf )%aL	  
This method takes the path to a file/a folder and returns the import structure.
If a file is given, it will return the import structure of the parent folder.

Import structures are designed to be digestible by `_LazyModule` objects. They are
created from the __all__ definitions in each files as well as the `@require` decorators
above methods and objects.

The import structure allows explicit display of the required backends for a given object.
These backends are specified in two ways:

1. Through their `@require`, if they are exported with that decorator. This `@require` decorator
   accepts a `backend` tuple kwarg mentioning which backends are required to run this object.

2. If an object is defined in a file with "default" backends, it will have, at a minimum, this
   backend specified. The default backends are defined according to the filename:

   - If a file is named like `modeling_*.py`, it will have a `torch` backend
   - If a file is named like `modeling_tf_*.py`, it will have a `tf` backend
   - If a file is named like `modeling_flax_*.py`, it will have a `flax` backend
   - If a file is named like `tokenization_*_fast.py`, it will have a `tokenizers` backend
   - If a file is named like `image_processing*_fast.py`, it will have a `torchvision` + `torch` backend

Backends serve the purpose of displaying a clear error message to the user in case the backends are not installed.
Should an object be imported without its required backends being in the environment, any attempt to use the
object will raise an error mentioning which backend(s) should be added to the environment in order to use
that object.

Here's an example of an input import structure at the src.transformers.models level:

{
    'albert': {
        frozenset(): {
            'configuration_albert': {'AlbertConfig', 'AlbertOnnxConfig'}
        },
        frozenset({'tokenizers'}): {
            'tokenization_albert_fast': {'AlbertTokenizerFast'}
        },
    },
    'align': {
        frozenset(): {
            'configuration_align': {'AlignConfig', 'AlignTextConfig', 'AlignVisionConfig'},
            'processing_align': {'AlignProcessor'}
        },
    },
    'altclip': {
        frozenset(): {
            'configuration_altclip': {'AltCLIPConfig', 'AltCLIPTextConfig', 'AltCLIPVisionConfig'},
            'processing_altclip': {'AltCLIPProcessor'},
        }
    }
}
__pycache____init__.pyc                 .   ^  [        U 4S jU 5       5      $ )Nc              3   .   >#    U  H
  nTU;   v   M     g 7fr   r   )r%  r-  	substrings     r+   r&  Lcreate_import_structure_from_path.<locals>.find_substring.<locals>.<genexpr>	  s     15a9>5s   )r4  )r  list_s   ` r+   find_substring9create_import_structure_from_path.<locals>.find_substring	  s    15111r   modular_r  z.pyzutf-8)encodingNr  r   r   z	@requires
) 	@)Fr
  z	backends=r   (r  z, z'",r-  "'c              3   B   #    U  H  oR                  S 5      v   M     g7f)()"', N)r  )r%  r  s     r+   r&  4create_import_structure_from_path.<locals>.<genexpr>_	  s     3u\tQXMM)4L4L\tr(  r  classdefTr  r%  :r8  )rx  rE  isfilerF  listdirisdirr  !create_import_structure_from_pathr  remover  openreadBASE_FILE_REQUIREMENTSr9  r  r  r  r  r  sortedr  rA  r$  addr  )module_pathr  	directoryadjacent_modulesfr  rK  module_requirementsrc  r  previous_lineprevious_indexbase_requirementsstring_checkrequirementsexported_objectsr  r  r  	skip_linebackends_stringbr
  backend_liner  object_name_all_objects                              r+   r  r    s   n 	ww~~k""ggook2IZZ$"''--[0L"M"M"CBGGLLQ\D`"arww||I9::##A& % ((.2 j"233{Td8e8e1A^1AvZW]E]F1A^'##E**"'',,y6IQ668L J "#2&
 *@*F*F*H&LK(($0! +I 5,& &&t,E(/t ??#899$//R]B^B^
 "	-/ %I "]2*7*=*=k*J1*M*S*STW*XYZ*[*a*abe*fgh*i#(/J_J_`dJe0kJeQijJe0k)l#m$ $u^a-?'@@#%,1.,GL)\9/;/A/A#/Fq/I"l2c\6I#'<#7$,OO3u\h\n\nos\t3u$u$,OOL4F4Fy4Q$R  ,113s: % -H $)? $&(4E)EFH'::8:+H5"h*GGEHU+H5kB??733DOOE<R<R$(	+/??7+C+Ca&*;<&8&>&>s&CA&F&L&LS&Q+H5kBFF{S(,,[9 y$(M%*NO  0V $+L9&66():;H'::8:+H5"h*GGEHU+H5kB'1+>BB;O  :Q (d C-B1ABm _ JIP 1ls$   (
T6TTT(.T(
T%	c                    ^^ U4S jmSU4S jjmU n[        S5       H  nT" U5      nM     0 nUR                  5       R                  5        H(  u  pE[        U[        5      (       a  X	 M  T" U5      X4'   M*     U$ )a  
This method takes as input an unordered import structure and brings the required backends at the top-level,
aggregating modules and objects under their required backends.

Here's an example of an input import structure at the src.transformers.models level:

{
    'albert': {
        frozenset(): {
            'configuration_albert': {'AlbertConfig', 'AlbertOnnxConfig'}
        },
        frozenset({'tokenizers'}): {
            'tokenization_albert_fast': {'AlbertTokenizerFast'}
        },
    },
    'align': {
        frozenset(): {
            'configuration_align': {'AlignConfig', 'AlignTextConfig', 'AlignVisionConfig'},
            'processing_align': {'AlignProcessor'}
        },
    },
    'altclip': {
        frozenset(): {
            'configuration_altclip': {'AltCLIPConfig', 'AltCLIPTextConfig', 'AltCLIPVisionConfig'},
            'processing_altclip': {'AltCLIPProcessor'},
        }
    }
}

Here's an example of an output import structure at the src.transformers.models level:

{
    frozenset({'tokenizers'}): {
        'albert.tokenization_albert_fast': {'AlbertTokenizerFast'}
    },
    frozenset(): {
        'albert.configuration_albert': {'AlbertConfig', 'AlbertOnnxConfig'},
        'align.processing_align': {'AlignProcessor'},
        'align.configuration_align': {'AlignConfig', 'AlignTextConfig', 'AlignVisionConfig'},
        'altclip.configuration_altclip': {'AltCLIPConfig', 'AltCLIPTextConfig', 'AltCLIPVisionConfig'},
        'altclip.processing_altclip': {'AltCLIPProcessor'}
    }
}

c                   > 0 nU R                  5        GHF  u  p#[        U[        5      (       d  X1U'   M!  [        S UR	                  5        5       5      (       a  UR                  5        H  u  pE[        U[
        5      (       a0  XA;  a  0 X'   X!U   ;  a  0 X   U'   X   U   R                  U5        MJ  T	" XE05      nUR                  5        Hx  u  px[        U[
        5      (       a0  Xq;  a  0 X'   X!U   ;  a  0 X   U'   X   U   R                  U5        MJ  X!;  a  0 X'   XqU   ;  a  0 X   U'   X   U   R                  U5        Mz     M     GM<  T	" U5      X'   GMI     U$ )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7fr   r#  )r%  vs     r+   r&  Gspread_import_structure.<locals>.propagate_frozenset.<locals>.<genexpr>	  s     E}!Z9--}r(  )r9  r  dictr4  r5  r$  update)
unordered_import_structure frozenset_first_import_structure_key_valuerM  r
  propagated_frozensetr_kr_vpropagate_frozensets
            r+   r  4spread_import_structure.<locals>.propagate_frozenset	  s{   +-(6<<>LDfd++9?6Ev{{}EEE"LLNDA!!Y//DBD<?'JJHJ<?E8;DAHHK 0CA6/J,(<(B(B(DHC)$	::#&#NLN$D$I#'PS/T#TRT$D$I$$O !A Ed K R RSV W#'#OMO$D$J#&t.T#TRT$D$J3$O !A Fs K R RSV W! )E% +J :MV9T06W ?Z 0/r   c                   > / nU R                  5        H_  u  p4Ub  U SU 3OUn[        U[        5      (       a'  UR                  T" XC5      R                  5       5        MM  UR	                  X445        Ma     [        U5      $ r  )r9  r  r  rA  r  )_dictprevious_keyr9  r  r  flatten_dicts        r+   r  -spread_import_structure.<locals>.flatten_dict	  sr    !KKMLD/;/Gl^1TF+TD&$''\&7==?@d^, * E{r   r  r   )r:  copyr9  r  r{  )nested_import_structureordered_import_structurerN  flattened_import_structurer  r  r  r  s         @@r+   spread_import_structurer   	  s    ^/0b  7 1X#67O#P   "$.335;;=
c3(-.:5.A&+	 > &%r   r  prefixc                     [        U 5      n[        U5      nUc  U$ UR                  5        VVVVs0 s H0  u  pEXER                  5        VVs0 s H  u  pgU SU 3U_M     snn_M2     nnnnnU$ s  snnf s  snnnnf )a  
This method takes a module_path as input and creates an import structure digestible by a _LazyModule.

Here's an example of an output import structure at the src.transformers.models level:

{
    frozenset({'tokenizers'}): {
        'albert.tokenization_albert_fast': {'AlbertTokenizerFast'}
    },
    frozenset(): {
        'albert.configuration_albert': {'AlbertConfig', 'AlbertOnnxConfig'},
        'align.processing_align': {'AlignProcessor'},
        'align.configuration_align': {'AlignConfig', 'AlignTextConfig', 'AlignVisionConfig'},
        'altclip.configuration_altclip': {'AltCLIPConfig', 'AltCLIPTextConfig', 'AltCLIPVisionConfig'},
        'altclip.processing_altclip': {'AltCLIPProcessor'}
    }
}

The import structure is a dict defined with frozensets as keys, and dicts of strings to sets of objects.

If `prefix` is not None, it will add that prefix to all keys in the returned dict.
r  )r  r   r9  )r  r!  r  spread_dictrM  r
  kkvvs           r+   define_import_structurer&  
  s    0 9E)*:;K~U`UfUfUhiUhTQqggiHiFBfXQrd+R/iHHUhi Iis   A5
A/ A5
/A5
c                     [         R                   V s/ s H  o R                  S5      (       d  M  U PM     nn U HC  n [         R                  U    n[        U[        5      (       a  0 Ul        [         R                  U 	 ME     S[         R                  ;   aF  [         R                  S   n[        U[        5      (       a  0 Ul        [        R                  " U5        ggs  sn f )z
Clear cached Transformers modules to allow reloading modified code.

This is useful when actively developing/modifying Transformers code.
r`  rt  N)rg  rh  r  r  r  rH  r   reload)mod_nametransformers_modulesrK  main_modules       r+   clear_import_cacher,  /
  s     69[[i[DWDWXgDhH[i )X&fk** FOKK! ) $kk.1k;//#%K %	 % js
   CC)Fr   )FF)T)r  )r  (  r  importlib.machineryr   importlib.metadataimportlib.utilr|  r  rx  r  r  r  rg  r  collectionsr   enumr   	functoolsr   	itertoolsr   typesr   typingr   r	   r
   r   r   r   r   r   	packagingr   r  r   
get_loggerr  r%   r{  r  r,   ENV_VARS_TRUE_VALUESr>  ENV_VARS_TRUE_AND_AUTO_VALUESry  rz  upperr2   r3   USE_JAXr5   r6   r   TORCH_FX_REQUIRED_VERSIONACCELERATE_MIN_VERSIONSCHEDULEFREE_MIN_VERSIONFSDP_MIN_VERSIONGGUF_MIN_VERSIONXLA_FSDPV2_MIN_VERSIONHQQ_MIN_VERSIONVPTQ_MIN_VERSIONTORCHAO_MIN_VERSIONAUTOROUND_MIN_VERSIONr   r   r  r   r  r  r  r   r   r  r  r  r<  r?  r   r   r   r   r   rE  rL  r   r   r  r  r  r   _faiss_versionr&   r    r^  ra  r   r  r  r  r  r   r^  rB  r   r  r  rR  rU  r#  r6  r9  r)  r*  r&  r0  r-  r3  ru  rB  r  r  r  r  r   r   rR  rU  ro  r  r  rG  r  r  r  r  r  r  r  r  rX  r  r  rr  r[  rO  r  rJ  r  r  r  r  r   r   r  r  r   r   r  r  r  r  r  r  r   r   r   r  info_tf_versionrH  
candidatespkgr   _essentia_versionr   _pretty_midi_versionccl_versionr  rX  _flax_version_jax_available_jax_versionrg  _torch_xla_versionr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r4  r8  r>  r@  rC  rF  rI  rM  rP  rS  rV  rY  r\  r_  rb  rl  rp  r   r   r  r  r'  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r  r  r!  r$  r'  r+  r.  r1  r4  r7  r:  r=  r@  rC  rE  rH  rK  rP  rS  rV  rY  r\  r_  rm  rp  rs  rv  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  AV_IMPORT_ERRORYT_DLP_IMPORT_ERRORDECORD_IMPORT_ERRORCV2_IMPORT_ERRORDATASETS_IMPORT_ERRORTOKENIZERS_IMPORT_ERRORSENTENCEPIECE_IMPORT_ERRORPROTOBUF_IMPORT_ERRORFAISS_IMPORT_ERRORPYTORCH_IMPORT_ERRORTORCHVISION_IMPORT_ERRORr  r  BS4_IMPORT_ERRORSKLEARN_IMPORT_ERRORTENSORFLOW_IMPORT_ERRORDETECTRON2_IMPORT_ERRORFLAX_IMPORT_ERRORFTFY_IMPORT_ERRORLEVENSHTEIN_IMPORT_ERRORG2P_EN_IMPORT_ERROR!PYTORCH_QUANTIZATION_IMPORT_ERROR#TENSORFLOW_PROBABILITY_IMPORT_ERRORTENSORFLOW_TEXT_IMPORT_ERRORTORCHAUDIO_IMPORT_ERRORPANDAS_IMPORT_ERRORPHONEMIZER_IMPORT_ERRORUROMAN_IMPORT_ERRORSACREMOSES_IMPORT_ERRORSCIPY_IMPORT_ERRORKERAS_NLP_IMPORT_ERRORSPEECH_IMPORT_ERRORTIMM_IMPORT_ERRORNATTEN_IMPORT_ERRORNUMEXPR_IMPORT_ERRORNLTK_IMPORT_ERRORVISION_IMPORT_ERRORPYTESSERACT_IMPORT_ERRORPYCTCDECODE_IMPORT_ERRORACCELERATE_IMPORT_ERRORCCL_IMPORT_ERRORESSENTIA_IMPORT_ERRORLIBROSA_IMPORT_ERRORPRETTY_MIDI_IMPORT_ERRORCYTHON_IMPORT_ERRORJIEBA_IMPORT_ERRORPEFT_IMPORT_ERRORJINJA_IMPORT_ERRORRICH_IMPORT_ERRORr  r  typer  r  
BACKENDS_Trm  r  BaseExceptionrr  r}  r  r  r  r  r  r  r  r   r&  r,  r   r   r+   <module>r     s        	 	   
  #     J J J   
		H	%)C ) )%PUVZ\_V_P`bfPfJg )X 2  4 : :F8 D 	&	)	/	/	1JJNN;/557	
**..V
,
2
2
4 

4::<ZZ^^$8&AGGI  $MM&1 ! "        -B<`d-e * *'//? '/!6vd!S ((.d:NN,,X6dB /? '/-l; /? '5,[9 1F~fj1k . .))%0<.}= ))%0<NN,,X6dB +J7 -l; >>++G4D@ %''//8N
LL77GHI (/)(3 +,EF !67Tei!j (1 (2 (1 ,[9 .}= *95 )(3 '/'/)(3 *95 ,[9 ,[9 -B<`d-e * *nn..u5TA (1 $ )/0#'  !* 8 89M NVZ Z )(3 '/-l; )(3 )(3 *95 .}= +J7 .}= )(3 "78N"O )(3 -l; .}= (1 0A +G4 $9&QU$V ! M^^--i8D #"">2 %>>33ODDP ,[9 (1 +@]a+b ( ($9:R$S !23DE *95 '/-l; -l; '<YW['\ $ $-l; /D]cg/h , ,&u-,[9 4U4P +J7 +J7 /? )(3 '5'/*95  --&@T2T'<WUY'Z$n"==8GMM'<RRNN\]k\lmn
KK9: --M..9DX3X "00>dJJ K!"+"4"4"<"<S"AK " (t3M}}[)GMM#,>>8Eop !&CD  nn..z:$F !**22:>
LL:;L:MNO
 #11-@L #$--55mD
LL=>R=STU
 NN[)5 K~~ =>dJ $$,,-=>K
LL3K=AB
 
++%:6RV%W"O]'<USW'X$KK,|nOM?R]^_/44On+00L=  ((/D[ae/f,,();(<KHI 0F f f )8 X# XC C"H##  2J j3 j""
 
T " T  )  >  .
 "  (   > >$  0 @ @, , ,^ J J  &"E!! *: Z3 Z
3 ( > >8  > >0 ] ] eC e e ds d d d" 	n 	n$ 	n 	n!$ *: ]3 ]C *: `3 ` 0E f f(
)  !"J"!  "<C(+-$$0. ! -@ `c `!
!
 Gf= 7_
    $
      
     
       % !' #     
                  
 
 
 
 
 /	12/	!#345/ 
!#345/ 
+-BCD	/
 
')<=>/ 
/1HIJ/ 
+-BCD/ 
%'9:;/ 
#%678/ 
#%678/ 
')<=>/ 
')<=>/ 
/1HIJ/ 
')<=>/ 
13KLM/  
13KLM!/" 
)+?@A#/$ 
+-BCD%/& 
13KLM'/( 
13KLM)/* 
/1HIJ+/, 
 "CEf!gh-/. 
57QRS//0 
)+?@A1/2 
')<=>3/4 
"$GIl#mn5/6 
!89:7/8 
9;WXY9/: 
#%678;/< 
/1HIJ=/> 
')<=>?/@ 
#%678A/B 
/1HIJC/D 
%';<=E/F 
13KLMG/H 
')<=>I/J 
%'9:;K/L 
/1HIJM/N 
,.>?@O/P 
')<=>Q/R 
%'9:;S/T 
#%678U/V 
%'9:;W/X 
')<=>Y/Z 
#%678[/\ 
-/EFG]/1 h+8.$ . s^
*d3C=&99: uU* uUp[] [S  &2 2. S%S#2F S S
 
2   : "7#Y
C_GIk/ 'T F FR{&|  hsm Oa  B&CM .. 	%%"++33K@;N;KLM22 %	%&//77DNLL??OPQQ!!66 	%$	%	%		%F .. )#( )4 22 #"#J !))>> " ..  .. #"# .. s   /z1 ;}9 ,~ ~?3/!  /A@ 3/A@' 1}6/{>>}2/}}6}.(}2)}6-}..}22}69~~~<;~<?!A@@ A@@A@$@#A@$@'AAAAA