/usr/local/lib/python3.6/site-packages/transformers/commands/__pycache__
NameSizeModeActions
add_new_model.cpython-36.pyc65310644editdlrm
add_new_model_like.cpython-36.pyc426880644editdlrm
convert.cpython-36.pyc49430644editdlrm
download.cpython-36.pyc16600644editdlrm
env.cpython-36.pyc26050644editdlrm
lfs.cpython-36.pyc72440644editdlrm
run.cpython-36.pyc33720644editdlrm
serving.cpython-36.pyc67480644editdlrm
train.cpython-36.pyc45890644editdlrm
transformers_cli.cpython-36.pyc12610644editdlrm
user.cpython-36.pyc84530644editdlrm
__init__.cpython-36.pyc7940644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/transformers/commands/__pycache__/run.cpython-36.pyc (3372B)
3 Eg@spddlmZddlmZmZmZmZddlmZddl m Z ej e Z eddd Zd d ZGd d d e ZdS))ArgumentParser)PipelinePipelineDataFormatget_supported_taskspipeline)logging)BaseTransformersCLICommand)pathcCs@|sdSxtjD]}|j|r|SqWtd|dtjdS)Npipez4Unable to determine file format from file extension z-. Please provide the format through --format )rSUPPORTED_FORMATSendswith Exception)r extrC/usr/local/lib/python3.6/site-packages/transformers/commands/run.pytry_infer_format_from_exts  rcCsrt|j|jr|jnd|j|j|jd}|jdkr:t|jn|j}t j ||j |j|j rZ|j n|j |jd}t||S)N)taskmodelconfig tokenizerdeviceinfer)formatZ output_pathZ input_pathcolumn overwrite)rrrrrrrrinputrZfrom_stroutputrZdefault_input_namesr RunCommand)argsnlprreaderrrrrun_command_factory's  r#c@s6eZdZeedddZeedddZddZ d S) r)r!r"cCs||_||_dS)N)_nlp_reader)selfr!r"rrr__init__;szRunCommand.__init__)parsercCs|jddd}|jdtdd|jdtdd |jd td d |jd td d |jdtdd |jdtdd |jdtdd |jdtdtjdd|jdtd!dd|jdddd|jtd dS)"NrunzRun a pipeline through the CLI)helpz--taskz Task to run)choicesr*z--inputz%Path to the file to use for inference)typer*z--outputz9Path to the file that will be used post to write results.z--modelz)Name or path to the model to instantiate.z--configz2Name or path to the model's config to instantiate.z --tokenizerz?Name of the tokenizer to use. (default: same as the model name)z--columnzXName of the column to use as input. (For multi columns input as QA use column1,columns2)z--formatrzInput format to read from)r,defaultr+r*z--devicer zSIndicate the device to run onto, -1 indicates CPU, >= 0 indicates GPU (default: -1))r,r-r*z --overwrite store_truez"Allow overwriting the output file.)actionr*)func) add_parser add_argumentrstrrr int set_defaultsr#)r(Z run_parserrrrregister_subcommand?s2 zRunCommand.register_subcommandcCs|jg}}xF|jD]<}|jjr*|f|n||}t|trH|j|q||7}qW|jjrz|jj|}tj d|n |jj |dS)NzCCurrent pipeline requires output to be in binary format, saving at ) r$r%Zis_multi_columns isinstancedictappendZ binary_outputZ save_binaryloggerwarningsave)r&r!outputsentryrZ binary_pathrrrr)_s      zRunCommand.runN) __name__ __module__ __qualname__rrr' staticmethodrr7r)rrrrr:srN)argparserZ pipelinesrrrrutilsrr get_loggerr@r;r4rr#rrrrrs