/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__/user.cpython-36.pyc (8453B)
3 Eg @sddlZddlmZddlmZddlmZmZddlmZm Z m Z m Z m Z ddl mZddlmZd ZGd d d eZGd d d ZeeeeefeeedddZGdddZGdddeZGdddeZGdddeZGdddeZdS)N)ArgumentParser)getpass)ListUnion)HfFolder create_repologinlogoutwhoami) HTTPError)BaseTransformersCLICommandc@seZdZeedddZdS) UserCommands)parsercCs|jddd}|jddd|jddd}|jd dd|jd d d}|jd dd|jd dd}|jdd}|jddd}|jdtdd|jdtdd|jddddd|jddddS)Nrz6Log in using the same credentials as on huggingface.co)helpcSst|S)N) LoginCommand)argsrD/usr/local/lib/python3.6/site-packages/transformers/commands/user.py!sz2UserCommands.register_subcommand..)funcr z;Find out which huggingface.co account you are logged in as.cSst|S)N) WhoamiCommand)rrrrr#sr zLog outcSst|S)N) LogoutCommand)rrrrr%srepoz_Deprecated: use `huggingface-cli` instead. Commands to interact with your huggingface.co repos.zPDeprecated: use `huggingface-cli` instead. huggingface.co repos related commandscreatezNDeprecated: use `huggingface-cli` instead. Create a new repo on huggingface.conamezYName for your model's repo. Will be namespaced under your username to build the model id.)typerz--organizationz!Optional: organization namespace.z-yz--yes store_truez"Optional: answer Yes to the prompt)actionrcSst|S)N)RepoCreateCommand)rrrrr9s) add_parser set_defaultsadd_subparsers add_argumentstr)rZ login_parserZ whoami_parserZ logout_parserZ repo_parserZrepo_subparsersZrepo_create_parserrrrregister_subcommands( z UserCommands.register_subcommandN)__name__ __module__ __qualname__ staticmethodrr&rrrrrsrc@sDeZdZdZdZdZdZdZeddZ edd Z ed d Z d S) ANSIz; Helper for en.wikipedia.org/wiki/ANSI_escape_code zzzzcCs|j||jS)N)_bold_reset)clssrrrboldFsz ANSI.boldcCs|j|j||jS)N)r,_redr-)r.r/rrrredJszANSI.redcCs|j||jS)N)_grayr-)r.r/rrrgrayNsz ANSI.grayN) r'r(r)__doc__r,r1r3r- classmethodr0r2r4rrrrr+<s  r+)rowsheadersreturncCsddt||fD}dt|j|}g}|j|j||j|jdd|Dx|D]}|j|j|q^Wdj|S)z Inspired by: - stackoverflow.com/a/8356620/593036 - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data cSsg|]}tdd|DqS)css|]}tt|VqdS)N)lenr%).0xrrr Zsz&tabulate...)max)r;colrrr Zsztabulate..z{{:{}}} cSsg|] }d|qS)-r)r;wrrrr@^s )zipr:formatappendjoin)r7r8Z col_widthsZ row_formatlinesrowrrrtabulateSs rJc@seZdZddZdS)BaseUserCommandcCs ||_dS)N)r)selfrrrr__init__eszBaseUserCommand.__init__N)r'r(r)rMrrrrrKdsrKc@seZdZddZdS)rcCsttjdtdtd}t}yt||}WnDtk rv}z(t|ttj|jjt dWYdd}~XnXt j |tdtd|dtdt j dS) NzvWARNING! `transformers-cli login` is deprecated and will be removed in v5. Please use `huggingface-cli login` instead.aY _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_| z Username: r zLogin successfulz Your token:rCzYour token has been saved to) printr+r2inputrrr responsetextexitrZ save_tokenZ path_token)rLusernamepasswordtokenerrrrunjs"  zLoginCommand.runN)r'r(r)rWrrrrrisrc@seZdZddZdS)rcCsttjdtj}|dkr,tdty2t|\}}t||r\ttjddj|WnDt k r}z(t|ttj|j j tdWYdd}~XnXdS)NzxWARNING! `transformers-cli whoami` is deprecated and will be removed in v5. Please use `huggingface-cli whoami` instead.z Not logged inzorgs: ,r ) rNr+r2r get_tokenrRr r0rGr rPrQ)rLrUuserZorgsrVrrrrWs  zWhoamiCommand.runN)r'r(r)rWrrrrrsrc@seZdZddZdS)rcCsHttjdtj}|dkr,tdttjt|tddS)NzxWARNING! `transformers-cli logout` is deprecated and will be removed in v5. Please use `huggingface-cli logout` instead.z Not logged inzSuccessfully logged out.)rNr+r2rrYrRZ delete_tokenr )rLrUrrrrWszLogoutCommand.runN)r'r(r)rWrrrrrsrc@seZdZddZdS)r c "Csttjdtj}|dkr.tdtdy*tjddgjd}ttj |j Wnt k rttdYnXy*tjddgjd}ttj |j Wn"t k rttjd YnXtd t |\}}|j jdk r|j jn|}|d |j j}td tj||j jsXtd j}|d kpF|dkpF|dksXtdtyt||j j|j jd}WnFtk r} z(t| ttj| jjtdWYdd} ~ XnXtdtdtj|tdtd|td dS)NzlWARNING! Managing repositories through transformers-cli is deprecated. Please use `huggingface-cli` instead.z Not logged inr gitz --versionzutf-8z9Looks like you do not have git installed, please install.zgit-lfszLooks like you do not have git-lfs installed, please install. You can install from https://git-lfs.github.com/. Then run `git lfs install` (you only have to do this once)./zYou are about to create zProceed? [Y/n] yyesZAbort)r organizationz Your repo now lives at:z zK You can clone it locally with the command below, and commit/push as usual.z git clone )rNr+r2rrYrR subprocess check_outputdecoder4stripFileNotFoundErrorr rr`rr0r_rOlowerrr rPrQ) rLrUstdoutrZ_ namespaceZ full_namechoiceurlrVrrrrWsP   zRepoCreateCommand.runN)r'r(r)rWrrrrr sr )raargparserrtypingrrZhuggingface_hub.hf_apirrrr r Zrequests.exceptionsr r\r ZUPLOAD_MAX_FILESrr+r%intrJrKrrrr rrrrs    &!