o
    "i                     @   s  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Z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Zd dlZd dlZd dlZd dlmZ d dlmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ zd dlZ W n e!y~   dZ Y nw d dl"Z"d dl#Z"d dl$m%Z%m&Z&m'Z'm(Z( d dl#m)Z) d d	lm*Z*m+Z+ d d
l,m-Z-m.Z. d dl/m0Z1 d dl2m3Z3 d dl4m5Z5 d dlm6Z6 ddl7m8Z8m9Z9m:Z: ddl;m<Z< ddl=m>Z>m?Z? ddl@mAZAmBZBmCZCmDZDmEZE ddlFmGZGmHZHmIZImJZJ ddlKmLZLmMZMmNZN ddl9mOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZV ddlWmXZXmYZYmZZZ ddl[m\Z\ ddl]m^Z^ ddl_m`Z`maZa ddl:mbZb ddlmcZc ddldmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZu evewZxe"jyzewdZ{e"jyzewdZ|e"j}j~jWjZe ZG d d! d!Ze Ze Zdaee ed"< ee1d#d$ Zd%d& ZeNjd'd( ZdYd*d+Zd ae  Zeje ed,< d-d. Zd/d0 ZG d1d2 d2Z	3	)	dZd4e<d5ed6efd7d8Zd d9l mZ d d:lmZ ejrdd;lmZ e Zeeecf ed<< d=ecd>efd?d@Ze*dAdBee8j			d[d dCdDejdEeeef dFeeef dGeeef d4e<d5ed6edHe\dIeGdJeej dKed>eeZ fdLdAZG dMdN dNZd4e<dHe\fdOdPZdQdR ZdSdT ZG dUdV dVZdHe\fdWdXZdS )\    N)Path)AnyCallableDictListOptionalSet)#maybe_upload_prof_stats_to_manifold)_use_lazy_graph_module)CapturedTraceback)compile_contextCompileContext	CompileIdtracing)
structured)compile_time_strobelight_metasignpost_event)ConstraintViolationErrorGuardOnDataDependentSymNode)_forward_from_src)DistributedDataParallel)_disable_current_modes)format_traceback_short   )configexctrace_rules)
CompilerFn)remove_dead_coderemove_pointless_jumps) check_inst_exn_tab_entries_validInstructionis_generator propagate_inst_exn_table_entriestransform_code_object)CacheSizeRelevantForFramecompute_cache_sizeexceeds_cache_size_limitis_recompilation)always_optimize_code_objects	skip_codeTorchPatcher)augment_exc_messageBackendCompilerFailedformat_error_msgInternalTorchDynamoErrorTorchRuntimeErrorUncapturedHigherOrderOpErrorunimplementedUnsupported)CheckFunctionManager&get_and_maybe_log_recompilation_reasonGuardedCode)Hooks)ExecutionRecord)InstructionTranslatorSpeculationLog)is_numpy)BytecodeHook)CleanupManagerCompilationMetricscountersdynamo_timedformat_bytecodeframe_phase_timinggen_record_file_nameincrement_frameis_namedtupleistype
LazyStringorig_code_maprecord_compilation_metricsreset_graph_break_dup_checkersetup_compile_debugtroubleshooting_urlwrite_record_to_filebytecodegraph_breaksc                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
Trackerc                 C   s   g | _ t | _d S N)seensetseen_idsself rW   Y/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py__init__r   s   zTracker.__init__c                    sH   t |  jvr"t| fdd}j| j  d S d S )Nc                    s   j  S rQ   )rT   remove)_idxrV   rW   rX   <lambda>y       zTracker.add.<locals>.<lambda>)idrT   weakrefrefrR   appendadd)rV   
strong_objobjrW   r\   rX   rd   v   s   
zTracker.addc                 C   s   t || jv S rQ   )r`   rT   )rV   itemrW   rW   rX   __contains__}   s   zTracker.__contains__c                 C   s   | j   | j  d S rQ   )rR   clearrT   rU   rW   rW   rX   ri      s   
zTracker.clearN)__name__
__module____qualname__rY   rd   rh   ri   rW   rW   rW   rX   rP   q   s
    rP   initial_global_statec                  O   s   t | i |}t|j |S rQ   )original_forward_from_srcr*   __code__)argskwargsresultrW   rW   rX   fx_forward_from_src_skip_result   s   
rs   c                    s    t   fdd} |_|S )z
    Context manager to:
        1) Save/restore torch.is_grad_enabled() state
        2) Save/restore python random state
        3) Save/restore torch random state
        4) Monkey patch torch.fx.graph_module._forward_from_src
    c                     s  t  }t }tj  t }t }t }t	 }tj
 }tj r,tj
 }	tj }
tjjj}ttjj_t }zV | i |W |  tj| tjj| tj||d t| tj| tj rttj|	 tj|
 |tjj_| sJ d|  dW  d    S |  tj| tjj| tj||d t| tj| tj rtj|	 tj|
 |tjj_| sJ d|  dw 1 sw   Y  d S )N)	warn_onlyzGlobal z7state changed while dynamo tracing, please report a bug)GlobalStateGuardtorchis_grad_enabled_C_PreserveDispatchKeyGuardis_inference_mode_enabled$are_deterministic_algorithms_enabled-is_deterministic_algorithms_warn_only_enabledrandomgetstateget_rng_statecudais_available_get_cublas_allow_tf32fxgraph_moduler   rs   rK   close_set_grad_enabledautograd	grad_mode_enter_inference_modeuse_deterministic_algorithmssetstateset_rng_state_set_cublas_allow_tf32checkreason)rp   rq   guardsprior_grad_modeprior_inference_modeprior_deterministicprior_warn_onlypy_rng_statetorch_rng_statecuda_rng_state
allow_tf32prior_fwd_from_srccleanupfnrW   rX   _fn   sd   











z"preserve_global_state.<locals>._fn)	functoolswraps_torchdynamo_orig_callable)r   r   rW   r   rX   preserve_global_state   s   	&r   c                    s   | j tv rdS | j jD ]/}|| jv r:| j| }t|tjr*|jds'|t	u r* dS t
r:tjr:|t
u s7t|r: dS qt  fdd | j D ]	} |rS dS qJtd| j j| j j| j j dS )z+Check if the frame has torch.* related bitsTztorch.c                    sZ  t  }|v r| S d|< t tjtjjfs&t tr.t tjjr.d|< | S t	j
rGtrGt tjs?t tjrGd|< | S t ttfr_tfdd D |< | S t tr{t  }tfdd|D |< | S t ttttdtfrd|< | S t rt drt fdd jD |< | S dS )	z)Recursively check if the obj has a tensorFTc                 3       | ]} |V  qd S rQ   rW   .0v
has_tensorrW   rX   	<genexpr>       z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>c                 3   r   rQ   rW   r   r   rW   rX   r      r   N_fieldsc                 3   s    | ]
} t |V  qd S rQ   )getattrr   )r   rf   rW   rX   r      s    )r`   
isinstancerv   TensornnModulerF   type
issubclassr   trace_numpynpndarraygenericlisttupleanydictvaluesstrintfloatboolrE   hasattrr   )rf   obj_idr   r   rT   )rf   rX   r      sF   


z'has_tensor_in_frame.<locals>.has_tensorz0skipping because no torch.* %s             %s %sF)f_coder)   co_names	f_globalsr   types
ModuleTyperj   
startswithrv   r   r   r   r;   r   f_localsr   logdebugco_nameco_filenameco_firstlineno)framer   rf   valuerW   r   rX   has_tensor_in_frame   s4   



+r   Fc                 C   s:   d }t | drt| |}t|| j || _t| |d d S )Nexec_recordexport)r   rC   rM   r   record_filenamer,   )ecoder   r   r   rW   rW   rX   exception_handler  s   

r   FRAME_COMPILE_COUNTERc                 C   s   t jrt| S | S rQ   )r   cprofilecprofile_wrapperfuncrW   rW   rX   maybe_cprofile%  s   r   c                    s   t   fdd}|S )Nc               	      s  t  }|s
J dtdj dt|dd d}t }|  t		 }|j
g| R i |}t		 | }|  tdj|| t|}z|| W n tyd   tdt| Y nw |d}	z)tjd	d
ddddt|gtjd}
tjdddt|	g|
jd tdt|	 W n" ty   td |tjjd |tjjd Y nw tt|  rtj !d fdd |S )NzTrace id is Nonez/tmp/r[   /z.profilez7### Cprofile for %s trace id [%s] took %.3f seconds ###zCannot write to %sz.svg	gprof2dotz-fpstatsz"--node-label=total-time-percentagez!--node-label=self-time-percentagez--node-label=total-time)stdoutdotz-Tsvgz-o)stdinz Generated SVG from profile at %szxFailed to generate SVG from profile -- dumping stats instead.Try installing gprof2dot and dot for a better visualization   linkc                      s
   d dS )Ncprofile_manifold_url)nameurlrW   rW   manifold_linkrW   rX   r^   d  s   
 z;cprofile_wrapper.<locals>.profile_wrapper.<locals>.<lambda>)"r   current_trace_idr   rj   r   replacecProfileProfileenabletimeruncalldisabler   warningr   Stats
dump_statsPermissionErrorwith_suffix
subprocessPopenPIPE
check_callr   FileNotFoundError
sort_statsSortKeyTIMEprint_stats
CUMULATIVEr	   rv   _loggingtrace_structured)rp   rq   trace_idprofile_pathprofstart_tsretvalprofile_latencypssvg_pathgprof2dot_processr   r   rX   profile_wrapper,  sp   

	
z)cprofile_wrapper.<locals>.profile_wrapper)r   r   )r   r  rW   r   rX   r   +  s   ;r   c                   @   sT   e Zd Z			ddededefddZed	d
 Zdddej	de
defddZdS )ConvertFrameAssertTFNcompiler_fn	one_graphr   c                 C   s"   t   || _|| _|| _|| _d S rQ   )rJ   r   
_one_graph_export_export_constraints)rV   r  r  r   export_constraintsrW   rW   rX   rY   l  s
   
zConvertFrameAssert.__init__c                        fddS )Nc                    s   t |  j j jS rQ   )convert_frame_assertr  r  r  backendrU   rW   rX   r^   {  s    z8ConvertFrameAssert._clone_with_backend.<locals>.<lambda>rW   rU   rW   rU   rX   _clone_with_backendy     z&ConvertFrameAssert._clone_with_backendr   skipr   hooksr  c                C   s  t   |j}t||}t| |tv rd S tjdr'tjd|j	kr'd S |j	dkr4|j
dr4d S |j	dkr;d S |j	dkrN|j
tjtjjrNd S |j	dkrZ|j
dkrZd S |j	dkrk|j
dkrkt|jskd S t|rstd	 t|syd S t ad
|vrt|d
< td7 a|d
 }t| }	t|  d7  < t||	}
tdd|j	|j
|j|j|jd t |j|j!|j"|j| j#| j$| j%| j&||||||
|d dS )NTORCHDYNAMO_DEBUG_FUNCTIONz	<genexpr>)ztransformers/file_utils.pyztransformers/utils/generic.pyzdiffusers/utils/outputs.py__setattr__rY   z<module><string>z<lambda>	generator_idr   dynamoz_convert_frame_assert._compile)r   r   r   
cache_sizeaccumulated_cache_size)frame_state
compile_idr  )'rD   r   r&   input_codesrd   output_codesosenvirongetr   r   endswithr   pathdirnamerv   optim__file__r   
f_builtinsr"   r2   r   ru   rm   FRAME_COUNTERr   r   r   r   +num_cache_entries_with_same_id_matched_objsnum_cache_entries_compiler   r   r   r  r  r  )rV   r   cache_entryr  r&  r  r   r$  frame_idframe_compile_idr'  rW   rW   rX   __call__  s   	






zConvertFrameAssert.__call__TFN)rj   rk   rl   r   r   rY   propertyr  r   	FrameTyper7   r   r:  rW   rW   rW   rX   r  k  s*    

r  Tr  r  r   c                 C   s   t | |||S )z&Fully convert a frame into an FX graph)r  )r  r  r   r  rW   rW   rX   r    s   r  )OrderedDict)RemovableHandle)OutputGraph_bytecode_hookshookreturnc                 C   s   t t}| t|j< |S )zRegister hooks for bytecode generated by Dynamo. The hook can do some
    logging, as well as return a new code object to be used. Please refer
    to `BytecodeHook` for the hook signature.
    )r?  rA  r`   )rB  handlerW   rW   rX   register_bytecode_hook   s   
rE  r6  
phase_namer  r   globalslocalsbuiltinsr  r$  r   r  c          ,   #      s  ddl m m}mm} dt d d t 
t tjj	
  t 	
fdd}tddtdtjd	td
tdttt tttf gtf dtt f
fdd}tt|o d t|
ru|rut|	|t|
\}}|rdd }fdd}t d|t!t"||| t# t$| d t%dj&j'j(d d)t*j+d d,  tj-.dfdd t// }d }d }d }d }d }zDz|||}|W W ri j0_1ddl2m3} t|}|d u rHd urH|t4v rHt5j6}t5j7j6} 8 }!t5j9j:}"t5j;}#t4| <dd }$t4| <dd }%t4| <dd }&t4| <d d }'d!d" j=D }(d#d" j>D })n#d }d } d }!d }"d }#d }$d }%d }&d }'ti }(ti })t t// | t?t||j&j'j(|
j@|
jA|| |!|"|#||$|%|&|'|||||(|)|d u}*tB|* tjj	C  W  d    S  tDtEtFtGtHtI|tJ|f	y }+ z$ttK|+}t|+}tL|+|d$ |+jMd ur|+jMjN}|+jMjO}||+_P d }+~+w tQy }+ z.ttK|+}t|+}tL|+|d$ |+jMd ur|+jMjN}|+jMjO}||+_PtRt|+S|+jTd d }+~+ww ri j0_1ddl2m3} t|}|d u rd ur|t4v rt5j6}t5j7j6} 8 }!t5j9j:}"t5j;}#t4| <dd }$t4| <dd }%t4| <dd }&t4| <d d }'d!d" j=D }(d#d" j>D })n#d }d } d }!d }"d }#d }$d }%d }&d }'ti }(ti })t t// | t?t||j&j'j(|
j@|
jA|| |!|"|#||$|%|&|'|||||(|)|d u}*tB|* tjj	C  w 1 sw   Y  d S )%Nr   )bisectBisectValidationExceptiontranslation_validation_enabledValidationExceptiong        c                    s`     t| |
	dz`z0tjj      W d    n1 s1w   Y  W d    n1 s@w   Y  W n( tjyS   	    tj
tjfy^     tyn    rm jj  w W j  nj  w jd usJ jsJ j| d d < |j tjrt|  t|  tt| | d d < d S d S )N)r&  speculation_log)restartr9   r   outputtracing_contextset_current_txrunr   UnspecializeRestartAnalysisri   SpeculationRestartAnalysis	SkipFrame	Exception	shape_envcall_cleanup_hooksoutput_instructionsupdatecode_optionsr   dead_code_eliminationr#   r    r   r   )instructionsr]  )rK  rJ  r   r  r   r  r&  rH  rI  mutated_closure_cell_contentsr  rQ  rO  tracerrM  rW   rX   	transform/  sZ   
 
z_compile.<locals>.transformentire_frame_compilerF  r   r  r  rb  rC  c                    s  t    }}dd }|d| j| j| j|  t D ]k}|t _zt	| |}W  n\ t
jy] }	 z(tdtt|	j |	jpEtt|	 t   }|dkrStd W Y d }	~	qd }	~	w t
jy }	 ztd|	| j| j| j |rxtd W Y d }	~	 d S d }	~	ww |d	| j| j| j| t D ]}
|
| |}|d ur|}q| t|< t| ||  d usJ d
d }|| }||}d}|d| jd |  d7 }|d|jd |  7 }| jd | |jd | ksJ |d}|d| j d7 }|d|j 7 }| j|jksJ |d}|d| j d7 }|d|j 7 }| j|jks*J |jr5  r5d S j!d us=J j"t#j$|< t%|rK|j&nd }t'||j(}  se|j)d ure|)j! |S )Nc                 S   s*   t tjrt t| |||| d S d S rQ   )bytecode_logisEnabledForloggingDEBUGr   rA   )prefixr   filenameline_nor   rW   rW   rX   log_bytecodek  s
   z5_compile.<locals>.compile_inner.<locals>.log_bytecodezORIGINAL BYTECODEzRestarting analysis due to %sd   z100+ RestartAnalysis() callsz.Skipping frame %s %s                     %s %sz%No graph captured with one_graph=TruezMODIFIED BYTECODEc                 S   s4   dd l }| j| j t| j|j@  t| j|j@  S )Nr   )inspectco_argcountco_kwonlyargcountr   co_flags
CO_VARARGSCO_VARKEYWORDS)r   rm  rW   rW   rX   
count_args  s   z3_compile.<locals>.compile_inner.<locals>.count_argszarg mismatch: zold code object has args z, znew code object has args zfree var mismatch: zold code object has free var znew code object has free var zcell var mismatch: zold code object has cell var znew code object has cell var )*r   r   r   r   	itertoolscountr   r,  attemptr$   r   RestartAnalysisr   inforG   r   __traceback__rd   restart_reasonr   r   r2   rW  r   rA  r   rH   r)  co_varnamesco_freevarsco_cellvarsr   is_empty_graphr   cleanupsr=   instancer4   guard_fail_fnr6   check_fnguard_export_fn)r   r  r  rb  last_attempt_start_time
start_timerk  rv  out_coder   rB  hook_outputrs  total_argcount_oldtotal_argcount_newmsgr  guarded_code)dynamo_time_before_restartrQ  restart_reasonsrW   rX   compile_inner^  s   






z_compile.<locals>.compile_innerc                 S   s   d| j  d| j d| j dS )N'z' (:))r   r   r   )r   rW   rW   rX   format_func_info  s   z"_compile.<locals>.format_func_infoc                      s    sdS  d S )Nz$Unable to find recompilation reasonsrW   rW   )recompile_reasonsrW   rX   format_guard_failures  s   z'_compile.<locals>.format_guard_failuresztorch._dynamo hit config.%s (%s)
   function: %s
   last reason: %s
To log all recompilation reasons, use TORCH_LOGS="recompiles".
To diagnose recompilation issues, see %s.z reachedzBtorchdynamo start compiling %s %s:%s, stack (elided %s frames):
%s    r  dynamo_startc                      s   dt tjd  d iS )Nstack   r  )r   from_tracebackr   extractsummaryrW   r  rW   rX   r^   $  s   z_compile.<locals>.<lambda>r   )
curr_framebackend_compileinductor_compilecode_genc                 S      h | ]}|j qS rW   rl   r   oprW   rW   rX   	<setcomp>l  s    z_compile.<locals>.<setcomp>c                 S   r  rW   r  r  rW   rW   rX   r  m  s    r   )Utorch.fx.experimental.validatorrK  rL  rM  rN  rS   r:   rv   _dynamocallback_handlerrun_start_callbacksr   r@   r   r   CodeTyper   r7   r   r   r!   r   r   r   r   r6   r   r   r(   r5   r'   r   r   r   r   rL   r2   r   r   r   r   joinr   r  formatr  r  r   rQ  local_scopeutilsr  rB   lenr   rY  count_callsgraphnodesplaceholdersr,  non_compliant_opscompliant_custom_opsr>   r4  r5  rI   run_end_callbacksr3   r0   r-   AssertionErrorr   r   r1   r   r   innermost_user_frame_summaryri  linenor'  rX  r/   with_tracebackry  ),r   rH  rI  rJ  r  r  r   r  r  r7  r$  r   r&  r'  r  rL  rN  rb  r  exceeded
limit_typer  r  r  	fail_typefail_reasonfail_user_frame_filenamefail_user_frame_linenor  r  	frame_keyguard_countshape_env_guard_countgraph_op_countgraph_node_countgraph_input_countentire_frame_compile_timebackend_compile_timeinductor_compile_timecode_gen_timer  r  metricsr   rW   )rK  rJ  r   r  r  r   r  r&  rH  rI  r`  r  rQ  r  r  r  rO  ra  rM  rX   r6  
  s  *. 
 




 L




 c                   @   sF   e Zd ZdedefddZedd Z	ddej	ded	e
fd
dZdS )ConvertFramer  r  c                 C   s   || _ t|dd| _|| _d S )NF)r  )r   r  _inner_convert_hooks)rV   r  r  rW   rW   rX   rY     s   
zConvertFrame.__init__c                    r  )Nc                    s   t |  jS rQ   )convert_framer  r  rU   rW   rX   r^     r_   z2ConvertFrame._clone_with_backend.<locals>.<lambda>rW   rU   rW   rU   rX   r    r  z ConvertFrame._clone_with_backendr   r   r  c                 C   sT  t d d  d7  < z| j|||||d d}t d d  d7  < |W S  ty } zzt|tr1 t|t}t|trpttj	rpt
|drptt|j |j}	dt|	}
tjd|
d	d
 W d    n1 skw   Y  tjsv|sv t|dd }|j}t||||}|rtj|d	d
 ntj|d	d
 W Y d }~d S W Y d }~d S d }~ww )Nframestotalr   r  okr'  r  z(Graph break: skip: from user code at:
%sT)exc_infor   )r?   r  rX  r   r1   r3   graph_break_logre  rf  rg  r   r   r   r'  
real_stackr  	tracebackformat_listr   r   suppress_errorsr   r   r.   r   rx  r   )rV   r   r7  r  r&  r  rr   r   	soft_fail
user_stackuser_stack_formattedr   r   	error_msgrW   rW   rX   r:    sN   




zConvertFrame.__call__N)r   )rj   rk   rl   r   r7   rY   r<  r  r   r=  r   r:  rW   rW   rW   rX   r    s    
	r  c                 C   
   t | |S )zHTry to convert a frame into an FX graph, if error leave frame unmodified)r  )r  r  rW   rW   rX   r    s   
r  c                 C   s   ddl m} tj}dt_t| d}t|}W d    n1 s!w   Y  tt	|j
 t
  |_
zt|j|j
|j|j|ddd t tddd i d W |t_d S |t_w )Nr   )eagerFrbr   )r  r  r   r  r  r$  r   r&  )backends.debuggingr  r   replay_record_enabledopenr8   loadr   rt  chainrH  itemsr6  r   rI  rJ  r7   r%   )ri  r  original_replay_valin_filerecordrW   rW   rX   replay  s.   r  c                 C   s>   t jdk rdS t| D ]}|jdkr|jd   S qtd)N)      r   RESUMEr  z$RESUME instruction not found in code)sysversion_infodisget_instructionsopnameoffsetRuntimeError)r   instrW   rW   rX   first_real_inst_idx  s   

r  c                   @   s   e Zd Zdd Zdd ZdS )CatchErrorsWrapperc                 C   s   t ||  || _|| _d S rQ   )r   r   r   r  )rV   callbackr  rW   rW   rX   rY   !  s   
zCatchErrorsWrapper.__init__c           
   	   C   s  |d usJ t |j}|jt|jks|stjrAtt	j
r?|jt|jkr)dn	t |jr1dnd}td|jj||jj d S |jjdkrO|jjdkrOd S t dkrt }|rt0 dd	lm} ||j| jjd
}t| jdswJ d| j|j}	|	||| j|W  d    S 1 sw   Y  t. t  | j||| j|ddW  d    W  d    S 1 sw   Y  W d    d S 1 sw   Y  d S )Nztraced frame alreadyzin skipfileszdynamo tracing is disabledz#skipping: %s (reason: %s, file: %s)r   __new__ddp_optimizerr   )DDPOptimizer)bucket_bytes_capbackend_compile_fnr  zJDDPOptimizer only supports callback fns that know how to clone themselves.r   r  )r   r   r   f_lastir  r   r   r   re  rf  rg  r   r   r   _get_optimize_ddp_moder   _get_active_ddp_modulecompile_lock"torch._dynamo.backends.distributedr  r  r   r   r  
compile_fnr  r   )
rV   r   r7  r&  is_skipfileskip_reason
ddp_moduler  r  hijacked_callbackrW   rW   rX   r:  &  sd   
	
 RzCatchErrorsWrapper.__call__N)rj   rk   rl   rY   r:  rW   rW   rW   rX   r     s    r  c                 C   r  rQ   )r  )r  r  rW   rW   rX   catch_errors_wrappera  s   
r  )NFr;  )NNN)collectionsr   r  r   rt  rf  r*  r   r}   r   r  	threadingr   r  r   typingra   pathlibr   r   r   r   r   r   r   torch._utils_internalr	   torch.fx._lazy_graph_moduler
   torch.utils._tracebackr   numpyr   ModuleNotFoundErrorrv   torch._loggingtorch._guardsr   r   r   r   r   r   r   %torch.fx.experimental.symbolic_shapesr   r   torch.fx.graph_moduler   rn   torch.nn.parallel.distributedr   torch.utils._python_dispatchr   r   r  r   r   r   backends.registryr   bytecode_analysisr   r   bytecode_transformationr    r!   r"   r#   r$   r$  r%   r&   r'   r(   
eval_framer)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r   r4   r5   r6   r  r7   replay_recordr8   symbolic_convertr9   r:   r;   r<   r  r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   	getLoggerrj   r   r  getArtifactLoggerrd  r  rx   r  ru   RLockr  rP   r(  r)  rm   __annotations__r   rs   r   #suppress_torch_distributed_warningsr   r   r3  Counterr   r   r   r   r  r   r  r>  torch.utils.hooksr?  TYPE_CHECKINGoutput_graphr@  rA  rE  use_lazy_graph_moduler  r   objectr=  r6  r  r  r  r  r  r  rW   rW   rW   rX   <module>   s  
 (
L

4

N
@ 





	   U	A