~L iP,&ddlZddlZddlZddlZddlZddlZddlmZmZm Z m Z ddlm Z ddl Z ddl mZe dZe dZej"eZej(j+ddrJddlZej.d sej1d n"ej1d ej2ej4j7ej4j9ed k(rNej4j9ej4j9ej4j9eZn4ej4j9ej4j9eZd edefdZ d edefdZ!dedefdZ"deddfdZ#dedefdZ$dZ%dedeeeefgeeefffdZ&dedede'eeffdZ(dededefdZ)dZ*d Z+d!Z,d"Z-d#Z.dFd$Z/dFd%Z0d&efd'Z1d(Z2de3fd)Z4de3fd*Z5d&ed+ed,ed-efd.Z6dGded0e3de3fd1Z7dede8fd2Z9de3fd3Z:ejvd4Zd6Z?d7Z@d/ZAdZBdZCd8ede efd9ZDd:e'eefd;eEedZFd:e'eeffd?ZGd@ZHdAZIdBZJdCe efdDZKde efdEZLy)HN)AnyCallableOptionalTypeVar) ParamSpec)StrobelightCompileTimeProfiler_T_PTORCH_COMPILE_STROBELIGHTF strobeclientzNTORCH_COMPILE_STROBELIGHT is true, but seems like you are not on a FB machine.z8Strobelight profiler is enabled via environment variablesharedpath_componentsreturncJtjjtg|SN)ospathjoin torch_parentrs [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/_utils_internal.py get_file_pathr*s 77<< 7 77c:tjj|Sr)rrrrs rget_file_path_2r.s 77<< ))rrctj|tjr|Stjtj j |S)N)suffix)raccessW_OKtempfilemkdtemprbasenamers rget_writable_pathr$2s9 yyrww   277#3#3D#9 ::rcyrr#s r#prepare_multiprocessing_environmentr'8rc@tjj|Sr)rrrealpathr#s rresolve_library_pathr+<s 77  D !!rch|tjvrt|dt|d|d|)Nz5: We could not find the fake impl for this operator. zm: We could not find the fake impl for this operator. The operator specified that you may need to import the 'z'' Python module to load the fake impl. )sysmodulesNotImplementedError)opnamemodulecontexts r&throw_abstract_impl_not_imported_errorr3@sU !hK L  "hGGMhO44;9 >  r phase_namec`dtttfdtttfffd }|S)Nfunctionrctjdtjdtjdt ffd }|S)Nargskwargsrcd|vrt|dx}tr|dz|d<tjs|i|Stjg|i|S)Nskip) isinstanceintrenabledprofile_compile_time)r8r9r;r6r4s rwrapper_functionzdcompile_time_strobelight_meta..compile_time_strobelight_meta_inner..wrapper_functionTsmJvf~/Ets$K!%v2990001FF*'+/5 r) functoolswrapsr r8r9r )r6rAr4s` r#compile_time_strobelight_meta_innerzJcompile_time_strobelight_meta..compile_time_strobelight_meta_innerQsE  " BGG ryy R  #  rrr r )r4rDs` rcompile_time_strobelight_metarFNs2 2r6" "b&  & /.rcategoryname parametersc4tjd|||y)Nz %s %s: %rloginfo)rGrHrIs rsignpost_eventrNtsHH[(D*5rinsightinsight_descriptioncyrr&)rGrOrPs radd_mlhub_insightrRxr(rc0tjd|y)Nz%srK)metricss rlog_compilation_eventrU|sHHT7rcyrr&)graphs r upload_graphrXr(rcyrr&r&rr+set_pytorch_distributed_envs_from_justknobsrZr(rc yrr&r9s rlog_export_usager]r(rc yrr&r\s rlog_draft_export_usager_r(rcyrr&r8r9s rlog_trace_structured_eventrbr(rcyrr&ras rlog_cache_bypassrdr(rapic |}yrr&)rer9_s rlog_torchscript_usagerhs  A rcyNFr&r&rrcheck_if_torch_exportablerk rcyNTr&r&rr export_training_ir_rollout_checkro rcyrnr&r&rrfull_aoti_runtime_assertrrrprtype_of_exportexport_outcomeresultc||||f\}}}}yrr&)rersrtrurgs r!log_torch_jit_trace_exportabilityrws nnf reventstack logger_uuid start_time_nscyrr&)rrrrs rlog_chromium_event_internalrs rcyrr&)rs rrecord_chromium_event_internalrs rcyrnr&r&rr1profiler_allow_cudagraph_cupti_lazy_reinit_cuda12r!rprcZdtttfdtttffd}|S)a  When we deprecate a function that might still be in use, we make it internal by adding a leading underscore. This decorator is used with a private function, and creates a public alias without the leading underscore, but has a deprecation warning. This tells users "THIS FUNCTION IS DEPRECATED, please use something else" without breaking them, however, if they still really really want to use the deprecated function without the warning, they can do so by using the internal function name. funcrc |jjds td|jdd}tj|j }t ||rtd|d|jd|jddd}tj|td|}||_d |jvr+|jjd dd d z|z|_ n||_ t||||S) Nrgz@deprecate must decorate a function whose name starts with a single leading underscore (e.g. '_foo') as the api should be considered internal for deprecation.r<zCannot create alias 'z' -> symbol already exists in zP. Please rename it or consult a pytorch developer on what to doz= is DEPRECATED, please consider using an alternative API(s). )rG stacklevel.r)__name__ startswith ValueErrorr-r. __module__hasattr RuntimeErrortyping_extensions deprecated UserWarning __qualname__rsplitsetattr)r public_namer1 warning_msgaliass r decoratorzdeprecated..decorator0s" ((-B  mmAB' T__- 6; '' }4RSYSbSbRcdOP  qr*++hi  !,, +! % $## #!%!2!2!9!9#q!A!!Ds!J[!XE !,E  U+ rrE)rs rrr%s0#R(#Xb"f-=#J rcy)a When using elastic agent, if no numa options are provided, we will use these as the default. For external use cases, we return None, i.e. no numa binding. If you would like to use torch's automatic numa binding capabilities, you should provide NumaOptions to your launch config directly or use the numa binding option available in torchrun. Must return None or NumaOptions, but not specifying to avoid circular import. Nr&r&rrget_default_numa_optionsrXs rfailcyrr&)rs rlog_triton_buildsrgr(rcy)z< Allows overriding the binary used for subprocesses Nr&r&rrfind_compile_subproc_binaryrks r)rN)T)MrBloggingrr-r rtypingrrrrrr(torch._strobelight.compile_time_profilerrr r getLoggerrrLenvirongetshutilwhichrMenablerr"dirname__file__rrrrr$r'r+r3rFdictrNrRrUrXrZr]r_rbrdrhrkboolrorrrwrzr>r|r~cachertuplerTEST_MASTER_ADDRTEST_MASTER_PORTUSE_GLOBAL_DEPSUSE_RTLD_GLOBAL_WITH_LIBTORCHREQUIRES_SET_PYTHON_MODULErlistrrrrrrrr&rrrsy 33' S T]t_g!::>>-u5 6<< '  \  KL-&--/77BGGOOH-.(:77??277??277??83L#MNL77??277??8#<=L8C8C8*c*c*;C;C;  c d "s"s"  // xB (2r6"223/L6S66c3h6  c         s $$       #4 s s  B8E#s(O#<!& #chsm  S> 9  S> 0f  HSM Xc]r