/usr/local/lib/python3.6/site-packages/datasets/commands/__pycache__
NameSizeModeActions
convert.cpython-36.pyc61750644editdlrm
datasets_cli.cpython-36.pyc15490644editdlrm
dummy_data.cpython-36.pyc157450644editdlrm
env.cpython-36.pyc16880644editdlrm
run_beam.cpython-36.pyc45890644editdlrm
test.cpython-36.pyc51220644editdlrm
__init__.cpython-36.pyc7780644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/datasets/commands/__pycache__/convert.cpython-36.pyc (6175B)
3 <%Eg @sddlZddlZddlZddlmZmZddlmZddlm Z dZ dZ ddd d d d gZ d(d)d*d+d,d-d.d/d0d1d2g Z ed#d$d%ZGd&d'd'eZdS)3N)ArgumentParser Namespace)BaseDatasetsCLICommand) get_loggerz><<<<<<< This should probably be modified because it mentions: z======= >>>>>>> ZTextEncoderConfigZByteTextEncoderZSubwordTextEncoderZencoder_configZmaybe_build_from_corpusZ manual_dir tfds\.coredatasetstf\.io\.gfile\.GFileopen tf\.([\w\d]+)datasets.Value('\1')tfds\.features\.Text\(\)datasets.Value('string')tfds\.features\.Text\(datasets.Value('string'),+features\s*=\s*tfds.features.FeaturesDict\(features=datasets.Features(tfds\.features\.FeaturesDict\(dict(The TensorFlow Datasets AuthorsDThe TensorFlow Datasets Authors and the HuggingFace Datasets Authorstfds\. datasets.dl_manager\.manual_dirself.config.data_dirself\.builder_config self.config)argscCst|j|jS)zz Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint. Returns: ConvertCommand )ConvertCommand tfds_pathdatasets_directory)rr C/usr/local/lib/python3.6/site-packages/datasets/commands/convert.pyconvert_command_factory*sr"c@s6eZdZeedddZeedddZddZd S) r)parsercCsB|jddd}|jdtddd|jdtdd d|jtd d S) z Register this command to argparse so it's available for the datasets-cli Args: parser: Root parser to register command-specific arguments convertzHConvert a TensorFlow Datasets dataset to a HuggingFace Datasets dataset.)helpz --tfds_pathTzQPath to a TensorFlow Datasets folder to convert or a single tfds file to convert.)typerequiredr%z--datasets_directoryz(Path to the HuggingFace Datasets folder.)funcN) add_parser add_argumentstr set_defaultsr")r#Z train_parserr r r!register_subcommand4sz"ConvertCommand.register_subcommand)rrcGstd|_||_||_dS)Nzdatasets-cli/converting)r_logger _tfds_path_datasets_directory)selfrrrr r r!__init__Ks zConvertCommand.__init__csjtjj|jrtjj|j}n&tjj|jrWdkrtjd}|jdd|jd jd!Dd"|jd d#ksd$ksdkrtd%j d&ksd'krd} | jqPW| sd(|krh|jdd}tjj ||tjj |} tj!dd)|j j d*|j"fd+d,|Dn |j| |r|j| t| d-d d } | j#| WdQRX|j j d.| qWx~|D]v}yDtjj |}||jdd}|j j d/|d|t$j%||Wn*t&k r4|j j'd0|d1YnXqW|rfx"|D]}|j j(d2|d3qHWdS)4NzA--tfds_path is neither a directory nor a file. Please check path.zConverting datasets from z to zLooking at file r2_testz.pyz Skipping filezutf-8)encodingFz!import tensorflow.compat.v2 as tfz @tfds.corez builder=selfz-import tensorflow_datasets.public_api as tfdszimport datasets zimport tensorflowzfrom absl import loggingzfrom datasets import logging getLoggerrc3s|]}|kVqdS)Nr ).0Z expression)out_liner r! sz%ConvertCommand.run..Tcs|kS)Nr )e)r8r r!sz$ConvertCommand.run.. Ztensorflow_datasetsz/from\stensorflow_datasets.*import\s([^\.\r\n]+)css|]}|jVqdS)N)strip)r7impr r r!r9s,zfrom . import ztf.ztfds.zError converting ZGeneratorBasedBuilderZBeamBasedBuilderZwmt)exist_okzAdding directory csi|] }|qSr r )r7r>) output_dirr r! sz&ConvertCommand.run..wz Converted in zMoving z#Cannot find destination folder for z. Please copy manually.z!You need to manually update file z4 to remove configurations using 'TextEncoderConfig'.))ospathisdirr/abspathisfiledirname ValueErrorr0r.infolistdirbasenamejoinr readlinesreplaceany TO_HIGHLIGHTlistfilterappendHIGHLIGHT_MESSAGE_PREr+HIGHLIGHT_MESSAGE_POST TO_CONVERTresubmatchextendgroupsplitr=makedirsupdate writelinesshutilcopyKeyErrorerrorwarning)r1Z abs_tfds_pathZabs_datasets_pathZ utils_filesZwith_manual_updateZimports_to_builder_mapZ file_namesf_nameZ input_fileZ output_fileflinesZ out_linesZ is_builderZneeds_manual_updateZ tfds_importslineZ to_removepattern replacementr\dir_nameZ utils_fileZ dest_folder file_pathr )r8rBr!runQs .                    zConvertCommand.runN) __name__ __module__ __qualname__ staticmethodrr-r+r2rpr r r r!r3sr)rr)rr )r r )r r )rr)rr)rr)rr)rr)rr)rr)rErZrcargparserrZdatasets.commandsrZdatasets.utils.loggingrrWrXrSrYr"rr r r r!s4