
    hN                        S SK r S SKrS SKJr  S SKJr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  SSKJr  S	S
KJrJrJrJrJrJrJr  \R6                  " SSSS.S9\" SSSSS9\" SSSSSS9\" SSSSS9\" SSSSSS9\" SS S!S"S94S#\	R8                  S$\S%\\   S&\\   S'\S(\4S) jj5       r S-S\R@                  " 5       S*.S$\\!\4   S%\\\!\4      S(\S+\\!\4   4S, jjjrg).    N)Path)AnyDictOptionalUnion)msg   )util)init_nlp)train   )ArgOptappimport_codeparse_config_overrides	setup_gpushow_validation_errorr   T)allow_extra_argsignore_unknown_options)context_settings.zPath to config file)helpexists
allow_dashz--outputz--output-pathz-oz-Output directory to store trained pipeline in)r   z--codez-czNPath to Python file with additional code (registered functions) to be importedFz	--verbosez-Vz-VVz/Display more information for debugging purposesz--gpu-idz-gzGPU ID or -1 for CPUctxconfig_pathoutput_path	code_pathverboseuse_gpuc                     U(       a-  [         R                  R                  [        R                  5        [        U R                  5      n[        U5        [        XXVS9  g)a  
Train or update a spaCy pipeline. Requires data in spaCy's binary format. To
convert data from other formats, use the `spacy convert` command. The
config file includes all settings and hyperparameters used during training.
To override settings in the config, e.g. settings that point to local
paths or that you want to experiment with, you can override them as
command line options. For instance, --training.batch_size 128 overrides
the value of "batch_size" in the block "[training]". The --code argument
lets you pass in a Python file that's imported before training. It can be
used to register custom functions and architectures that can then be
referenced in the config.

DOCS: https://spacy.io/api/cli#train
r!   	overridesN)	r
   loggersetLevelloggingDEBUGr   argsr   r   )r   r   r   r   r    r!   r$   s          I/home/james-whalen/.local/lib/python3.13/site-packages/spacy/cli/train.py	train_clir+      s=    6 W]]+&sxx0I		+GI    r#   r$   c                   [         R                  " U 5      n [         R                  " U5      nU (       a$  [        U 5      S:w  a+  U R                  5       (       d  [        R
                  " SU SS9  U(       d  [        R                  " S5        OVUR                  5       (       d(  UR                  SS9  [        R                  " SU 35        [        R                  " S	U 35        [        U5        [        U 5         [         R                  " XS
S9nS S S 5        [        R                  " S5        [        U S
S9   [        WUS9nS S S 5        [        R                  " S5        [        R                  " S5        [        WX[        R                   [        R"                  S9  g ! , (       d  f       N= f! , (       d  f       Nt= f)N-zConfig file not foundr   )exitszNo output directory providedT)parentszCreated output directory: zSaving to output directory: F)r$   interpolatezInitializing pipeline)	hint_fill)r!   zInitialized pipelinezTraining pipeline)r!   stdoutstderr)r
   ensure_pathstrr   r   failinfomkdirgoodr   r   load_configdividerr   	train_nlpsysr3   r4   )r   r   r!   r$   confignlps         r*   r   r   9   s<    "";/K"";/K3{+s2;;M;M;O;O(+Q?/0!!##d+HH1+?@/}=>g	{	+!!+PUV 
,KK'(	{e	<vw/ 
=HH#$KK#$c;

3::V 
,	+ 
=	<s   8F6F/
F,/
F=)N)"r'   r>   pathlibr   typingr   r   r   r   typerwasabir    r
   training.initializer   training.loopr   r=   _utilr   r   r   r   r   r   r   commandContextboolintr+   SimpleFrozenDictr6    r,   r*   <module>rO      sr    
  - -    * .   4SWX C&;DUYZ"%dJ  UD  #E #D(D  @P  !Q{D%>opr:t2HIJ	J J $	J
 ~J J JJB /3W  $ 5 5 7WsDy!W%T	*+W 	W
 CH~Wr,   