
    9iD                     f    S SK Jr  S SKJr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 rS rS rg	)
    )PaddlePredictorOption)get_default_deviceparse_device   )DEFAULT_CPU_THREADSDEFAULT_DEVICEDEFAULT_ENABLE_MKLDNNDEFAULT_MKLDNN_CACHE_CAPACITYDEFAULT_PRECISIONDEFAULT_USE_TENSORRTSUPPORTED_PRECISION_LISTDEFAULT_USE_CINN)str2boolc          	      h   [         U[        [        [        [        [
        [        S.nU R                  5       UR                  5       -
  nU H  n[        SU 35      e   0 UEU En U S   [        ;  a  [        SU S    S[         S35      eU R                  S5      U S'   U R                  S5      U S	'   U $ )
N)device
enable_hpiuse_tensorrt	precisionenable_mkldnnmkldnn_cache_capacitycpu_threadsenable_cinnzUnknown argument: r   zInvalid precision: z. Supported values are: .r   	use_pptrtpptrt_precision)r   r   r   r	   r
   r   r   keys
ValueErrorr   pop)kwargsdefault_enable_hpidefault_valsunknown_namesnames        V/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddleocr/_common_args.pyparse_common_argsr%      s     (,&.!>*'	L KKML$5$5$77M-dV455  (''Fk"::!&"5!66NOgNhhij
 	
 !**^4F; &

; 7FM    c                    US   nUc
  [        5       n[        U5      u  p40 nX%S'   US   US'   [        5       nUS:X  a>  US   (       a,  US   S:X  a  SUl        OYUS   S	:X  d
   US   5       eS
Ul        O>SUl        O6US:X  a)  US   nU(       a  US   Ul        OSUl        US   Ul        OSUl        US   Ul        XeS'   U$ )Nr   r   use_hpipgpur   r   fp32trt_fp32fp16trt_fp16paddlecpur   r   r   r   	pp_option)r   r   r   run_moder   r   r   )
model_namecommon_argsr   device_type_init_kwargsr0   r   s           r$   prepare_common_init_argsr7   <   s   "F~#%!&)NKK"),7K
%'Ie{#,-7%/	""#45? %B ? &0	"!)I		#O4.9:Q.RI+!)I +M :	%	'6I(r&   c                   U(       a  SnOSnU R                  S[        [        US9  U R                  S[        USS9  U R                  S[        [        SS9  U R                  S	[        [
        [        S
S9  U R                  S[        [        SS9  U R                  S[        [        SS9  U R                  S[        [        SS9  U R                  S[        [        SS9  g )Na  Device(s) to use for inference, e.g., `cpu`, `gpu`, `npu`, `gpu:0`, `gpu:0,1`. If multiple devices are specified, inference will be performed in parallel. Note that parallel inference is not always supported. By default, GPU 0 will be used if available; otherwise, the CPU will be used.zDevice to use for inference, e.g., `cpu`, `gpu`, `npu`, `gpu:0`. By default, GPU 0 will be used if available; otherwise, the CPU will be used.z--device)typedefaulthelpz--enable_hpiz&Enable the high performance inference.z--use_tensorrtzWhether to use the Paddle Inference TensorRT subgraph engine. If the model does not support TensorRT acceleration, even if this flag is set, acceleration will not be used.z--precisionzPPrecision for TensorRT when using the Paddle Inference TensorRT subgraph engine.)r9   r:   choicesr;   z--enable_mkldnnzEnable MKL-DNN acceleration for inference. If MKL-DNN is unavailable or the model does not support it, acceleration will not be used even if this flag is set.z--mkldnn_cache_capacityzMKL-DNN cache capacity.z--cpu_threadsz/Number of threads to use for inference on CPUs.z--enable_cinnz!Whether to use the CINN compiler.)add_argumentstrr   r   r   r   r   r	   intr
   r   r   )parserr    allow_multiple_deviceshelp_s       r$   add_common_cli_optsrC   a   s$    q a
	   "5	   $ {	   !(_   % n	   !-&	   #>	    0	  r&   N)paddlex.inferencer   paddlex.utils.devicer   r   
_constantsr   r   r	   r
   r   r   r   r   
_utils.clir   r%   r7   rC    r&   r$   <module>rI      s1    4 A	 	 	 !:"J5r&   