
    h(                     b   S SK r S SKJr  S SKJr  S SKJrJrJr  S SK	r	S SK
Jr  S SKJr  S SKJr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  \" \ 5      RB                  S-  r"\"S-  r#\	RH                  " \"S-  5      r% " S S\&\5      r' " S S5      r(\RR                  " S5      \" SSSS9\" \(RT                  SSSS9\" SRW                  \(RX                  5      S S!S"S9\" \(RZ                  S#S$S%S9\" \(R\                  S&S'S(S9\" \(R^                  S)S*S+S9\" \(R`                  S,S-S.S94S/\S0\&S1\&S2\'S3\1S4\1S5\14S6 jj5       r2\RR                  " S75      \" SS8SS9S:9\" S;S<SS9\" S9S)S*S+S9\" S9S=S>S?S9\" SS@SASBSCS94SD\S/\S4\1SE\1SF\\   4
SG jj5       r3S9S9S9SH.S/\SD\S4\1SE\1SI\1SJ\\\4   4SK jjr4\(RT                  \(RX                  \(RZ                  \(R\                  \(R^                  SSL.S0\&S1\\&   S2\&S3\1S4\1SI\1SJ\4SM jjr5 SSS\S/\SN\1SI\1SJS4
SO jjr6SJ\14SP jr7S\SQ\SJS4SR jr8g)T    N)Enum)Path)ListOptionalTuple)Template)Config)Printerdiff_strings   )util)DEFAULT_CONFIG_PRETRAIN_PATH)RecommendationSchema)SimpleFrozenList   )COMMANDArgOptimport_codeinit_clishow_validation_errorstring_to_list	templateszquickstart_training.jinjaz'quickstart_training_recommendations.ymlc                       \ rS rSrSrSrSrg)Optimizations   
efficiencyaccuracy N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r       O/home/james-whalen/.local/lib/python3.13/site-packages/spacy/cli/init_config.pyr   r      s    JHr%   r   c                   T    \ rS rSrSrSr\" / SQ5      r\R                  r
SrSrSrSrg)
InitValues#   z
Default values for initialization. Dedicated class to allow synchronized default values for init_config_cli() and
init_config(), i.e. initialization calls via CLI respectively Python.
en)taggerparsernerFr   N)r    r!   r"   r#   __doc__langr   pipeliner   r   optimizegpupretrainingforce_overwriter$   r   r%   r&   r(   r(   #   s3    
 D ;<H''H
CKOr%   r(   config.zcFile to save the config to or - for stdout (will only output config and no additional logging info)T)help
allow_dashz--langz-lz&Two-letter code of the language to use)r6   ,z
--pipelinez-pzfComma-separated names of trainable pipeline components to include (without 'tok2vec' or 'transformer')z
--optimizez-ozWhether to optimize for efficiency (faster inference, smaller model, lower memory consumption) or higher accuracy (potentially larger and slower model). This will impact the choice of architecture, pretrained weights and related hyperparameters.z--gpuz-Gz~Whether the model can run on GPU. This will impact the choice of architecture, pretrained weights and related hyperparameters.z--pretrainingz-ptz6Include config for pretraining (with 'spacy pretrain')z--forcez-Fz!Force overwriting the output fileoutput_filer/   r0   r1   r2   r3   r4   c           	          [        U5      n[        U 5      S:H  nU(       d6  U R                  5       (       a!  U(       d  [        5       nUR	                  SSS9  [        UUUR                  UUUS9n	[        XUS9  g)a=  
Generate a starter config file for training. Based on your requirements
specified via the CLI arguments, this command generates a config with the
optimal settings for your use case. This includes the choice of architecture,
pretrained weights and related hyperparameters.

DOCS: https://spacy.io/api/cli#init-config
-zjThe provided output file already exists. To force overwriting the config file, set the --force or -F flag.r   )exitsr/   r0   r1   r2   r3   silent)	is_stdoutN)r   strexistsr
   failinit_configvaluesave_config)
r9   r/   r0   r1   r2   r3   r4   r?   msgr5   s
             r&   init_config_clirG   1   s|    ( h'HK C'I++--oix 	 	
 F y9r%   zfill-configzPath to base config to fillF)r6   rA   dir_okayr;   z*Path to output .cfg file (or - for stdout)z--diffz-Dz,Print a visual diff highlighting the changesz--code-pathz--codez-czNPath to Python file with additional code (registered functions) to be imported	base_pathdiff	code_pathc                 .    [        U5        [        XX#S9  g)a  
Fill partial config file with default values. Will add all missing settings
from the default config and will create all objects, check the registered
functions for their default values and update the base config. This command
can be used with a config generated via the training quickstart widget:
https://spacy.io/usage/training#quickstart

DOCS: https://spacy.io/api/cli#init-fill-config
)r3   rJ   N)r   fill_config)rI   r9   r3   rJ   rK   s        r&   init_fill_config_clirN   X   s    & 	KKr%   )r3   rJ   r>   r>   returnc                   [        U 5      S:H  nU=(       d    Un[        US9n[        SS9   [        R                  " U5      n[        R
                  " USSS9n	S S S 5        [        R
                  " W	R                  5      n	U	R                  n
[        R                  " W5      nU
S   R                  U5        U(       a6  [        X5        [        R                  " [        5      nUR                  U
5      n
UR                  5       nU
R                  5       nX:X  a  UR                  S5        OUR                  S	5        U(       aj  U(       dc  X:X  a  UR                  S
5        OLUR                  S5        [!        S5        [!        [#        X5      5        UR                  S5        [!        S5        [%        XXTS9  X4$ ! , (       d  f       GNh= f)Nr;   no_printF	hint_fillT)	auto_fillvalidate
componentsz5Nothing to auto-fill: base config is already complete"Auto-filled config with all valuesz(No diff to show: nothing was auto-filledzSTART CONFIG DIFF zEND CONFIG DIFF)r?   r>   )r@   r
   r   r   load_configload_model_from_configr5   get_sourced_componentsupdatevalidate_config_for_pretrainr   mergeto_strwarngooddividerprintr   rE   )r9   rI   r3   rJ   r>   r?   rR   rF   r5   nlpfilledsourcedpretrain_configbeforeafters                  r&   rM   rM   o   sd    K C'I"FH
8
$C		/!!),))&D5Q 
0
 
%
%cjj
1CZZF ))&1G
<($V1**+GH &&v.]]_FMMOEHI56H?HH?@KK+,"I,v-.KK)*"IyH>? 
0	/s   -F::
G	r=   c                    [        US9n[        R                  S5       n[        UR	                  5       5      nS S S 5        U V	s/ s H  oS;  d  M
  U	PM     nn	[
        S   n
[        S0 [
        R                  X
5      D6R                  5       nU UUU(       a  SOSUS   US   US	   S
.nUS   (       a%  [        5       (       d  UR                  S5        S US'   WR                  U5      R                  5       n[        R                  " SSU5      nUR                  U5      nU SR!                  U5      UUS   R#                  5       UR$                  (       a  UR&                  R                  S5      OS S.nUR)                  S5        UR+                  5        H  u  nnUR-                  SU SU 35        M     [/        SS9   [0        R2                  " U5      n[0        R4                  " USS9nUR6                  nU(       a7  [9        UU5        [0        R:                  " [<        5      nUR?                  U5      nS S S 5        URA                  S5        W$ ! , (       d  f       GN = fs  sn	f ! , (       d  f       N8= f)NrQ   r)tok2vectransformer__default__r2   cpurn   word_vectorshas_letters)r/   rW   r1   hardwaretransformer_datarq   rr   rt   zTo generate a more effective transformer-based config (GPU-only), install the spacy-transformers package and re-run this command. The config generated now does not use transformers.z\n\n\n+z

z, rs   name)LanguagePipelinezOptimize forHardwareTransformerz4Generated config template specific for your use casez- z: FrS   T)rU   rX   r   )!r
   TEMPLATE_PATHopenr   readRECOMMENDATIONSr   getdicthas_spacy_transformersra   renderstripresubmake_modulejoinupperuse_transformerrn   infoitemstextr   r   load_config_from_strr[   r5   r^   rZ   r   r_   rb   )r/   r0   r1   r2   r3   r>   rF   ftemplatepipedefaultsreco	variablesbase_templatetemplate_varsuse_caselabelrD   r5   re   rh   s                        r&   rC   rC      s1    6
"C			C	 AAFFH% 
! "*T9S-SHT}-HF/"5"5d"EFKKMD Ee /^,M*I #$-C-E-EB	

 )-	$%OOI.446MFF:v}=M((3MIIh' j)//1(( %0044V<H HHCD (u2eWBug&' )		/**=9))&DA(5"../KLO$**62F 
0 HH12Ma 
!	  UH 
0	/s$   I	I$I$A6I)
I!)
I7r?   c           	         U=(       d    Un[        US9nU(       a  [        U R                  5       5        g UR                  R	                  5       (       d  UR                  R                  SS9  U R                  USS9  UR                  SU5        UR                  S5        SS	/nU(       d4  [        [         S
UR                  S    SSR                  U5       35        g g )NrQ   T)parentsF)interpolatezSaved configz2You can now add your data and train your pipeline:z--paths.train ./train.spacyz--paths.dev ./dev.spacyz train  )r
   rd   r`   parentrA   mkdirto_diskrb   r   r   partsr   )r5   r9   r?   r>   rR   rF   r   s          r&   rE   rE      s     "FH
8
$Cfmmo!!((**$$T$2{6-EF24MN	WIW[%6%6r%:$;1SXXi=P<QRS r%   c                  .     SS K n g! [         a     gf = f)Nr   TF)spacy_transformersImportError)r   s    r&   r   r      s    ! s    
rF   c                 @    SU S   S   ;  a  UR                  S5        g g )Nrm   re   r0   aM  No tok2vec component found in the pipeline. If your tok2vec component has a different name, you may need to adjust the tok2vec_model reference in the [pretraining] block. If you don't have a tok2vec component, make sure to add it to your [components] and the pipeline specified in the [nlp] block, so you can pretrain weights for it.)ra   )r5   rF   s     r&   r^   r^      s)    uj11	
 2r%   )FF)9r   enumr   pathlibr   typingr   r   r   srslyjinja2r   	thinc.apir	   wasabir
   r   rY   r   languager   schemasr   r   _utilr   r   r   r   r   r   r   __file__r   ROOTrz   	read_yamlr}   r@   r   r(   commandr/   r   r0   r1   r2   r3   r4   boolrG   rN   rM   rC   rE   r   r^   r   r%   r&   <module>r      s   	   ( (    (  3 * #   H~{*22//$)R"RSC 
  
( C  'L  Y]  ^JOOXt:bc!4!45|T  Qy  z!*"5"5|T  QH  IJNNGT  9y  zJ22OU  RJ  K
 : :ItRuv#:#: #: 	#:
 #: 
#: #: #: #:L 
-  #$A$Y^_C&R_cdE?E@xyUHd1_` #D-4  O_  !`LL L 	L
 L ~L !L4 *** 	*
 * * 66>*^ $--''"..:
: 3i: 	:
 
: : : :| PUTT!%T26THLT	T$ 	
 	
g 	
$ 	
r%   