
    wi]              	       ^   U d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
mZmZmZmZmZmZmZ d dlZd dlmZ d dlmZmZ dZee         ed<   ej                            dd          d	k    Zd
ZdZdZ dZ!dZ"dZ#d
Z$d
Z%d
Z&dZ'ej                            dd	          d	k    Z(dZ)dZ*dZ+dZ,dZ-d
Z.dZ/dZ0 e1            Z2eee
                  ed<    e3ej                            dd
                    Z4ej                            dd          d	k    Z5dZ6ej                            dd
          Z7ej                            dd
          Z8i Z9ee
e
f         ed<   h dZ:ej                            dd          Z; e<ej                            dd                    Z=ej                            d          d	k    Z>dZ?ej                            d          d	k    Z@dZAej                            d          d	k    ZBej                            dd          d	k    ZCd
ZDd
ZEd
ZFdZGee3ef         ed <   ej                            d!d          d	k    ZHe3ed"<   g d#ZId$ ZJdZKd
ZLdZMdZNdZOdZPdZQd
ZRdZSdZTd
ZU e            rd
ndZVd
ZWdZX e e e eeY                                        ZZdZ[d%Z\d&Z]d'Z^d
Z_dZ` e             Zad
Zbd
ZcdZdd
Zed( Zf ef            Zgh d)Zhd
Zid
Zjd
ZkdZldZmdZn e1            Zoeee
gdf                  ed*<    e1            Zpeed+e
f                  ed,<   d
Zqg d-Zrers                    d.  ejt        eju                  D                        ej                            d/d	          d	k    Zvej                            d0d          d	k    Zwd
Zxi Zyeee
f         ed1<   ej                            d2d          d	k    Zzej                            d3d          d	k    Z{e3ed4<    ed5          Z|ee3         ed6<   dZ}ee
         ed7<   erd d8l~T d9 Z eej        e                    dS ):    N)abspathdirname)AnyCallableDictOptionalSetTypeTYPE_CHECKINGUnion)	is_fbcode)get_tristate_envinstall_config_modulelog_file_nameTORCHDYNAMO_VERBOSE01F   T      #TORCH_COMPILE_USE_LAZY_GRAPH_MODULEdynamictraceable_tensor_subclassesTORCHDYNAMO_SUPPRESS_ERRORSTORCH_COMPILE_REPLAY_RECORDTORCH_COMPILE_DISABLETORCH_COMPILE_CPROFILE!skipfiles_inline_module_allowlist>   torch._refstorch._primstorch._decomptorch.testingtorch.distributionsTORCHDYNAMO_REPRO_AFTERTORCHDYNAMO_REPRO_LEVEL   TORCHDYNAMO_REPRO_FORWARD_ONLYgMbP?TORCHDYNAMO_REPRO_IGNORE_NON_FP"TORCHDYNAMO_CAPTURE_SCALAR_OUTPUTS,TORCHDYNAMO_CAPTURE_DYNAMIC_OUTPUT_SHAPE_OPSoptimize_ddp(TORCH_DYNAMO_DO_NOT_EMIT_RUNTIME_ASSERTSdo_not_emit_runtime_asserts)ddp_optimizerpython_reducer'python_reducer_without_compiled_forwardno_optimizationc                  :   t           j        t                   } t          | j        t
                    r| j        rd}nId}nFt          | j        t                    r| j        }n$t          dt          t                              || j	        v sJ d|            |S )Nr.   r1   z!Invalid type, type(optimize_ddp)=zInvalid mode mode=)
sysmodules__name__
isinstancer+   boolstr
ValueErrortype_ddp_optimization_mode)mmodes     d/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/torch/_dynamo/config.py_get_optimize_ddp_moder?   )  s    HA!.$'' A> 	%"DD$DD	ANC	(	( A~?$|*<*<??@@@1++++-DT-D-D+++K    float64
complex128int64c                     d} | t           j        v r0t           j                            t           j        |          d          S t	                      rCt           j                            t          j                    t          j                    d          S t           j                            t          j	                    d          S )NTORCH_COMPILE_DEBUG_DIRtorch_compile_debug)
osenvironpathjoinr   tempfile
gettempdirgetpassgetusergetcwd)DEBUG_DIR_VAR_NAMEs    r>   default_debug_dir_rootrQ     s    2RZ''w||BJ'9:<QRRR	 @w||!!7?#4#46K
 
 	
 w||BIKK)>???r@   >   repro_afterrepro_levelconstant_functionsr   reorderable_logging_functions.ignore_logger_methods)striderequires_gradstorage_offsetlayoutdatac                 B    g | ]\  }}t          j        d |          |S )z^is_.*)rematch).0name_s      r>   
<listcomp>rb     s.    WWWgdARXiQU=V=VWTWWWr@    TORCH_FAKE_TENSOR_DISPATCH_CACHE+TORCH_FAKE_TENSOR_DISPATCH_CACHE_CROSSCHECK!compiled_autograd_kwargs_overrideTORCH_COMPILER_COLLECTIVES(TORCH_DYNAMO_AUTOMATIC_DYNAMIC_LOCAL_PGOautomatic_dynamic_local_pgo)TORCH_DYNAMO_AUTOMATIC_DYNAMIC_REMOTE_PGOautomatic_dynamic_remote_pgo_custom_ops_profile)*c                      d S )N )changess    r>   _make_closure_patcherrp   #  s    r@   )rM   inspectrG   r]   r3   rK   os.pathr   r   typingr   r   r   r   r	   r
   r   r   torchtorch._environmentr   torch.utils._config_moduler   r   r   r8   __annotations__rH   getverboseverify_correctnessminimum_call_countdead_code_eliminationcache_size_limitaccumulated_cache_size_limit&skip_code_recursive_on_cache_limit_hitfail_on_cache_limit_hitspecialize_intspecialize_floatdynamic_shapesuse_lazy_graph_moduleassume_static_by_defaultautomatic_dynamic_shapes automatic_dynamic_shapes_mark_asforce_parameter_static_shapes&force_nn_module_property_static_shapesallow_ignore_mark_dynamicguard_nn_modules guard_nn_modules_using_dict_tagssetr   r7   suppress_errorsreplay_record_enabled rewrite_assert_with_torch_assertdisablecprofiler   *allowed_functions_module_string_ignorelistrR   intrS   repro_forward_onlyrepro_tolerancerepro_ignore_non_fpsame_two_models_use_fp64capture_scalar_outputs capture_dynamic_output_shape_ops+prefer_deferred_runtime_asserts_over_guards'allow_complex_guards_as_runtime_asserts3force_unspec_int_unbacked_size_like_on_torchrec_kjtr+   r-   r;   r?   skip_torchrecoptimize_ddp_lazy_compileskip_fsdp_guardsskip_fsdp_hooksskip_nnmodule_hook_guards,skip_no_tensor_aliasing_guards_on_parametersraise_on_ctx_manager_usageraise_on_unsafe_aot_autograderror_on_nested_jit_traceerror_on_nested_fx_trace	allow_rnncapture_sparse_computeerror_on_recompilereport_guard_failures__file__base_dirtrace_numpynumpy_default_floatnumpy_default_complexnumpy_default_intuse_numpy_random_streamenable_cpp_guard_managerinline_inbuilt_nn_modulesuse_graph_deduplicationtrack_nodes_for_deduplicationissue_3_13_0_warning%record_compile_time_instruction_countrQ   debug_dir_root_save_config_ignore%cudagraph_backend_keep_input_mutation(cudagraph_backend_support_input_mutationonly_allow_pt2_compliant_opscapture_autograd_functioncapture_func_transformslog_compilation_metricsrU   rV   +inject_BUILD_SET_unimplemented_TESTING_ONLY)_autograd_backward_strict_mode_banned_opsextend
getmembersTensorfake_tensor_cache_enabled$fake_tensor_cache_crosscheck_enabledcompiled_autogradre   enable_compiler_collectivesrh   rj   rk   torch.utils._config_typingrp   r4   r5   rn   r@   r>   <module>r      s     				 				 



  $ $ $ $ $ $ $ $ Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q  ( ( ( ( ( ( N N N N N N N N  $x} # # # *...
4
4
;          #  *. &    
    JNN8#>>#E        $-   !% 
 *. & "    $(  & /2cee Sc^ 3 3 3 $rz~~&CUKKLL
 
'DcJJcQ  $(   *..0%
8
8 :>>2E:: 57 !4S> 6 6 6. . . * jnn6== c"*..!:A>>?? Z^^$DEEL 
  jnn%FGG3N    
 (LMMQTT  JNNA3GG3N !
 /4 + +0 ' 7< 3* "&eD#I % % % JNN=sCCsJ T        "  "    
 !  04 , "   %  !     	 #,)++74 
     77777778#4#4556677    $         !*	O     !& 
   ). %
@ 
@ 
@ ('))    ). % ,1 (  %  !      =@CEE s8SE4K#89 A A A 25 s8CH-. 6 6 6 /4 +- - - ) * 0 0WW++EL99WWW   JNN5s;;sB  JNN@#FF#M %   57 !4S> 6 6 6 !jnn-I3OOSVV 0 JNN=sCCsJ T   
 0@/?/0 0 htn   
 &* Xc] ) ) ) ,,,,    ck(+ , , , , ,r@   