a
    AþdÃ?  ã                
   @   sr  d dl Z d dlZd dlZd dlmZmZmZmZmZm	Z	m
Z
 e  ¡ Zejdde jd ejdddd ejddd	d ejd
ddd ejdddd ejdddd ejdddd ejdddd ejdddd ejdddd ejdddd ejdddd ejdeddd ejddd d ejd!eej ej ej e¡¡¡d"d# ejd$ee	d%d# ejd&ee
d'd# ejd(edd)d# ejd*edd+d# ejd,ed-ej d.¡r¶d.nd/d ejd0ed1dd ejd2dd3d ejd4dd5d ejd6dd7d ejd8ed9d:d# ejd;eej ed<¡d=d# ejd>eej ed?¡d@d# ejdAeej edB¡dCd# ejdDeej edE¡dFd# ejdGddHd ejdIddJd ejdKddLd ejdMddNd ejdOddPd ejdQddRd ejdSddTd ejdUedVdWdXgdXdY ejdZdd[d ejd\dd]d ejd^ed_dd ejd`edTdad ejdbejdceƒ d ejdddded ejdfedgej edh¡d ejdiedjej edk¡d ejdledmej edn¡d ejdoedpej edq¡d ejdredsej edt¡d ejduedvdd ejdwddxd ejdyddzd ejd{dd|d ejd}ddRd ejd~ddd ejd€ddd ejd‚edƒd„d ejd…ed†dd ejd‡edˆdd ejd‰ddŠd ejd‹ddŒd ejdddŽd ejdddd ejd‘dd’d ejd“dd”d ejd•d–d—g ejd˜ ejd™ddšd ejd›ddœd ejdedždd ejdŸddRd d¡ ejd¢ed£ej ed¤¡d ejd¥dd¦d d¡ ejd§dd¨d d¡ ejd©edªej ed«¡d ejd¬dd­d ejd®ed¯dd ejd°ed±dd ejd²edRd³ ejd´edRd³ ejdµd¶d·egd¡ ejd¸dd¹d ejdºed»ej ed¼¡d ejd½dd¾d d¡ ejd¿edÀdd ejdÁddÂd d¡ ejdÃddÄd d¡ ejdÅddÆd d¡ ejdÇedÈdd ejdÉddÊd d¡ ejdËddÌd ejdÍedÎdd ejdÏddÐd ejdÑddÒd ejdÓddÔd ejdÕedÖdd ejd×ddØd d¡ ejdÙedÚdd ejdÛedÜdd ejdÝedÞdd ejdßedàdd ejdádâdãdd¡ ejdäedådd ejdæddRdçd¡ ejdèddéd ejdêddëd ejdìddíd d¡ ejdîddïd d¡ ejdðedñd³ ejdòddód ejdôddõd ejdöed÷død# ejdùddúd d¡ ejdûddüd d¡ dS )ýé    N)Úmodels_pathÚscript_pathÚ	data_pathÚextensions_dirÚextensions_builtin_dirÚsd_default_configÚsd_model_filez-fÚ
store_true)ÚactionÚhelpz--update-all-extensionszQlaunch.py argument: download updates for all extensions when starting the programz--skip-python-version-checkz/launch.py argument: do not check python versionz--skip-torch-cuda-testzAlaunch.py argument: do not check if CUDA is able to work properlyz--reinstall-xformerszolaunch.py argument: install the appropriate version of xformers even if you have some version already installedz--reinstall-torchzllaunch.py argument: install the appropriate version of torch even if you have some version already installedz--update-checkz0launch.py argument: check for updates at startupz--test-serverz0launch.py argument: configure server for testingz--log-startupzGlaunch.py argument: print a detailed log of what's happening at startupz--skip-prepare-environmentz4launch.py argument: skip all environment preparationz--skip-installz1launch.py argument: skip installation of packagesz--dump-sysinfoznlaunch.py argument: dump limited sysinfo file (without information about extensions, options) to disk and quitz
--loglevelz8log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG)Útyper   Údefaultz--do-not-download-clipzFdo not download CLIP model even if it's not included in the checkpointz
--data-dirz'base path where all user data is stored)r   r   r   z--configz%path to config which constructs modelz--ckptzpath to checkpoint of stable diffusion model; if specified, this checkpoint will be added to the list of checkpoints and loadedz
--ckpt-dirz3Path to directory with stable diffusion checkpointsz	--vae-dirz Path to directory with VAE filesz--gfpgan-dirzGFPGAN directoryz./src/gfpganz./GFPGANz--gfpgan-modelzGFPGAN model file namez	--no-halfz(do not switch the model to 16-bit floatsz--no-half-vaez,do not switch the VAE model to 16-bit floatsz--no-progressbar-hidingzwdo not hide progressbar in gradio UI (we hide it because it slows down ML if you have hardware acceleration in browser)z--max-batch-counté   z$maximum batch count value for the UIz--embeddings-dirZ
embeddingsz@embeddings directory for textual inversion (default: embeddings)z!--textual-inversion-templates-dirZtextual_inversion_templatesz*directory with textual inversion templatesz--hypernetwork-dirZhypernetworkszhypernetwork directoryz--localizations-dirZlocalizationszlocalizations directoryz--allow-codez(allow custom script execution from webuiz	--medvramz\enable stable diffusion model optimizations for sacrificing a little speed for low VRM usagez--medvram-sdxlz2enable --medvram optimization just for SDXL modelsz	--lowvramzaenable stable diffusion model optimizations for sacrificing a lot of speed for very low VRM usagez--lowramz?load stable diffusion checkpoint weights to VRAM instead of RAMz--always-batch-cond-uncondzdoes not do anythingz--unload-gfpganzdoes not do anything.z--precisionzevaluate at this precisionZfullZautocast)r   r   Úchoicesr   z--upcast-samplingz‰upcast sampling. No effect with --no-half. Usually produces similar results to --no-half with better performance while using less memory.z--sharezGuse share=True for gradio and make the UI accessible through their sitez--ngrokz.ngrok authtoken, alternative to gradio --sharez--ngrok-regionÚ z--ngrok-optionsz¯The options to pass to ngrok in JSON format, e.g.: '{"authtoken_from_env":true, "basic_auth":"user:password", "oauth_provider":"google", "oauth_allow_emails":"user@asdf.com"}'z"--enable-insecure-extension-accessz1enable extensions tab regardless of other optionsz--codeformer-models-pathz0Path to directory with codeformer model file(s).Z
Codeformerz--gfpgan-models-pathz,Path to directory with GFPGAN model file(s).ZGFPGANz--esrgan-models-pathz,Path to directory with ESRGAN model file(s).ZESRGANz--bsrgan-models-pathz,Path to directory with BSRGAN model file(s).ZBSRGANz--realesrgan-models-pathz0Path to directory with RealESRGAN model file(s).Z
RealESRGANz--clip-models-pathz*Path to directory with CLIP model file(s).z
--xformersz*enable xformers for cross attention layersz--force-enable-xformersz—enable xformers for cross attention layers regardless of whether the checking code thinks you can run it; do not make bug reports if this fails to workz--xformers-flash-attentionzeenable xformers with Flash Attention to improve reproducibility (supported for SD2.x or variant only)z--deepdanbooruz--opt-split-attentionzYprefer Doggettx's cross-attention layer optimization for automatic choice of optimizationz--opt-sub-quad-attentionzmprefer memory efficient sub-quadratic cross-attention layer optimization for automatic choice of optimizationz--sub-quad-q-chunk-sizezPquery chunk size for the sub-quadratic cross-attention layer optimization to usei   z--sub-quad-kv-chunk-sizezMkv chunk size for the sub-quadratic cross-attention layer optimization to usez--sub-quad-chunk-thresholdzithe percentage of VRAM threshold for the sub-quadratic cross-attention layer optimization to use chunkingz--opt-split-attention-invokeaizYprefer InvokeAI's cross-attention layer optimization for automatic choice of optimizationz--opt-split-attention-v1zYprefer older version of split attention optimization for automatic choice of optimizationz--opt-sdp-attentionzwprefer scaled dot product cross-attention layer optimization for automatic choice of optimization; requires PyTorch 2.*z--opt-sdp-no-mem-attentionzÀprefer scaled dot product cross-attention layer optimization without memory efficient attention for automatic choice of optimization, makes image generation deterministic; requires PyTorch 2.*z--disable-opt-split-attentionzQprefer no cross-attention layer optimization for automatic choice of optimizationz--disable-nan-checkzfdo not check if produced images/latent spaces have nans; useful for running without a checkpoint in CIz	--use-cpuú+z-use CPU as torch device for specified modules)Únargsr   r   r   z(--disable-model-loading-ram-optimizationzAdisable an optimization that reduces RAM use when loading a modelz--listenzRlaunch gradio with 0.0.0.0 as server name, allowing to respond to network requestsz--portzplaunch gradio with given server port, you need root/admin rights for ports < 1024, defaults to 7860 if availablez--show-negative-promptF)r
   r   r   z--ui-config-filez$filename to use for ui configurationzui-config.jsonz--hide-ui-dir-configz'hide directory configuration from webuiz--freeze-settingszdisable editing settingsz--ui-settings-filezfilename to use for ui settingszconfig.jsonz--gradio-debugz!launch gradio with --debug optionz--gradio-authzfset gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"z--gradio-auth-pathz^set gradio authentication file path ex. "/path/to/auth/file" same auth format as --gradio-authz--gradio-img2img-tool)r   r   z--gradio-inpaint-toolz--gradio-allowed-pathÚappendzKadd path to gradio's allowed_paths, make it possible to serve files from itz--opt-channelslastz8change memory type for stable diffusion to channels lastz--styles-filezfilename to use for stylesz
styles.csvz--autolaunchz>open the webui URL in the system's default browser upon launchz--themez(launches the UI with light or dark themez--use-textbox-seedzJuse textbox for seeds in UI (no up/down, but possible to input long seeds)z--disable-console-progressbarsz%do not output progressbars to consolez--enable-console-promptszAprint prompts to console when generating with txt2img and img2imgz
--vae-pathzTCheckpoint to use as VAE; setting this argument disables all settings related to VAEz--disable-safe-unpicklez2disable checking pytorch models for malicious codez--apiz_use api=True to launch the API together with the webui (use --nowebui instead for only the API)z
--api-authzgSet authentication for API like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"z	--api-logz6use api-log=True to enable logging of all API requestsz	--nowebuiz3use api=True to launch the API instead of the webuiz--ui-debug-modez%Don't load model to quickly launch UIz--device-idzbSelect the default CUDA device to use (export CUDA_VISIBLE_DEVICES=0,1,etc might be needed before)z--administratorzAdministrator rightsz--cors-allow-originszHAllowed CORS origin(s) in the form of a comma-separated list (no spaces)z--cors-allow-origins-regexzAAllowed CORS origin(s) in the form of a single regular expressionz--tls-keyfilez@Partially enables TLS, requires --tls-certfile to fully functionz--tls-certfilez?Partially enables TLS, requires --tls-keyfile to fully functionz--disable-tls-verifyZstore_falsez9When passed, enables the use of self-signed certificates.z--server-namezSets hostname of serverz--gradio-queueTz--no-gradio-queuezxDisables gradio queue; causes the webpage to use http requests instead of websockets; was the defaul in earlier versionsz--skip-version-checkz+Do not check versions of torch and xformersz--no-hashingzAdisable sha256 hashing of checkpoints to help loading performancez--no-download-sd-modelzBdon't download SD1.5 model even if no model is found in --ckpt-dirz	--subpathz8customize the subpath for gradio, use with reverse proxyz--add-stop-routezadd /_stop route to stop serverz--api-server-stopz'enable server stop/restart/kill via apiz--timeout-keep-aliveé   z"set timeout_keep_alive for uvicornz--disable-all-extensionszDprevent all extensions from running regardless of any other settingsz--disable-extra-extensionszU prevent all extensions except built-in from running regardless of any other settings)ÚargparseÚjsonÚosÚmodules.paths_internalr   r   r   r   r   r   r   ÚArgumentParserÚparserÚadd_argumentZSUPPRESSÚstrÚpathÚdirnameÚrealpathÚ__file__ÚexistsÚintÚjoinÚloadsÚdictÚlower© r'   r'   ú8/var/www/html/stable-diffusion-webui/modules/cmd_args.pyÚ<module>   sè   $*$