/usr/local/lib/python3.6/site-packages/transformers/__pycache__
NameSizeModeActions
activations.cpython-36.pyc77500644editdlrm
activations_tf.cpython-36.pyc41360644editdlrm
configuration_utils.cpython-36.pyc393970644editdlrm
convert_graph_to_onnx.cpython-36.pyc160360644editdlrm
convert_pytorch_checkpoint_to_tf2.cpython-36.pyc91760644editdlrm
convert_slow_tokenizer.cpython-36.pyc304510644editdlrm
convert_slow_tokenizers_checkpoints_to_fast.cpython-36.pyc29500644editdlrm
convert_tf_hub_seq_to_seq_bert_to_pytorch.cpython-36.pyc18310644editdlrm
debug_utils.cpython-36.pyc110980644editdlrm
deepspeed.cpython-36.pyc128870644editdlrm
dependency_versions_check.cpython-36.pyc9610644editdlrm
dependency_versions_table.cpython-36.pyc20390644editdlrm
dynamic_module_utils.cpython-36.pyc139500644editdlrm
feature_extraction_sequence_utils.cpython-36.pyc128480644editdlrm
feature_extraction_utils.cpython-36.pyc225680644editdlrm
file_utils.cpython-36.pyc38030644editdlrm
generation_beam_constraints.cpython-36.pyc165560644editdlrm
generation_beam_search.cpython-36.pyc254400644editdlrm
generation_flax_logits_process.cpython-36.pyc110800644editdlrm
generation_flax_utils.cpython-36.pyc223200644editdlrm
generation_logits_process.cpython-36.pyc283870644editdlrm
generation_stopping_criteria.cpython-36.pyc63520644editdlrm
generation_tf_logits_process.cpython-36.pyc165240644editdlrm
generation_tf_utils.cpython-36.pyc863740644editdlrm
generation_utils.cpython-36.pyc1135760644editdlrm
hf_argparser.cpython-36.pyc89970644editdlrm
image_utils.cpython-36.pyc97300644editdlrm
integrations.cpython-36.pyc314040644editdlrm
keras_callbacks.cpython-36.pyc145290644editdlrm
modelcard.cpython-36.pyc261650644editdlrm
modeling_flax_outputs.cpython-36.pyc348780644editdlrm
modeling_flax_pytorch_utils.cpython-36.pyc83510644editdlrm
modeling_flax_utils.cpython-36.pyc286020644editdlrm
modeling_outputs.cpython-36.pyc590830644editdlrm
modeling_tf_outputs.cpython-36.pyc457330644editdlrm
modeling_tf_pytorch_utils.cpython-36.pyc125920644editdlrm
modeling_tf_utils.cpython-36.pyc709060644editdlrm
modeling_utils.cpython-36.pyc983820644editdlrm
optimization.cpython-36.pyc226530644editdlrm
optimization_tf.cpython-36.pyc134080644editdlrm
processing_utils.cpython-36.pyc85680644editdlrm
pytorch_utils.cpython-36.pyc11180644editdlrm
testing_utils.cpython-36.pyc432770644editdlrm
tf_utils.cpython-36.pyc12510644editdlrm
tokenization_utils.cpython-36.pyc258450644editdlrm
tokenization_utils_base.cpython-36.pyc1292790644editdlrm
tokenization_utils_fast.cpython-36.pyc219790644editdlrm
trainer.cpython-36.pyc818400644editdlrm
trainer_callback.cpython-36.pyc229060644editdlrm
trainer_pt_utils.cpython-36.pyc398290644editdlrm
trainer_seq2seq.cpython-36.pyc80280644editdlrm
trainer_tf.cpython-36.pyc255360644editdlrm
trainer_utils.cpython-36.pyc155710644editdlrm
training_args.cpython-36.pyc546000644editdlrm
training_args_seq2seq.cpython-36.pyc23170644editdlrm
training_args_tf.cpython-36.pyc128690644editdlrm
__init__.cpython-36.pyc1094310644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/transformers/__pycache__/integrations.cpython-36.pyc (31404B)
3 Eg @svdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z e j eZejjddk o|ejddjd kZeryJddlZeed rejjd rd Zn"ejddjd krejd dZWneefk rdZYnXddlmZmZddlm Z m!Z!m"Z"ddl m#Z#m$Z$ddZ%ddZ&ddZ'ddZ(ddZ)ddZ*ddZ+d d!Z,d"d#Z-d$d%Z.d&d'Z/d(d)Z0d*d+Z1d,d-Z2e3e4e!d.d/d0Z5e3e4e!d.d1d2Z6e3e4e!d.d3d4Z7e3e4e!d.d5d6Z8d7d8Z9d9d:Z:Gd;d<dd>eZGdCdDdDeZ?GdEdFdFeZ@GdGdHdHeZAe>e=e?e@e;e._objectivetimeoutn_jobsrr<)r;rNrO)N) r"popZ create_studyoptimize best_trialr strnumbervaluer4) rLr;r<kwargsr"rMrNrOZstudyrRr)rLrrun_hp_search_optunas  rWc sRddld$fdd }|jjs@ddlm}tjd|dd|_|jt}d|_ d |krd di|d <|j j dkr|d|d d <d |j j dkrd nd}tj d|d|d j d d}||j _d|krddlm} | dgd|d<d|ko|ddkr"d|_|ddkr"tjd|ddd|krddlm} m} m} m} t|d| rf|jsftjdt|d| | | | fr|j j s|j jtjkrtdjt|djdj j!||dt"j#fdd}t$d rj%|_%j j&|f|j'd|d!|}|j(d|dd"d#}t)|j*|j+d|j,}|dk rN|j-||S)%Nrcsy$ddlm}|j|r"|jtWntk r8YnXd}|rnx*tj|D]}|jt rNtj j ||}qNWd|_ |j ||dt|dddkr|j}|j||_ |jjjfd|j i|ddidS)Nr)NotebookProgressCallback)r>r8r?doneT)Ztransformers.utils.notebookrX pop_callback add_callbackr ModuleNotFoundErrorrr@rAr rBrCr?rDrErFrGZ_tune_save_checkpointtunereport)r8 local_trainerrHrXrIrJrK)r$rrrMs$    z%run_hp_search_ray.._objectiver)TrainerMemoryTrackerzMemory tracking for your Trainer is currently enabled. Automatically disabling the memory tracker since the memory tracker is not serializable.T)skip_memory_metricsZresources_per_trialcpuZgpuz1 CPUz and 1 GPUrzgNo `resources_per_trial` arg was passed into `hyperparameter_search`. Setting it to a default value of z for each trial.Zprogress_reporter) CLIReporterr?)Zmetric_columnsZkeep_checkpoints_numzCurrently keeping ze checkpoints for each trial. Checkpoints are usually huge, consider setting `keep_checkpoints_num=1`.Z scheduler) ASHASchedulerHyperBandForBOHBMedianStoppingRulePopulationBasedTraininga/You are using PopulationBasedTraining but you haven't enabled checkpointing. This means your trials will train from scratch everytime they are exploiting new configurations. Consider enabling checkpointing by passing `keep_checkpoints_num=1` as an additional argument to `Trainer.hyperparameter_search`.aYou are using {cls} as a scheduler but you haven't enabled evaluation during training. This means your trials will not report intermediate results to Ray Tune, and can thus not be stopped early or used to exploit other trials parameters. If this is what you want, do not use {cls}. If you would like to use {cls}, make sure you pass `do_eval=True` and `evaluation_strategy='steps'` in the Trainer `args`.)cls)r_cs^trTddl}tjj|jjd}tjj d|}tjj |}|t j |j <|jj|||S)a" Wrapper around `tune.with_parameters` to ensure datasets_modules are loaded on each Actor. Without this, an ImportError will be thrown. See https://github.com/huggingface/transformers/issues/11565. Assumes that `_objective`, defined above, is a function. rNz __init__.pydatasets_modules)rZ datasets.loadrrBrCloadZinit_dynamic_modulesrrspec_from_file_locationmodule_from_specsysmodulesnameloader exec_module)argsrVZdatasetsZdynamic_modules_pathspecri) trainablerr dynamic_modules_import_trainable s    z;run_hp_search_ray..dynamic_modules_import_trainable __mixins__)r Z num_samples)metricmode)N).r$Z_memory_trackerra trainer_utilsr`rrrZTensorBoardCallbackmodelrrZn_gpuinfogetZ_n_gpuZray.tunercZuse_tune_checkpointsZray.tune.schedulersrdrerfrgr3Zdo_evalZevaluation_strategyrNOr6formattype__name__r]Zwith_parameters functoolswrapshasattrrvrunhp_spaceZget_best_trialr Ztrial_idZ last_resultr r[)rLr;r<rVrMr`Z _tb_writerZ resource_msgZgpus_per_trialrcrdrerfrgruZanalysisrRbest_runr)r$rtrrun_hp_search_raysh           rcKs^ddlm}|}|jdd}|dk r0|j||jjd|jdtd|ddgd|d d }tj d |j x|j j |j kr&|j|j jj}d|_|jd|d t|dddkr|j} |j| |_td|jd g} |j|j jj|j | d} tj d|j d| j d|j|j j}qpWt|j|j jjjd} t| j | j| j} | S)Nr) Connectionproxieszhuggingface-tuner?rQ)ror?Zstrategyr huggingface)ro parametersrKZparallel_bandwidthobservation_budgetprojectz6created experiment: https://app.sigopt.com/experiment/)r>r8)rorU) suggestionvaluesz"[suggestion_id, observation_id]: [z, ])r'rrPZ set_proxiesZ experimentscreaterr5rr}idprogressZobservation_countrZ suggestionsr?rDrErFrGZ observationsfetchlistZbest_assignmentsZ iterate_pagesr rU assignments)rLr;r<rVrconnr experimentrrKrZobsbestrrrrrun_hp_search_sigopt2s6     rc  s<ddlm}|stdddld}x jjD]}t|tr0d}Pq0W|sXjtdj _ dddd|j d d}|j d d}|j d d} |j d d} |j d dj d} | d d<| d d <| r| | d <fdd} |sj | || dn|}tjd|j|| |dtdddS)Nr)rz8This function needs wandb installed: `pip install wandb`rFTr)run_idr?hyperparameterssweep_idrroentityrxz eval/lossZgoalcsjr jnj}|jj_|jjidj}d_jdt |ddt dddkrj }j |_t |}|krtjdd|jd}ddk rވd krȈjdk}nd krވjdk}|sddkr|jd<jd<t|d <jS) N)rrxZ_items)r>r8r?zProvided metric zU not found. This might result in unexpected sweeps charts. The available metrics are FrZminimizeZmaximizer)rinitrostate trial_namer updater?rDvarsrErFrG rewrite_logsrrkeysrr5)rr rKZformat_metricsZ best_score)rRr<rxrLrrrrMvs0      z'run_hp_search_wandb.._objective)rrzwandb sweep id - )functioncountrr?r) integrationsr ImportErrorrZcallback_handler callbacksr3 WandbCallbackr[rr report_torPrZsweeprr}Zagentr ) rLr;r<rVrZreporting_to_wandbcallbackrrrorZ sweep_configrMr)rRr<rxrLrrrun_hp_search_wandbYs8            !rcCshg}tr|jdtr$|jdtr4|jdtrD|jdtrT|jdtrd|jd|S)Nazure_mlrr,rrr1)r)appendrr-r!rr2)rrrr$get_available_reporting_integrationss      rcCsi}d}t|}d}t|}x`|jD]T\}}|j|rN||d||d<q&|j|rn||d||d<q&||d|<q&W|S)NZeval_Ztest_zeval/ztest/ztrain/)lenitemsrA)dZnew_dZ eval_prefixZeval_prefix_lenZ test_prefixZtest_prefix_lenkvrrrrs  rc@s>eZdZdZd ddZdddZddZdd d Zd d ZdS)r{z A [`TrainerCallback`] that sends the logs to [TensorBoard](https://www.tensorflow.org/tensorboard). Args: tb_writer (`SummaryWriter`, *optional*): The writer to use. Will instantiate one if not set. NcCst}|std|rvyddlm}||_Wq|tk rryddlm}||_Wntk rld|_YnXYq|Xnd|_||_dS)NzuTensorBoardCallback requires tensorboard to be installed. Either update your PyTorch version or install tensorboardX.r) SummaryWriter)r!r6Ztorch.utils.tensorboardr_SummaryWriterrr tb_writer)selfrZhas_tensorboardrrrr__init__s     zTensorBoardCallback.__init__cCs&|p|j}|jdk r"|j|d|_dS)N)log_dir) logging_dirrr)rrrrrrr_init_summary_writers  z(TensorBoardCallback._init_summary_writerc Ks|js dSd}|jr2|j}|dk r2tjj|j|}|jdkrH|j|||jdk r|jj d|j d|kr|d}t |dr|j dk r|j j }|jj d|t |jdr|jj |jiddS)Nrrr|r model_config add_hparams)Z metric_dict)is_world_process_zerois_hyper_param_searchrrrBrCrrradd_textZto_json_stringrr rto_sanitized_dict) rrrrcontrolrVrrr|Zmodel_config_jsonrrron_train_begins$     z"TensorBoardCallback.on_train_beginc Ks|js dS|jdkr|j||jdk rt|}xX|jD]L\}}t|ttfrd|jj|||j q:t j d|dt |d|dq:W|jj dS)Nz)Trainer is attempting to log a value of "z " of type z for key "zn" as a scalar. This invocation of Tensorboard's writer.add_scalar() is incorrect so we dropped this attribute.)rrrrrr3intfloatZ add_scalar global_steprrrflush)rrrrrlogsrVrrrrron_logs   "zTensorBoardCallback.on_logcKs|jr|jjd|_dS)N)rclose)rrrrrrVrrr on_train_ends z TensorBoardCallback.on_train_end)N)N)N) r __module__ __qualname____doc__rrrrrrrrrr{s    r{c@s>eZdZdZddZddZd ddZdd d Zdd d ZdS)rzc A [`TrainerCallback`] that sends the logs to [Weight and Biases](https://www.wandb.com/). cCsLt}|std|r$ddl}||_d|_tjddjtj dhk|_ dS)NzFWandbCallback requires wandb to be installed. Run `pip install wandb`.rFZWANDB_LOG_MODELr*r+) rr6r_wandb _initializedrrrrunion _log_model)rZ has_wandbrrrrrszWandbCallback.__init__c Ks&|jdkrdSd|_|jr"tjd|j}t|drV|jdk rV|jj}||}|j }i}|dk rx|} |j |d<n|j } |jj dkr|jj ft jdd| d||jjj|dd t|jd dr|jjd |jjd d dd t ot jddkr"|jj|t jddtd|jddS)az Setup the optional Weights & Biases (*wandb*) integration. One can subclass and override this method to customize the setup if needed. Find more information [here](https://docs.wandb.ai/integrations/huggingface). You can also override the following environment variables: Environment: WANDB_LOG_MODEL (`bool`, *optional*, defaults to `False`): Whether or not to log model as artifact at the end of training. Use along with *TrainingArguments.load_best_model_at_end* to upload best model. WANDB_WATCH (`str`, *optional* defaults to `"gradients"`): Can be `"gradients"`, `"all"` or `"false"`. Set to `"false"` to disable gradient logging or `"all"` to log gradients and parameters. WANDB_PROJECT (`str`, *optional*, defaults to `"huggingface"`): Set this to a custom string to store results in a different project. WANDB_DISABLED (`bool`, *optional*, defaults to `False`): Whether or not to disable wandb entirely. Set *WANDB_DISABLED=true* to disable. NTz`Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"r groupZ WANDB_PROJECTr)rro)Zallow_val_change define_metricztrain/global_step*)Z step_metricZ step_syncZ WANDB_WATCHfalseZ gradientsd)logZlog_freq)rrrrr}rrr to_dictrrun_namerrrrrrErrZwatchmaxZ logging_steps) rrrrr|rV combined_dictrrZ init_argsrrrrsetup(s8       zWandbCallback.setupNcKsJ|jdkrdS|j}|r.|jjd|_d|_|jsF|j|||f|dS)NF)rrfinishrrr)rrrrrr|rVZ hp_searchrrrrds  zWandbCallback.on_train_begincKs |jdkrdS|jo|jo|jrddlm}||||d}tj} |j| |j spddt |jj j Dnd|j |jd|ji} |jjd|jjjd | d } xHt| jd D]6} | jr| j| jd d } | j| jWdQRXqW|jjj| WdQRXdS)Nr)Trainer)rrr| tokenizercSs.i|]&\}}t|tjr|jd r||qS)_)r3numbersNumberrA).0rrrrr ysz.WandbCallback.on_train_end..zeval/ztrain/total_flosszmodel-r|)rormetadatarwb)ry)rrrrrLrtempfileTemporaryDirectoryZ save_modelZload_best_model_at_endr5summaryrZmetric_for_best_modelZ best_metricZ total_flosZArtifactrrrglobis_fileZnew_filerowrite read_bytesZ log_artifact)rrrrrr|rrVrZ fake_trainertemp_dirrartifactffarrrros       zWandbCallback.on_train_endcKsJ|jdkrdS|js"|j||||jrFt|}|jj|d|jidS)Nztrain/global_step)rrrrrrr)rrrrrr|rrVrrrrs zWandbCallback.on_log)N)NN)NN) rrrrrrrrrrrrrrs  < rc@s<eZdZdZddZddZd ddZdd d Zd d ZdS) CometCallbackz^ A [`TrainerCallback`] that sends the logs to [Comet ML](https://www.comet.ml/site/). cCsts tdd|_d|_dS)NzLCometCallback requires comet-ml to be installed. Run `pip install comet-ml`.F)rr6r _log_assets)rrrrrszCometCallback.__init__cCsd|_tjddj}|dkr$d|_|jrtjddj}d}d tjd d i}|dkrztjf|}|jd d t j dn:|dkrtjdd|d<tj f|}|jd d t j d|dk r|j |d d|j |dd dt|dr|j |jdd ddS)a Setup the optional Comet.ml integration. Environment: COMET_MODE (`str`, *optional*): Whether to create an online, offline experiment or disable Comet logging. Can be "OFFLINE", "ONLINE", or "DISABLED". Defaults to "ONLINE". COMET_PROJECT_NAME (`str`, *optional*): Comet project name for experiments COMET_OFFLINE_DIRECTORY (`str`, *optional*): Folder to use for saving offline experiments when `COMET_MODE` is "OFFLINE" COMET_LOG_ASSETS (`str`, *optional*): Whether or not to log training assets (tf event logs, checkpoints, etc), to Comet. Can be "TRUE", or "FALSE". Defaults to "TRUE". For a number of configurable items in the environment, see [here](https://www.comet.ml/docs/python-sdk/advanced/#comet-configuration-variables). TZCOMET_LOG_ASSETSr*r+1rZONLINEN project_nameZCOMET_PROJECT_NAMErz Created from transformersz)Automatic Comet.ml online logging enabledZOFFLINEZCOMET_OFFLINE_DIRECTORYz./Zoffline_directoryzLAutomatic Comet.ml offline logging enabled; use `comet upload` when finished) frameworkzargs/)prefixrr zconfig/>r+r)rrrrrrrZ ExperimentZ log_otherrr}ZOfflineExperimentZ_set_model_graphZ_log_parametersrr )rrrrr|Z log_assetsZ comet_moderZexperiment_kwargsrrrrs,       zCometCallback.setupNcKs|js|j|||dS)N)rr)rrrrrr|rVrrrrszCometCallback.on_train_begincKsF|js|j||||jrBtjj}|dk rB|j||j|jdddS)Nr)stepepochr) rrrrr get_global_experimentZ _log_metricsrr)rrrrrr|rrVrrrrrs  zCometCallback.on_logcKsT|jrP|jrPtjj}|dk rH|jdkrHtjd|j|j dd|j d|j dS)NTz(Logging checkpoints. This may take time.) recursiveZ log_file_namer) rrrr rrrr}Zlog_asset_folder output_dirrend)rrrrrrVrrrrrs   zCometCallback.on_train_end)N)NN) rrrrrrrrrrrrrrs *  rc@s,eZdZdZd ddZddZd ddZdS) AzureMLCallbackzh A [`TrainerCallback`] that sends the logs to [AzureML](https://pypi.org/project/azureml-sdk/). NcCststd||_dS)NzPAzureMLCallback requires azureml to be installed. Run `pip install azureml-sdk`.)r)r6 azureml_run)rrrrrrszAzureMLCallback.__init__cKs*ddlm}|jdkr&|jr&|j|_dS)Nr)Run)Zazureml.core.runrrr get_context)rrrrrrVrrrr on_init_ends zAzureMLCallback.on_init_endcKsF|jrB|jrBx4|jD](\}}t|ttfr|jj|||dqWdS)N) description)rrrr3rrr)rrrrrrrVrrrrrrs zAzureMLCallback.on_log)N)N)rrrrrr rrrrrrs rc@sDeZdZdZddZddZdddZdd d Zd d Zd dZ dS)MLflowCallbackz A [`TrainerCallback`] that sends the logs to [MLflow](https://www.mlflow.org/). Can be disabled by setting environment variable `DISABLE_MLFLOW_INTEGRATION = TRUE`. cCsDtstdddl}|jjj|_|jjj|_d|_ d|_ ||_ dS)NzIMLflowCallback requires mlflow to be installed. Run `pip install mlflow`.rF) r-r6r,utilsZ validationZMAX_PARAM_VAL_LENGTH_MAX_PARAM_VAL_LENGTHZMAX_PARAMS_TAGS_PER_BATCH_MAX_PARAMS_TAGS_PER_BATCHr_log_artifacts_ml_flow)rr,rrrrs  zMLflowCallback.__init__c Cs tjddj}|d krd|_|jr|jjdkrB|jj|jd|j }t |drp|j dk rp|j j }||}xHt |j D]8\}}tt||jkr~tjd |d |d ||=q~Wt |j } x8td t| |jD]"} |jjt| | | |jqWd|_dS)a$ Setup the optional MLflow integration. Environment: HF_MLFLOW_LOG_ARTIFACTS (`str`, *optional*): Whether to use MLflow .log_artifact() facility to log artifacts. This only makes sense if logging to a remote server, e.g. s3 or GCS. If set to `True` or *1*, will copy whatever is in [`TrainingArguments`]'s `output_dir` to the local or remote artifact storage. Using it without a remote storage will just copy the files to your artifact location. ZHF_MLFLOW_LOG_ARTIFACTSr*r+rTN)rr z)Trainer is attempting to log a value of "z " for key "zv" as a parameter. MLflow's log_param() only accepts values no longer than 250 characters so we dropped this attribute.r>r+r)rrrrrr active_runZ start_runrrrr rrrrSr rrrangerZ log_paramsr5r) rrrrr| log_artifactsrrrorUZcombined_dict_itemsirrrr s&     "zMLflowCallback.setupNcKs|js|j|||dS)N)rr)rrrrrr|rVrrrr1szMLflowCallback.on_train_beginc Ks|js|j||||jri}xN|jD]B\}} t| ttfrH| ||<q(tjd| dt | d|dq(W|j j ||j ddS)Nz)Trainer is attempting to log a value of "z " of type z for key "zc" as a metric. MLflow's log_metric() only accepts float and int types so we dropped this attribute.)rKr) rrrrr3rrrrrrZ log_metricsr) rrrrrrr|rVrKrrrrrr5s "zMLflowCallback.on_logcKs.|jr*|jr*|jr*tjd|jj|jdS)Nz&Logging artifacts. This may take time.)rrrrr}rrr)rrrrrrVrrrrFs  zMLflowCallback.on_train_endcCs|jjdk r|jjdS)N)rrZend_run)rrrr__del__Ls zMLflowCallback.__del__)N)N) rrrrrrrrrrrrrrr s '  r c@s<eZdZdZddZddZd ddZdd d Zd d ZdS)NeptuneCallbackzU A [`TrainerCallback`] that sends the logs to [Neptune](https://neptune.ai). cCs.tstdddlj}||_d|_d|_dS)NzZNeptuneCallback requires neptune-client to be installed. Run `pip install neptune-client`.rF)r0 ValueErrorZ neptune.newnew_neptunerr)rr/rrrrXs zNeptuneCallback.__init__cCs|jrz|jjtjdtjdtjddtjddtjddd|_|j}t|d rp|jdk rp|jj}||}||jd <d |_ dS) a( Setup the Neptune integration. Environment: NEPTUNE_PROJECT (`str`, *required*): The project ID for neptune.ai account. Should be in format *workspace_name/project_name* NEPTUNE_API_TOKEN (`str`, *required*): API-token for neptune.ai account NEPTUNE_CONNECTION_MODE (`str`, *optional*): Neptune connection mode. *async* by default NEPTUNE_RUN_NAME (`str`, *optional*): The name of run process on Neptune dashboard ZNEPTUNE_PROJECTZNEPTUNE_API_TOKENZNEPTUNE_CONNECTION_MODEasyncZNEPTUNE_RUN_NAMENZNEPTUNE_RUN_ID)rZ api_tokenryrorr rT) rrrrr _neptune_runrrr r)rrrrr|rrrrrrcs    zNeptuneCallback.setupNcKs|js|j|||dS)N)rr)rrrrrr|rVrrrrszNeptuneCallback.on_train_beginc KsJ|js|j||||jrFx*|jD]\}}|j|j||jdq$WdS)N)r)rrrrrrr) rrrrrrr|rVrrrrrrs zNeptuneCallback.on_logc CsFy,tjd}|rt|nd}|jj|dWntk r@YnXdS)a Environment: NEPTUNE_STOP_TIMEOUT (`int`, *optional*): Number of seconsds to wait for all Neptune.ai tracking calls to finish, before stopping the tracked run. If not set it will wait for all tracking calls to finish. ZNEPTUNE_STOP_TIMEOUTN)seconds)rrrrstopAttributeError)rZ stop_timeoutrrrrs  zNeptuneCallback.__del__)N)N) rrrrrrrrrrrrrrSs    rc@s2eZdZdZddZddZd ddZd d ZdS) CodeCarbonCallbackzI A [`TrainerCallback`] that tracks the CO2 emission of training. cCs&tstdddl}||_d|_dS)NzWCodeCarbonCallback requires `codecarbon` to be installed. Run `pip install codecarbon`.r)r2r6r1 _codecarbontracker)rr1rrrrs zCodeCarbonCallback.__init__cKs&|jdkr"|jr"|jj|jd|_dS)N)r)r!is_local_process_zeror ZEmissionsTrackerr)rrrrrrVrrrr szCodeCarbonCallback.on_init_endNcKs|jr|jr|jjdS)N)r!r"start)rrrrrr|rVrrrrs z!CodeCarbonCallback.on_train_begincKs|jr|jr|jjdS)N)r!r"r)rrrrrrVrrrrs zCodeCarbonCallback.on_train_end)N)rrrrrr rrrrrrrs   r)rrr,r/rrr1cCsBx2|D]*}|tkrt|ddjtjdqWdd|DS)Nz is not supported, only z, z are supported.cSsg|] }t|qSr)INTEGRATION_TO_CALLBACK)r integrationrrr sz7get_reporting_integration_callbacks..)r$rrCr)rr%rrr#get_reporting_integration_callbackss   r')Drrimportlib.utilrrrrmrpathlibrr rr get_loggerrrrrrrrrrr Z get_configrrrZtrainer_callbackr r rzr r rrrrrr!r#r%r&r(r)r-r.r0r2r9r:rrSrWrrrrrr{rrrr rrr$r'rrrrsv  $     'EX~L[G