/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__/modelcard.cpython-36.pyc (26165B)
3 EgΉ@sdZddlZddlZddlZddlZddlmZddlmZddl m Z m Z m Z m Z mZddlZddlZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZm Z dd l!m"Z"dd l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0eeeeeeeeee ed Z1e0j2e3Z4Gd ddZ5dZ6dZ7dddddddddddddddZ8d d!d"d#d$d%d&d'd(d)g Z9d*d+Z:d,d-Z;d.d/Zd4d5Z?eGd6d7d7Z@d8d9ZAd:d;ZBdtjj|rtjj|t}n|}|j|tjd|dS)zKSave a model card object to the directory or file `save_directory_or_file`.zModel card saved in N)ospathisdirjoinr to_json_filer6info)r8Zsave_directory_or_fileZoutput_model_card_filer=r=r>save_pretrainedss   zModelCard.save_pretrainedc Ksddlm}|jdd}|jdd}|jdd}|jdd }|jd d}d d i} |dk r`|| d <||krr||} nDtjj|rtjj|t} n(tjj|st |r|} nt |tdd} |s||kr| j t t} | j t t} | j tt} yPt| ||| d} | | krtjd| ntjd| d| |j| } Wn"ttjfk rX|} YnXg} x8|jD],\}}t| |rht| ||| j|qhWx| D]}|j|dqWtjd| |r| |fS| SdS)a Instantiate a [`ModelCard`] from a pre-trained model model card. Parameters: pretrained_model_name_or_path: either: - a string, the *model id* of a pretrained model card hosted inside a model repo on huggingface.co. Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a user or organization name, like `dbmdz/bert-base-german-cased`. - a path to a *directory* containing a model card file saved using the [`~ModelCard.save_pretrained`] method, e.g.: `./my_model_directory/`. - a path or url to a saved model card JSON *file*, e.g.: `./my_model_directory/modelcard.json`. cache_dir: (*optional*) string: Path to a directory in which a downloaded pre-trained model card should be cached if the standard cache should not be used. kwargs: (*optional*) dict: key/value pairs with which to update the ModelCard object after loading. - The values in kwargs of any keys which are model card attributes will be used to override the loaded values. - Behavior concerning key/value pairs whose keys are *not* model card attributes is controlled by the *return_unused_kwargs* keyword parameter. proxies: (*optional*) dict, default None: A dictionary of proxy servers to use by protocol or endpoint, e.g.: {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request. find_from_standard_name: (*optional*) boolean, default True: If the pretrained_model_name_or_path ends with our standard model or config filenames, replace them with our standard modelcard filename. Can be used to directly feed a model/config url and access the colocated modelcard. return_unused_kwargs: (*optional*) bool: - If False, then this function returns just the final model card object. - If True, then this functions returns a tuple *(model card, unused_kwargs)* where *unused_kwargs* is a dictionary consisting of the key/value pairs whose keys are not model card attributes: ie the part of kwargs which has not been used to update *ModelCard* and is otherwise ignored. Examples: ```python modelcard = ModelCard.from_pretrained( "bert-base-uncased" ) # Download model card from huggingface.co and cache. modelcard = ModelCard.from_pretrained( "./test/saved_model/" ) # E.g. model card was saved using *save_pretrained('./test/saved_model/')* modelcard = ModelCard.from_pretrained("./test/saved_model/modelcard.json") modelcard = ModelCard.from_pretrained("bert-base-uncased", output_attentions=True, foo=False) ```r)!ALL_PRETRAINED_CONFIG_ARCHIVE_MAP cache_dirNproxiesfind_from_standard_nameTreturn_unused_kwargsFZ_from_pipeline file_type model_cardZusing_pipeline)filenameZmirror)rHrI user_agentzloading model card file z from cache at z Model card: )Z+transformers.models.auto.configuration_autorGr2r@rArBrCrisfiler rreplacerrrrr6rEfrom_json_fileEnvironmentErrorjsonJSONDecodeErrorr3hasattrr4append)clsZpretrained_model_name_or_pathr9rGrHrIrJrKZ from_pipelinerOZmodel_card_fileZresolved_model_card_fileZ modelcardZ to_remover:r;r=r=r>from_pretrained~sP7                 zModelCard.from_pretrainedcCs |f|S)z@Constructs a `ModelCard` from a Python dictionary of parameters.r=)rXZ json_objectr=r=r> from_dictszModelCard.from_dictc Cs6t|ddd}|j}WdQRXtj|}|f|S)z8Constructs a `ModelCard` from a json file of parameters.rzutf-8)encodingN)openreadrTloads)rXZ json_filereadertextdict_objr=r=r>rRs zModelCard.from_json_filecCs |j|jkS)N)__dict__)r8otherr=r=r>__eq__szModelCard.__eq__cCs t|jS)N)strto_json_string)r8r=r=r>__repr__szModelCard.__repr__cCstj|j}|S)z0Serializes this instance to a Python dictionary.)copydeepcopyrc)r8outputr=r=r>to_dicts zModelCard.to_dictcCstj|jddddS)z*Serializes this instance to a JSON string.T)indent sort_keys )rTdumpsrl)r8r=r=r>rgszModelCard.to_json_stringc Cs,t|ddd}|j|jWdQRXdS)z"Save this instance to a json file.wzutf-8)r\N)r]writerg)r8Zjson_file_pathwriterr=r=r>rD szModelCard.to_json_fileN)__name__ __module__ __qualname____doc__r?rF classmethodrYrZrRrerhrlrgrDr=r=r=r>r%Os  r  r%z z zMasked Language ModelingzImage ClassificationzImage SegmentationzMultiple ChoicezObject DetectionzQuestion AnsweringZ SummarizationzTable Question AnsweringzText ClassificationzCausal Language Modelingz&Sequence-to-sequence Language ModelingzToken ClassificationZ TranslationzZero Shot Classification)z fill-maskzimage-classificationzimage-segmentationzmultiple-choicezobject-detectionzquestion-answeringZ summarizationztable-question-answeringztext-classificationztext-generationztext2text-generationztoken-classification translationzzero-shot-classificationZaccuracyZbleuf1Zmatthews_correlationZpearsonrZ precisionZrecallrougeZ sacrebleuZ spearmanrcCs$|dkr gSt|tr|gS|SdS)N) isinstancerf)objr=r=r>_listify=s  rcCsF|dkr |St|tr|g}dd|D}t|dkr:|S|||<|S)NcSsg|]}|dk r|qS)Nr=).0vr=r=r> Ksz*_insert_values_as_list..r)r}rflen)metadatanamevaluesr=r=r>_insert_values_as_listFs  rcCsd|dkr iSi}xN|jD]B}|jjddtkrH|||jjdd<q|jdkr||d<qW|S)N _Zrouge1r|)keyslowerrQ METRIC_TAGS) eval_resultsresultr:r=r=r>#infer_metric_tags_from_eval_resultsRs  rcCs|dkr |S|||<|S)Nr=)rrr;r=r=r> _insert_value^srcCs ts dSddlm}t||S)NFr)Dataset)rdatasetsrr})datasetrr=r=r> is_hf_datasetes rcCs@g}x6|jD]*}t|ttfr.|t|7}q|j|qW|S)N)rr}tuplelistrW)mappingrrr=r=r>_get_mapping_valuesns rc @s:eZdZUedZeeeeefdZ ee dZ eeeeef dZ ee dZ eeeeef dZ eeeeef dZeeeeefdZeeeeefdZeeeefdZeeedZeeeefdZeeddZddZddZd d Zedd d Zedd dZdS)TrainingSummaryNtrainerc Cs~|jdkrzt rz|jdk rzt|jdkrzy6t|j}x&|jD]}|jdr>|dd|_q>WWntjj k rxYnXdS)Nrzlicense:) licenserfinetuned_fromrr tags startswithrequests exceptions HTTPError)r8rEtagr=r=r> __post_init__s     zTrainingSummary.__post_init__csd|ji}t|j}t|j}t|j}t|t|krR|dgt|t|}ddt||Dddt||D}ddt|jD}g|d<t|dkrtdkr|gSt|dkrddi}tdkrddifdd |D}x|D]\} } i} | dk r|| | d | d <| dk rV| | d | d <|| dk rV|| | d d <t|dkrg| d<x2|jD]&\} } | dj | | |j | dqvWd | krd | krd| kr|dj | qt j d| qW|gS)NrcSsi|]\}}||qSr=r=)rrrr=r=r> sz6TrainingSummary.create_model_index..cSsi|]\}}||qSr=r=)rrargr=r=r>rscSsi|]}|tkrt||qSr=)TASK_TAG_TO_NAME_MAPPING)rtaskr=r=r>rsresultsrcsg|]}D] }||fq qSr=r=)rtask_tagds_tag)dataset_mappingr=r>rsz6TrainingSummary.create_model_index..)rtyperrargsr))rrr;zLDropping the following result as it does not have all the necessary fields: ) model_namerr dataset_tags dataset_argsrziptasksr3rWrr6rE)r8metric_mappingZ model_indexZ dataset_namesrrZdataset_arg_mappingZ task_mappingZall_possibilitiesrrrZ metric_tagZ metric_namer=)rr>create_model_indexsJ        z"TrainingSummary.create_model_indexcCslt|j}i}t|d|j}t|d|j}t|d|j}t|d|j}t|dt|j }|j ||d<|S)Nlanguagerrrr)z model-index) rrrrrrrrrrr)r8rrr=r=r>create_metadatas zTrainingSummary.create_metadatacCsd}tj|jdd}t|dkr.d|d}|jdkrB|t7}n|t7}|d|jd7}|jdkrp|d 7}n|d |jd |jd 7}|j dkr|d 7}nt |j t r|d|j d7}njt |j t t frt|j dkr|d|j dd7}n4|djdd|j dd)Dd|j d*d7}|jdk rZ|d7}|djdd|jjD7}|d7}|d7}|d7}|d7}|d7}|d7}|jdk r|d7}|djdd|jjD7}|d7}n|d 7}|jdk r|d!7}|t|j7}|d7}|d"7}|d#td7}|jdkr@tr@ddl}|d$|jd7}n.|jd%krntrnddl}|d&|jd7}trddl}|d'|jd7}trddl}|d(|jd7}|S)+NF)rorz--- rz # z z'This model was trained from scratch on z'This model is a fine-tuned version of [z](https://huggingface.co/z) on zan unknown dataset.zthe z dataset.r z, cSsg|]}d|qS)zthe r=)rZdsr=r=r>rsz1TrainingSummary.to_model_card..z and the z datasets.z: It achieves the following results on the evaluation set: rpcSs$g|]\}}d|dt|qS)z- z: ) _maybe_round)rrr;r=r=r>rsz/ ## Model description More information needed z9 ## Intended uses & limitations More information needed z: ## Training and evaluation data More information needed z ## Training procedure z ### Training hyperparameters z: The following hyperparameters were used during training: cSs g|]\}}d|d|qS)z- z: r=)rrr;r=r=r>r sz More information needed z ### Training results z ### Framework versions z- Transformers z - Pytorch kerasz - TensorFlow z - Datasets z - Tokenizers r)yamldumprrsourceAUTOGENERATED_TRAINER_COMMENTAUTOGENERATED_KERAS_COMMENTrrrr}rfrrrCrr3hyperparameters eval_linesmake_markdown_tabler r#torchr! tensorflowrrr" tokenizers)r8rMrrtfrrr=r=r> to_model_cardsh         2    zTrainingSummary.to_model_cardc Csp|jdk r|jn|j} t| rZ|dks.| dkrZ| j} | d krZ|dkrJ| g}| dkrZ| jg} | dkrn|dk rn|} |dkrt|jjdrtj j |jjj  r|jjj }|dkr|jj j } x$tjD]\}}| t|kr|}qW|dkrt|jjj}|dkrdg}n4t|tr"|dkr"|dg}nd|kr6|jdt|jj\}}}t|}||||||||| | |||d S) NcsvrTpandasparquetra _name_or_pathZgenerated_from_trainer) rrrrrrrrrrrr)rrTrrra)Z train_datasetZ eval_datasetr builder_name config_namerVmodelconfigr@rArBr __class__ru TASK_MAPPINGr3rrr output_dirrr}rfrWparse_log_historystate log_history$extract_hyperparameters_from_trainer)rXrrrrrrrrrrZ one_dataset default_tagmodel_class_namerrrrrrr=r=r> from_trainer*sT       zTrainingSummary.from_trainerc CsR| dk rLt| rL| dks | dkrL| j} | d krL| dkr<| g} | dkrL| jg} | dkr`| dk r`| } |dkrt|jdrtjj|jj r|jj}|dkr|j j } x$t j D]\}}| t |kr|}qW|dkrdg}n0t|tr|dkr|dg}nd|kr|jd|dk rt|\}}}n g}t}t|}|||||||| | | |||dd S) NrrTrrrarZgenerated_from_keras_callbackr) rrrrrrrrrrrrr)rrTrrra)rrrrVrr@rArBrrrurr3rr}rfrWparse_keras_historydict"extract_hyperparameters_from_keras)rXrrZ keras_historyrrrrrrrrrrrrrrrrr=r=r> from_kerasrsX      zTrainingSummary.from_keras) NNNNNNNNN) NNNNNNNNN)rurvrwrfrrrrrrrrrrrrrrfloatrrrrrrrrryrrr=r=r=r>rxsJ    8 M <rc stdr4tds dgtfSjjd<jnfdddDg}xttdD]fddjD}t}xf|jD]Z\}}|jdrd |d d}n|dkrd |}|jd }d j dd|D}|||<qW|j |q`W|d}||fS)z Parse the `logs` of either a `tf.keras.History` object returned by `model.fit()` or an accumulated logs `dict` passed to the `PushToHubCallback`. Returns lines and logs compatible with those returned by `parse_log_history`. historyepochNcs i|]fddDqS)csg|] }|qSr=r=)rZ single_dict)log_keyr=r>rsz2parse_keras_history...r=)r)logs)rr>rsz'parse_keras_history..rcsi|]\}}||qSr=r=)rrZlog_value_list)ir=r>rsZval_Z validation_Ztrain_rrcSsg|] }|jqSr=) capitalize)rpartr=r=r>rsz'parse_keras_history..r r) rVrrrrangerr3rsplitrCrW) rlinesZ epoch_dictrkrsplitsrrr=)rrr>rs*       rcCs>d}x$|t|kr(d||kr(|d7}qW|t|krz|d8}x |dkr^d||kr^|d8}q@W|dkrvdd||fSdS||}g}d}xt|D]}d||kr||d}d||kr||j}|jdd}|jd d}|jd d} |jd d}|jd d}|jd d}||| d} xX|jD]L\} } | dkrB| | d<n.| jd} djdd| ddD}| | |<q&W|j| qWt|d}x&|dkrd||kr|d8}qW|dkr0i}x^||jD]N\}}|jdr|dd}|dkrdjdd|jdD}|||<qW|||fS||dfSdS)zd Parse the `log_history` of a Trainer to get the intermediate and final evaluation results. rZ train_runtimer Z eval_lossNzNo logZlossZ total_flosrstepZ eval_runtimeZeval_samples_per_secondZeval_steps_per_second)z Training LossZEpochZStepzValidation LossrrcSsg|] }|jqSr=)r)rrr=r=r>r sz%parse_log_history..Zeval_runtimesamples_per_secondsteps_per_secondcSsg|] }|jqSr=)r)rrr=r=r>rs)NNN)rrrrr) rrrir2r3rrCrWr)ridxZ train_logrZ training_lossrr)rrrrrrrrrr:r;Zcamel_cased_keyr=r=r>rsZ                       rcCsPddl}t}t|dr2|jdk r2|jj|d<nd|d<|jjjj|d<|S)Nr optimizerZtraining_precision) rrrVrZ get_configrZmixed_precisionZ global_policyr)rrrr=r=r>rsrrcCsRt|trJtt|jddkrJtt|jdd|krJ|d|dSt|S)N.r f)r}rrrfr)rZdecimalsr=r=r>r+s:rcCs"ddt||D}dj|dS)NcSs.g|]&\}}d|d|t|dqS)z| rr )r)rrrrr=r=r>r2sz'_regular_table_line..rz| )rrC)r col_widthsZvalues_with_spacer=r=r>_regular_table_line1srcCsdd|D}dj|dS)NcSsg|]}dd|dqS)z|:-:r=)rrrr=r=r>r7sz&_second_table_line..rz| )rC)rrr=r=r>_second_table_line6srcCs|dkst|dkrdSdd|djD}xF|D]>}x8|jD],\}}||tt|krBtt|||<qBWq4Wtt|djt|j}|tt|j7}x0|D](}|tdd|jDt|j7}qW|S)zC Create a nice Markdown table from the results in `lines`. NrrcSsi|]}tt||qSr=)rrf)rr:r=r=r>rAsz'make_markdown_table..cSsg|] }t|qSr=)r)rrr=r=r>rJsz'make_markdown_table..)rrr3rrrrr)rrliner:r;tabler=r=r>r;s  (rZ learning_ratetrain_batch_sizeeval_batch_sizeseedcsfddtD}jjtjtjgkrFjjtjkr8dnjjj|d<jjdkr^jj|d<jj dkrvjj |d<jj jjjj }||dkr||d <jj jj}||d kr||d <jj rd |d <n&djj djjdjj|d <jjj|d<jjdkr&jj|d<jjdkr@jj|d<jjdkr\jj|d<n jj|d<jjrjrd|d<njrdjj|d<jjdkrjj|d<|S)Ncsi|]}tj||qSr=)getattrr)rr)rr=r>rWsz8extract_hyperparameters_from_trainer..z multi-GPUZdistributed_typer Z num_devicesgradient_accumulation_stepsrtotal_train_batch_sizertotal_eval_batch_sizeZ AdafactorrzAdam with betas=(,z) and epsilon=lr_scheduler_typegZlr_scheduler_warmup_ratioZlr_scheduler_warmup_stepsZtraining_stepsZ num_epochsz Native AMPZmixed_precision_trainingzApex, opt level label_smoothing_factorr)_TRAINING_ARGS_KEYSrZ parallel_moderZ NOT_PARALLELZNOT_DISTRIBUTEDZ DISTRIBUTEDr;Z world_sizerrrZ adafactorZ adam_beta1Z adam_beta2Z adam_epsilonrZ warmup_ratioZ warmup_stepsZ max_stepsZnum_train_epochsZfp16Zuse_ampZuse_apexZfp16_opt_levelr)rrrrr=)rr>rVs@        &      r)r)JrxrirTr@r/Z dataclassesrpathlibrtypingrrrrrrrZhuggingface_hubr rr Zmodels.auto.modeling_autor r rrrrrrrrrZ training_argsrutilsrrrrrrrrr r!r"r#r$r get_loggerrur6r%rrrrrrrrrrrrrrrrrrrrr=r=r=r>s    4 < G     H#=