├── .devcontainer └── devcontainer.json ├── .dockerignore ├── .github ├── CODEOWNERS ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── feature_request.yml ├── dependabot.yml └── workflows │ ├── black.yml │ ├── docker_build_tag.yml │ ├── docs.yml │ ├── frontend_build.yml │ ├── inactive_issues.yml │ ├── manager_build.yml │ └── ruff.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .pylintrc ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── License ├── README.md ├── api ├── __init__.py ├── app.py ├── routes │ ├── autofill.py │ ├── general.py │ ├── generate.py │ ├── hardware.py │ ├── models.py │ ├── outputs.py │ ├── settings.py │ ├── static.py │ ├── test.py │ └── ws.py └── websockets │ ├── __init__.py │ ├── data.py │ ├── manager.py │ └── notification.py ├── bot.py ├── bot ├── __init__.py ├── bot.py ├── bot_model_manager.py ├── config.py ├── core.py ├── hardware.py ├── helper.py ├── image2image.py ├── listeners.py ├── models.py ├── shared.py └── txt2img.py ├── core ├── aitemplate │ ├── LICENSE │ ├── compile.py │ ├── config.py │ └── src │ │ ├── common.py │ │ ├── compile_lib │ │ ├── clip.py │ │ ├── unet.py │ │ └── vae.py │ │ └── modeling │ │ ├── attention.py │ │ ├── clip.py │ │ ├── embeddings.py │ │ ├── mapping.py │ │ ├── resnet.py │ │ ├── unet_2d_condition.py │ │ ├── unet_blocks.py │ │ └── vae.py ├── config │ ├── __init__.py │ ├── _config.py │ ├── api_settings.py │ ├── bot_settings.py │ ├── default_settings.py │ ├── flags_settings.py │ ├── frontend_settings.py │ ├── interrogator_settings.py │ └── samplers │ │ ├── kdiffusion_sampler_config.py │ │ └── sampler_config.py ├── errors.py ├── extra │ └── cloudflare_r2.py ├── files.py ├── flags.py ├── functions.py ├── gpu.py ├── inference │ ├── adetailer │ │ └── adetailer.py │ ├── ait │ │ ├── __init__.py │ │ ├── aitemplate.py │ │ └── pipeline.py │ ├── base_model.py │ ├── esrgan │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── __init__.py │ │ ├── real_esrgan.py │ │ ├── upscale.py │ │ └── utils │ │ │ ├── architecture │ │ │ ├── RRDB.py │ │ │ ├── SPSR.py │ │ │ ├── SRVGG.py │ │ │ ├── __index__.py │ │ │ └── block.py │ │ │ ├── dataops.py │ │ │ └── net_interp.py │ ├── functions.py │ ├── injectables │ │ ├── __init__.py │ │ ├── lora.py │ │ ├── lycoris.py │ │ ├── textual_inversion.py │ │ └── utils.py │ ├── onnx │ │ ├── __init__.py │ │ └── pipeline.py │ ├── pytorch │ │ ├── __init__.py │ │ ├── pipeline.py │ │ └── pytorch.py │ ├── sdxl │ │ ├── __init__.py │ │ ├── pipeline.py │ │ └── sdxl.py │ └── utilities │ │ ├── __init__.py │ │ ├── aitemplate.py │ │ ├── anisotropic.py │ │ ├── cfg.py │ │ ├── controlnet.py │ │ ├── kohya_hires.py │ │ ├── latents.py │ │ ├── lwp.py │ │ ├── philox.py │ │ ├── prompt_expansion │ │ ├── __init__.py │ │ ├── downloader.py │ │ └── expand.py │ │ ├── random.py │ │ ├── sag │ │ ├── __init__.py │ │ ├── cross_attn.py │ │ ├── diffusers.py │ │ ├── kdiff.py │ │ └── sag_utils.py │ │ ├── scalecrafter.py │ │ ├── scheduling.py │ │ └── vae.py ├── inference_callbacks.py ├── install_requirements.py ├── interrogation │ ├── base_interrogator.py │ ├── clip.py │ ├── deepdanbooru.py │ ├── flamingo.py │ └── models │ │ └── deepdanbooru_model.py ├── logger │ └── websocket_logging.py ├── optimizations │ ├── __init__.py │ ├── attn │ │ ├── __init__.py │ │ ├── flash_attention.py │ │ ├── multihead_attention.py │ │ └── sub_quadratic.py │ ├── autocast_utils.py │ ├── compile │ │ ├── stable_fast.py │ │ └── trace_utils.py │ ├── context_manager.py │ ├── dtype.py │ ├── hypertile.py │ ├── offload.py │ ├── pytorch_optimizations.py │ └── upcast.py ├── png_metadata.py ├── queue.py ├── scheduling │ ├── __init__.py │ ├── adapter │ │ ├── k_adapter.py │ │ └── unipc_adapter.py │ ├── custom │ │ ├── dpmpp_2m.py │ │ ├── heunpp.py │ │ ├── lcm.py │ │ ├── restart.py │ │ └── sasolver.py │ ├── denoiser.py │ ├── hijack.py │ ├── scheduling.py │ ├── sigmas.py │ ├── types.py │ └── unipc │ │ ├── __init__.py │ │ ├── noise_scheduler.py │ │ ├── unipc.py │ │ └── utility.py ├── shared.py ├── shared_dependent.py ├── thread.py ├── types.py └── utils.py ├── data ├── autofill │ └── quality.txt ├── lycoris │ └── put lycoris here.txt ├── scalecrafter │ ├── assets │ │ ├── dilate_settings │ │ │ ├── all_valid_convs.txt │ │ │ ├── sd1.5_1024x1024.txt │ │ │ ├── sd1.5_1280x1280.txt │ │ │ ├── sd1.5_2048x1024.txt │ │ │ ├── sd1.5_2048x2048.txt │ │ │ ├── sd2.1_1024x1024.txt │ │ │ ├── sd2.1_1280x1280.txt │ │ │ ├── sd2.1_2048x1024.txt │ │ │ ├── sd2.1_2048x2048.txt │ │ │ ├── sdxl_2048x2048.txt │ │ │ ├── sdxl_2560x2560.txt │ │ │ ├── sdxl_4096x2048.txt │ │ │ └── sdxl_4096x4096.txt │ │ ├── disperse_settings │ │ │ ├── sd1.5_2048x2048.txt │ │ │ ├── sd2.1_2048x2048.txt │ │ │ └── sdxl_4096x4096.txt │ │ ├── inflate_settings │ │ │ ├── sd1.5_2048x2048.txt │ │ │ └── sdxl_4096x4096.txt │ │ └── ndcfg_dilate_settings │ │ │ ├── sd1.5_2048x1024.txt │ │ │ ├── sd1.5_2048x2048.txt │ │ │ ├── sd2.1_2048x1024.txt │ │ │ ├── sd2.1_2048x2048.txt │ │ │ ├── sdxl_4096x2048.txt │ │ │ └── sdxl_4096x4096.txt │ ├── configs │ │ ├── sd1.5_1024x1024.yaml │ │ ├── sd1.5_1280x1280.yaml │ │ ├── sd1.5_2048x1024.yaml │ │ ├── sd1.5_2048x2048.yaml │ │ ├── sd1.5_2048x2048_disperse.yaml │ │ ├── sd2.1_1024x1024.yaml │ │ ├── sd2.1_1280x1280.yaml │ │ ├── sd2.1_2048x1024.yaml │ │ ├── sd2.1_2048x2048.yaml │ │ ├── sd2.1_2048x2048_disperse.yaml │ │ ├── sdxl_2048x2048.yaml │ │ ├── sdxl_2560x2560.yaml │ │ ├── sdxl_4096x2048.yaml │ │ ├── sdxl_4096x4096.yaml │ │ └── sdxl_4096x4096_disperse.yaml │ ├── disperse │ │ ├── bilinear_upsample_symbolic.m │ │ ├── conv2d.m │ │ ├── kernel_disperse.m │ │ └── sym_kernel.m │ └── transforms │ │ ├── R20to1.mat │ │ ├── R20to1_new.mat │ │ └── R2to1.mat ├── themes │ ├── dark.json │ ├── dark_flat.json │ ├── light.json │ └── light_flat.json └── vae │ └── put vae here.txt ├── docker-compose.yml ├── docker ├── ait-no-mount.docker-compose.yml ├── ait.docker-compose.yml ├── ait │ └── dockerfile ├── cuda-no-mount.docker-compose.yml ├── cuda.docker-compose.yml └── cuda │ └── dockerfile ├── docs ├── .vitepress │ ├── config.mts │ └── theme │ │ ├── index.ts │ │ └── style.css ├── api │ └── index.md ├── basics │ ├── aitemplate.md │ ├── autoload.md │ ├── lora.md │ ├── models.md │ └── textual-inversion.md ├── bot │ ├── commands.md │ └── setup.md ├── changelog.md ├── developers │ ├── api.md │ ├── documentation.md │ ├── frontend.md │ └── testing.md ├── getting-started │ └── introduction.md ├── guides │ ├── first-image.md │ ├── highres-fix.md │ └── test.vue ├── index.md ├── installation │ ├── docker.md │ ├── linux.md │ ├── old.md │ ├── stability-matrix.md │ ├── vast.md │ ├── windows.md │ ├── wsl.md │ └── xformers.md ├── public │ ├── favicon.ico │ ├── volta-og-image.webp │ └── volta-rounded.webp ├── settings │ ├── reproducibility.md │ └── settings.md ├── static │ ├── basics │ │ ├── aitemplate-accelerate.webp │ │ ├── aitemplate-load.webp │ │ ├── hf_download.webp │ │ ├── lora-load.webp │ │ ├── lora.webp │ │ ├── textual-inversion-download.webp │ │ ├── textual-inversion-load.webp │ │ └── textual-inversion-usage.webp │ ├── frontend │ │ ├── frontend-browser-annotated.webp │ │ ├── frontend-browser.webp │ │ ├── frontend-img2img.webp │ │ ├── frontend-txt2img.webp │ │ ├── model-downloader │ │ │ ├── civitai-landing.webp │ │ │ └── civitai-popup.webp │ │ └── volta-rounded.svg │ ├── getting-started │ │ ├── download-model-1.webp │ │ ├── download-model-2.webp │ │ ├── download-model.webp │ │ ├── download-page.webp │ │ ├── final.webp │ │ ├── gen-settings.webp │ │ ├── generate-button.webp │ │ ├── highres │ │ │ ├── highres-base.webp │ │ │ ├── highres-diagram.webp │ │ │ ├── image.webp │ │ │ ├── latent.webp │ │ │ └── without.webp │ │ ├── left-bar-download.webp │ │ ├── load-model-modal.webp │ │ ├── loaded-model.webp │ │ ├── model-loader-button.webp │ │ ├── models.webp │ │ ├── progress.webp │ │ ├── select_model.webp │ │ └── txt2img-button.webp │ ├── installation │ │ ├── manager-github-release.webp │ │ ├── stability-matrix-installing-volta.webp │ │ ├── stability-matrix-website.webp │ │ ├── vastai-instances.webp │ │ └── vastai-search.webp │ ├── settings │ │ └── reproducibility │ │ │ ├── quant_on.webp │ │ │ ├── sgm_off.webp │ │ │ └── sgm_on.webp │ └── voltaml.svg ├── todo.md ├── troubleshooting │ ├── docker.md │ ├── linux.md │ └── windows.md └── webui │ ├── download.md │ ├── imagebrowser.md │ ├── img2img.md │ └── themes.md ├── example.env ├── frontend ├── .eslintrc.cjs ├── .gitignore ├── .prettierrc.json ├── .vscode │ └── extensions.json ├── README.md ├── dist │ ├── assets │ │ ├── 404View.js │ │ ├── AboutView.js │ │ ├── AccelerateView.js │ │ ├── CloudUpload.js │ │ ├── DescriptionsItem.js │ │ ├── ExtraView.js │ │ ├── GenerateSection.vue_vue_type_script_setup_true_lang.js │ │ ├── Image2ImageView.js │ │ ├── ImageBrowserView.css │ │ ├── ImageBrowserView.js │ │ ├── ImageOutput.vue_vue_type_script_setup_true_lang.js │ │ ├── ImageProcessingView.js │ │ ├── ImageUpload.js │ │ ├── InputNumber.js │ │ ├── ModelPopup.vue_vue_type_script_setup_true_lang.js │ │ ├── ModelsView.js │ │ ├── SendOutputTo.vue_vue_type_script_setup_true_lang.js │ │ ├── Settings.js │ │ ├── SettingsView.js │ │ ├── Slider.js │ │ ├── Switch.js │ │ ├── TaggerView.css │ │ ├── TaggerView.js │ │ ├── TestView.js │ │ ├── TextToImageView.js │ │ ├── TrashBin.js │ │ ├── Upscale.vue_vue_type_script_setup_true_lang.js │ │ ├── clock.js │ │ ├── index.css │ │ ├── index.js │ │ └── v4.js │ ├── favicon.ico │ └── index.html ├── env.d.ts ├── index.html ├── package.json ├── public │ └── favicon.ico ├── src │ ├── App.vue │ ├── Content.vue │ ├── assets │ │ ├── 2img.css │ │ └── main.css │ ├── civitai.ts │ ├── clock.ts │ ├── components │ │ ├── CollapsibleNavbar.vue │ │ ├── DownloadDelete.vue │ │ ├── GenerateSection.vue │ │ ├── ImageOutput.vue │ │ ├── ImageUpload.vue │ │ ├── InitHandler.vue │ │ ├── LogDrawer.vue │ │ ├── OutputStats.vue │ │ ├── PerformanceDrawer.vue │ │ ├── SecretsHandler.vue │ │ ├── SendOutputTo.vue │ │ ├── TopBar.vue │ │ ├── WIP.vue │ │ ├── accelerate │ │ │ ├── AITemplateDynamicAccelerate.vue │ │ │ ├── ONNXAccelerate.vue │ │ │ └── index.ts │ │ ├── extra │ │ │ ├── AutofillManager.vue │ │ │ ├── DependencyManager.vue │ │ │ └── index.ts │ │ ├── generate │ │ │ ├── ADetailer.vue │ │ │ ├── BatchSizeInput.vue │ │ │ ├── CFGScaleInput.vue │ │ │ ├── DeepShrink.vue │ │ │ ├── DimensionsInput.vue │ │ │ ├── HighResFix.vue │ │ │ ├── HighResFixTabs.vue │ │ │ ├── Prompt.vue │ │ │ ├── ResizeFromDimensionsInput.vue │ │ │ ├── Restoration.vue │ │ │ ├── SAGInput.vue │ │ │ ├── SamplerPicker.vue │ │ │ ├── Scalecrafter.vue │ │ │ ├── Upscale.vue │ │ │ ├── XLRefiner.vue │ │ │ └── index.ts │ │ ├── imageProcessing │ │ │ ├── ESRGAN.vue │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── inference │ │ │ ├── ControlNet.vue │ │ │ ├── Img2Img.vue │ │ │ ├── Inpainting.vue │ │ │ ├── Txt2Img.vue │ │ │ └── index.ts │ │ ├── models │ │ │ ├── CivitAIDownload.vue │ │ │ ├── CivitAIModelImage.vue │ │ │ ├── HuggingfaceDownload.vue │ │ │ ├── ModelConvert.vue │ │ │ ├── ModelManager.vue │ │ │ ├── ModelPopup.vue │ │ │ └── index.ts │ │ └── settings │ │ │ ├── AutoloadSettings.vue │ │ │ ├── BotSettings.vue │ │ │ ├── FilesSettings.vue │ │ │ ├── FrontendSettings.vue │ │ │ ├── GeneralSettings.vue │ │ │ ├── NSFWSettings.vue │ │ │ ├── OptimizationSettings.vue │ │ │ ├── ReproducibilitySettings.vue │ │ │ ├── SettingsDiffResolver.vue │ │ │ ├── UISettings.vue │ │ │ ├── defaultSettings │ │ │ ├── ControlNetSettings.vue │ │ │ ├── ImageBrowserSettings.vue │ │ │ ├── ImageToImageSettings.vue │ │ │ ├── InpaintingSettings.vue │ │ │ ├── TextToImageSettings.vue │ │ │ ├── ThemeSettings.vue │ │ │ └── index.ts │ │ │ └── index.ts │ ├── core │ │ └── interfaces.ts │ ├── env.ts │ ├── functions.ts │ ├── helper │ │ ├── capabilities.ts │ │ ├── index.ts │ │ └── mediaQueries.ts │ ├── injectionKeys.ts │ ├── main.ts │ ├── router │ │ ├── index.ts │ │ └── router-container.vue │ ├── settings.ts │ ├── settingsTypes │ │ ├── aitemplate.ts │ │ ├── api.ts │ │ ├── bot.ts │ │ ├── controlnet.ts │ │ ├── flags │ │ │ ├── adetailer.ts │ │ │ ├── deepshrink.ts │ │ │ ├── highres.ts │ │ │ ├── index.ts │ │ │ ├── refiner.ts │ │ │ ├── scalecraft.ts │ │ │ ├── sdxl.ts │ │ │ └── upscale.ts │ │ ├── frontend.ts │ │ ├── img2img.ts │ │ ├── index.ts │ │ ├── inpainting.ts │ │ ├── onnx.ts │ │ ├── quantization.ts │ │ ├── sampler.ts │ │ ├── sigma.ts │ │ ├── tagger.ts │ │ ├── txt2img.ts │ │ └── upscale.ts │ ├── store │ │ ├── settings.ts │ │ ├── state.ts │ │ └── websockets.ts │ ├── types.ts │ ├── views │ │ ├── 404View.vue │ │ ├── AboutView.vue │ │ ├── AccelerateView.vue │ │ ├── ExtraView.vue │ │ ├── Image2ImageView.vue │ │ ├── ImageBrowserView.vue │ │ ├── ImageProcessingView.vue │ │ ├── ModelsView.vue │ │ ├── SettingsView.vue │ │ ├── TaggerView.vue │ │ ├── TestView.vue │ │ └── TextToImageView.vue │ └── websockets │ │ └── websockets.ts ├── tsconfig.config.json ├── tsconfig.json ├── vite.config.ts └── yarn.lock ├── libs ├── hardware-accel-test.cpp └── hardware-accel-test.dll ├── main.py ├── manager ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── build.rs └── src │ ├── apt.rs │ ├── debug.rs │ ├── environ.rs │ ├── git │ ├── checkout.rs │ ├── clone.rs │ ├── git.rs │ └── mod.rs │ ├── install.rs │ ├── main.rs │ ├── targets │ ├── mod.rs │ ├── ubuntu.rs │ └── windows.rs │ └── utils │ ├── aitemplate.rs │ ├── mod.rs │ ├── nvidia.rs │ ├── python.rs │ └── shell.rs ├── package.json ├── pyproject.toml ├── pyrightconfig.json ├── pytest.ini ├── requirements ├── api.txt ├── bot.txt ├── dev.txt ├── interrogation.txt ├── onnx.txt ├── pytorch.txt ├── sfast.txt └── tests.txt ├── scripts ├── convert_diffusers_to_sd.py ├── parse_safetensors_keys.py ├── start-windows.bat ├── start.sh ├── test-docker-gpu-availability.sh └── wsl-install.sh ├── start.sh ├── static ├── huggingface-models.json ├── schema.json ├── segmind.svg ├── volta-dark-background.svg ├── volta-light-background.svg ├── volta-rounded.ico ├── volta-rounded.svg ├── volta-rounded.webp ├── volta.webp └── voltaml.svg ├── tests ├── const.py ├── functions.py ├── inference │ ├── test_ait.py │ ├── test_pytorch.py │ └── test_pytorch_sdxl.py ├── test_main.py └── test_utils.py └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | # Git & Configuration files 2 | .git/ 3 | .github/ 4 | .vscode/ 5 | .env 6 | .gitignore 7 | .pylintrc 8 | pyproject.toml 9 | 10 | # User generated files 11 | /converted 12 | /data 13 | !/data/themes/dark.json 14 | !/data/themes/dark_flat.json 15 | !/data/themes/light.json 16 | !/data/themes/light_flat.json 17 | !/data/scalecrafter 18 | /engine 19 | /onnx 20 | /traced_unet 21 | 22 | # Documentation 23 | /docs 24 | yarn.lock 25 | /node_modules 26 | 27 | # Frontend 28 | frontend/dist/ 29 | 30 | # Python 31 | /venv 32 | 33 | # Docker 34 | .dockerignore 35 | docker-compose.yml 36 | test.docker-compose.yml 37 | .devcontainer 38 | 39 | # Jupyter 40 | *.ipynb 41 | 42 | # Installer 43 | /installer 44 | 45 | # Other 46 | **/**.pyc 47 | poetry.lock 48 | .pytest_cache 49 | .coverage 50 | /.ruff_cache 51 | voltaml-manager 52 | voltaml-manager.exe 53 | 54 | # Manager 55 | /manager 56 | 57 | # Local AITemplate 58 | /AITemplate -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Most of the stuff is Staxs 2 | # core is somewhat general 3 | * @Stax124 4 | /core/ @Stax124 @gabe56f 5 | /frontend/ @Stax124 @gabe56f 6 | 7 | # Stax-specific 8 | /core/* @Stax124 9 | /core/inference/esrgan/ @Stax124 10 | 11 | # Gabe-specific stuff 12 | /libs/ @gabe56f 13 | /core/scheduling/ @gabe56f 14 | /core/optimizations/ @gabe56f 15 | /core/inference/injectables/ @gabe56f 16 | /core/inference/utilities/kohya_hires.py @gabe56f 17 | /core/inference/utilities/anisotropic.py @gabe56f 18 | /core/inference/utilities/cfg.py @gabe56f 19 | /core/inference/utilities/sag/ @gabe56f 20 | /core/inference/utilities/prompt_expansion/ @gabe56f 21 | /core/inference/onnx/ @gabe56f -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: stax124 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | target-branch: "experimental" 8 | labels: 9 | - "python dependencies" 10 | assignees: 11 | - "Stax124" 12 | open-pull-requests-limit: 0 13 | - package-ecosystem: "npm" 14 | directory: "/frontend" 15 | schedule: 16 | interval: "daily" 17 | target-branch: "experimental" 18 | labels: 19 | - "javascript dependencies" 20 | assignees: 21 | - "Stax124" 22 | open-pull-requests-limit: 0 23 | -------------------------------------------------------------------------------- /.github/workflows/black.yml: -------------------------------------------------------------------------------- 1 | name: Black 2 | 3 | on: 4 | push: 5 | paths: 6 | - "**.py" 7 | - ".github/workflows/**" 8 | pull_request: 9 | paths: 10 | - "**.py" 11 | - ".github/workflows/**" 12 | 13 | jobs: 14 | lint: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | - uses: psf/black@stable 19 | -------------------------------------------------------------------------------- /.github/workflows/docker_build_tag.yml: -------------------------------------------------------------------------------- 1 | name: Docker Build on Tag Push 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | - name: Login to Docker Hub 15 | uses: docker/login-action@v3 16 | with: 17 | username: ${{ secrets.DOCKERHUB_USERNAME }} 18 | password: ${{ secrets.DOCKERHUB_TOKEN }} 19 | - name: Set up Docker Buildx 20 | uses: docker/setup-buildx-action@v3 21 | - name: Build and push 22 | uses: docker/build-push-action@v5 23 | with: 24 | context: . 25 | file: docker/cuda/dockerfile 26 | push: true 27 | tags: ${{ secrets.DOCKERHUB_USERNAME }}/volta:${{ github.ref_name }}-cuda 28 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - experimental 7 | paths: 8 | - "**.md" 9 | - "docs/.vitepress/*" 10 | 11 | jobs: 12 | deploy: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: 16 19 | cache: yarn 20 | - run: yarn install 21 | 22 | - name: Build 23 | run: yarn docs:build 24 | 25 | - name: Deploy 26 | uses: peaceiris/actions-gh-pages@v3 27 | with: 28 | github_token: ${{ secrets.GITHUB_TOKEN }} 29 | publish_dir: docs/.vitepress/dist 30 | -------------------------------------------------------------------------------- /.github/workflows/frontend_build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 3 | 4 | name: Frontend Build Test 5 | 6 | on: 7 | push: 8 | branches: [main, experimental] 9 | paths: 10 | - "frontend/**" 11 | - ".github/workflows/*.yml" 12 | pull_request: 13 | branches: [main, experimental] 14 | 15 | jobs: 16 | build: 17 | name: Build frontend 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v3 21 | 22 | - name: Set Node.js 18.x 23 | uses: actions/setup-node@v3 24 | with: 25 | node-version: 18.x 26 | 27 | - name: Run install 28 | uses: borales/actions-yarn@v4 29 | with: 30 | cmd: install 31 | dir: "frontend" 32 | - name: Build production bundle 33 | uses: borales/actions-yarn@v4 34 | with: 35 | cmd: build 36 | dir: "frontend" 37 | -------------------------------------------------------------------------------- /.github/workflows/inactive_issues.yml: -------------------------------------------------------------------------------- 1 | name: Close inactive issues 2 | on: 3 | schedule: 4 | - cron: "30 1 * * *" 5 | 6 | jobs: 7 | close-issues: 8 | runs-on: ubuntu-latest 9 | permissions: 10 | issues: write 11 | pull-requests: write 12 | steps: 13 | - uses: actions/stale@v5 14 | with: 15 | days-before-issue-stale: 30 16 | days-before-issue-close: 14 17 | stale-issue-label: "stale" 18 | stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." 19 | close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." 20 | days-before-pr-stale: -1 21 | days-before-pr-close: -1 22 | repo-token: ${{ secrets.GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /.github/workflows/manager_build.yml: -------------------------------------------------------------------------------- 1 | name: Build Manager 2 | 3 | on: 4 | push: 5 | branches: ["main", "experimental"] 6 | paths: 7 | - "**.rs" 8 | - ".github/workflows/**" 9 | pull_request: 10 | branches: ["main", "experimental"] 11 | paths: 12 | - "**.rs" 13 | - ".github/workflows/**" 14 | workflow_dispatch: 15 | inputs: 16 | branch: 17 | description: "Branch to build" 18 | required: true 19 | default: "experimental" 20 | 21 | env: 22 | CARGO_TERM_COLOR: always 23 | 24 | jobs: 25 | build: 26 | strategy: 27 | matrix: 28 | os: [ubuntu-latest, windows-latest] 29 | 30 | runs-on: ${{ matrix.os }} 31 | 32 | steps: 33 | - uses: actions/checkout@v3 34 | - name: Build 35 | run: cd manager && cargo build --release 36 | - name: Output binary 37 | uses: actions/upload-artifact@v3 38 | with: 39 | name: volta-manager 40 | path: manager/target/release/voltaml-manager* 41 | retention-days: 3 42 | -------------------------------------------------------------------------------- /.github/workflows/ruff.yml: -------------------------------------------------------------------------------- 1 | name: Ruff 2 | 3 | on: 4 | push: 5 | paths: 6 | - "**.py" 7 | - ".github/workflows/**" 8 | pull_request: 9 | paths: 10 | - "**.py" 11 | - ".github/workflows/**" 12 | 13 | jobs: 14 | ruff: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | - uses: chartboost/ruff-action@v1 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | .ruff_cache 6 | 7 | # Distribution / packaging 8 | .Python 9 | onnx-script/ 10 | build/ 11 | develop-eggs/ 12 | /dist 13 | downloads/ 14 | eggs/ 15 | .eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | wheels/ 22 | share/python-wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | poetry.lock 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .nox/ 33 | .coverage 34 | .coverage.* 35 | .cache 36 | nosetests.xml 37 | coverage.xml 38 | *.cover 39 | *.py,cover 40 | .hypothesis/ 41 | .pytest_cache/ 42 | cover/ 43 | 44 | # Jupyter Notebook 45 | .ipynb_checkpoints 46 | *.ipynb 47 | 48 | # Diffusers convert files 49 | out 50 | traced_unet/ 51 | /onnx 52 | converted 53 | 54 | # Docker 55 | *test.docker-compose.yml 56 | *test-no-mount.docker-compose.yml 57 | 58 | # Docs 59 | node_modules/ 60 | docs/.vitepress/cache 61 | 62 | # Environments 63 | .env 64 | .venv 65 | env/ 66 | venv/ 67 | ENV/ 68 | env.bak/ 69 | venv.bak/ 70 | 71 | # Docs 72 | docs/.vitepress/dist 73 | 74 | # Project specific 75 | /engine 76 | /static/output 77 | /outputs 78 | /testing 79 | /typings 80 | external 81 | /tmp 82 | /data 83 | /AITemplate 84 | 85 | # Ignore for black 86 | core/submodules 87 | 88 | # Manager 89 | manager/target 90 | voltaml-manager 91 | voltaml-manager.exe 92 | 93 | # Profiler stuff 94 | profile.html 95 | 96 | # dotenv file 97 | .env 98 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/psf/black 3 | rev: 23.1.0 4 | hooks: 5 | - id: black 6 | - repo: https://github.com/astral-sh/ruff-pre-commit 7 | rev: v0.1.4 8 | hooks: 9 | - id: ruff 10 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | init-hook="import sys; sys.path.insert(0, '.')" 3 | ignore= 4 | core/submodules, 5 | typings, 6 | AITemplate, 7 | disable= 8 | C0114, # Missing module docstring 9 | W1203, # Use lazy % formatting in logging functions 10 | R0915, # Too many statements 11 | too-many-lines, 12 | line-too-long, 13 | consider-using-dict-items, 14 | import-outside-toplevel, 15 | invalid-name, 16 | relative-beyond-top-level, 17 | no-name-in-module, 18 | too-many-instance-attributes, 19 | too-few-public-methods, 20 | too-many-branches, 21 | too-many-arguments, 22 | too-many-locals 23 | 24 | [TYPECHECK] 25 | generated-members= 26 | torch.*, 27 | cuda.*, 28 | cv2.*, -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.python", 4 | "dbaeumer.vscode-eslint", 5 | "github.copilot", 6 | "ecmel.vscode-html-css", 7 | "ms-python.isort", 8 | "ms-vscode.vscode-typescript-next", 9 | "esbenp.prettier-vscode", 10 | "ms-python.vscode-pylance", 11 | "vue.volar", 12 | "christian-kohler.path-intellisense", 13 | "rust-lang.rust-analyzer" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "VoltaML API Debug", 5 | "type": "python", 6 | "request": "launch", 7 | "program": "main.py", 8 | "args": ["--log-level=DEBUG"], 9 | "justMyCode": false 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.testing.pytestArgs": ["."], 3 | "python.testing.unittestEnabled": false, 4 | "python.testing.pytestEnabled": true, 5 | "python.analysis.typeCheckingMode": "basic", 6 | "python.languageServer": "Pylance", 7 | "rust-analyzer.linkedProjects": ["./manager/Cargo.toml"], 8 | "[python]": { 9 | "editor.defaultFormatter": "ms-python.black-formatter" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /api/__init__.py: -------------------------------------------------------------------------------- 1 | from .websockets.manager import WebSocketManager 2 | 3 | websocket_manager = WebSocketManager() 4 | 5 | __all__ = ["websocket_manager"] 6 | -------------------------------------------------------------------------------- /api/routes/autofill.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from pathlib import Path 3 | from typing import List 4 | 5 | from fastapi import APIRouter 6 | 7 | router = APIRouter(tags=["autofill"]) 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | @router.get("/") 12 | def get_autofill_list() -> List[str]: 13 | "Gathers and returns all words from the prompt autofill files" 14 | 15 | autofill_folder = Path("data/autofill") 16 | 17 | words = [] 18 | 19 | logger.debug(f"Looking for autofill files in {autofill_folder}") 20 | logger.debug(f"Found {list(autofill_folder.iterdir())} files") 21 | 22 | for file in autofill_folder.iterdir(): 23 | if file.is_file(): 24 | if file.suffix == ".txt": 25 | logger.debug(f"Found autofill file: {file}") 26 | with open(file, "r", encoding="utf-8") as f: 27 | words.extend(f.read().splitlines()) 28 | 29 | return list(set(words)) 30 | -------------------------------------------------------------------------------- /api/routes/static.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | from fastapi.responses import FileResponse 3 | 4 | router = APIRouter() 5 | 6 | 7 | @router.get("/") 8 | def index(): 9 | "Main page" 10 | 11 | return FileResponse("frontend/dist/index.html") 12 | 13 | 14 | @router.get("/favicon.ico", include_in_schema=False) 15 | def favicon(): 16 | "Icon of the app" 17 | 18 | return FileResponse("frontend/dist/favicon.ico") 19 | -------------------------------------------------------------------------------- /api/routes/test.py: -------------------------------------------------------------------------------- 1 | import faulthandler 2 | import logging 3 | 4 | from fastapi import APIRouter 5 | from fastapi.responses import FileResponse 6 | 7 | router = APIRouter() 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | @router.get("/alive") 12 | def test(): 13 | return {"message": "Hello World"} 14 | 15 | 16 | @router.get("/huggingface-models.json") 17 | def huggingface_models(): 18 | return FileResponse("static/huggingface-models.json") 19 | 20 | 21 | @router.post("/dump-thread-traceback") 22 | def dump_thread_traceback(): 23 | faulthandler.dump_traceback(all_threads=True) 24 | -------------------------------------------------------------------------------- /api/routes/ws.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from fastapi import APIRouter 4 | from fastapi.websockets import WebSocket, WebSocketDisconnect 5 | 6 | from api import websocket_manager 7 | from api.websockets.data import Data 8 | 9 | router = APIRouter(tags=["websockets"]) 10 | logger = logging.getLogger(__name__) 11 | 12 | 13 | @router.websocket("/master") 14 | async def master_endpoint(websocket: WebSocket): 15 | "Main connection point for the websocket" 16 | 17 | await websocket_manager.connect(websocket) 18 | try: 19 | while True: 20 | text = await websocket.receive_text() 21 | if text == "ping": 22 | await websocket.send_text("pong") 23 | 24 | except WebSocketDisconnect: 25 | websocket_manager.disconnect(websocket) 26 | 27 | 28 | @router.post("/progress") 29 | def set_progress(progress: int): 30 | "Set the progress of the progress bar" 31 | 32 | websocket_manager.broadcast_sync( 33 | data=Data(data_type="progress", data={"progress": progress}) 34 | ) 35 | 36 | 37 | @router.get("/get-active-connetions") 38 | def get_active_connections(): 39 | connections = websocket_manager.get_active_connections() 40 | converted_connections = [ 41 | f"{connection.client.host}:{connection.client.port}-{connection.client_state.name}" 42 | for connection in connections 43 | if connection.client is not None 44 | ] 45 | 46 | return converted_connections 47 | -------------------------------------------------------------------------------- /api/websockets/__init__.py: -------------------------------------------------------------------------------- 1 | from .data import Data 2 | from .manager import WebSocketManager 3 | from .notification import Notification 4 | 5 | __all__ = ["Data", "WebSocketManager", "Notification"] 6 | -------------------------------------------------------------------------------- /api/websockets/data.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List, Union 2 | 3 | 4 | class Data: 5 | "Data to be sent to the client" 6 | 7 | def __init__(self, data: Union[Dict[Any, Any], List[Any]], data_type: str): 8 | self.data = data 9 | self.type = data_type 10 | 11 | def to_json(self) -> Union[Dict[str, Any], List[Any]]: 12 | "Converts the data to a JSON object" 13 | 14 | return {"type": self.type, "data": self.data} 15 | -------------------------------------------------------------------------------- /api/websockets/notification.py: -------------------------------------------------------------------------------- 1 | from typing import Literal 2 | 3 | from .data import Data 4 | 5 | 6 | class Notification(Data): 7 | "Notification to be sent to the client" 8 | 9 | def __init__( 10 | self, 11 | severity: Literal["info", "warning", "error", "success"] = "info", 12 | title: str = "", 13 | message: str = "", 14 | timeout: int = 10_000, 15 | ) -> None: 16 | self.severity = severity 17 | self.title = title 18 | self.message = message 19 | self.timeout = timeout 20 | super().__init__( 21 | data={ 22 | "severity": self.severity, 23 | "title": self.title, 24 | "message": self.message, 25 | "timeout": self.timeout, 26 | }, 27 | data_type="notification", 28 | ) 29 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from coloredlogs import install as install_coloredlogs 4 | 5 | from bot.bot import ModularBot 6 | 7 | bot = ModularBot() 8 | 9 | if __name__ == "__main__": 10 | print( 11 | """ 12 | VoltaML Bot - Discord Bot for Stable Diffusion inference 13 | Copyright (C) 2023-present Stax124 14 | 15 | This program is free software: you can redistribute it and/or modify 16 | it under the terms of the GNU General Public License as published by 17 | the Free Software Foundation, either version 3 of the License, or 18 | (at your option) any later version. 19 | 20 | This program is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU General Public License for more details. 24 | 25 | You should have received a copy of the GNU General Public License 26 | along with this program. If not, see . 27 | """ 28 | ) 29 | 30 | install_coloredlogs("INFO") 31 | 32 | bot.run(os.environ["DISCORD_BOT_TOKEN"]) 33 | -------------------------------------------------------------------------------- /bot/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/bot/__init__.py -------------------------------------------------------------------------------- /bot/bot_model_manager.py: -------------------------------------------------------------------------------- 1 | from bot.helper import get_available_models, get_loaded_models 2 | 3 | 4 | class BotModelManager: 5 | "Class for internally managing models" 6 | 7 | def __init__(self): 8 | self._cached_models = [] 9 | self._loaded_models = [] 10 | 11 | async def cached_available_models(self): 12 | "List all available models" 13 | 14 | if not self._cached_models: 15 | self._cached_models, code = await get_available_models() 16 | else: 17 | code = 200 18 | 19 | return self._cached_models, code 20 | 21 | def set_cached_available_models(self, value): 22 | "Set the internal cached models" 23 | 24 | self._cached_models = value 25 | 26 | async def cached_loaded_models(self): 27 | "List all loaded models" 28 | 29 | if not self._loaded_models: 30 | self._loaded_models, code = await get_loaded_models() 31 | else: 32 | code = 200 33 | 34 | return self._loaded_models, code 35 | 36 | def set_cached_loaded_models(self, value): 37 | "Set the internal loaded models" 38 | 39 | self._loaded_models = value 40 | -------------------------------------------------------------------------------- /bot/core.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from discord.ext import commands 4 | from discord.ext.commands import Cog, Context 5 | 6 | if TYPE_CHECKING: 7 | from bot.bot import ModularBot 8 | 9 | 10 | class Core(Cog): 11 | "Core commands" 12 | 13 | def __init__(self, bot: "ModularBot") -> None: 14 | self.bot = bot 15 | 16 | @commands.hybrid_command(name="sync") 17 | @commands.has_permissions(administrator=True) 18 | async def sync(self, ctx: Context): 19 | "Sync slash commands with the API" 20 | 21 | await self.bot.sync() 22 | await ctx.send("✅ Synced slash commands!") 23 | 24 | 25 | async def setup(bot: "ModularBot"): 26 | "Will be called by the bot" 27 | 28 | await bot.add_cog(Core(bot)) 29 | -------------------------------------------------------------------------------- /bot/listeners.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | import discord 4 | from discord.ext import commands 5 | from discord.ext.commands import Cog 6 | 7 | if TYPE_CHECKING: 8 | from bot.bot import ModularBot 9 | 10 | 11 | class Listeners(Cog): 12 | "Middlewares for the bot" 13 | 14 | def __init__(self, bot: "ModularBot") -> None: 15 | self.bot = bot 16 | 17 | @commands.Cog.listener() 18 | async def on_ready(self) -> None: 19 | "When the bot is connected and ready to operate" 20 | 21 | await self.bot.change_presence( 22 | status=discord.Status.online, activity=discord.Game("VoltaML - /dream") 23 | ) 24 | 25 | 26 | async def setup(bot: "ModularBot") -> None: 27 | "Load the cog" 28 | 29 | await bot.add_cog(Listeners(bot)) 30 | -------------------------------------------------------------------------------- /bot/shared.py: -------------------------------------------------------------------------------- 1 | from bot.bot_model_manager import BotModelManager 2 | from bot.config import load_config 3 | 4 | config = load_config() 5 | models = BotModelManager() 6 | -------------------------------------------------------------------------------- /core/aitemplate/config.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | 4 | 5 | def get_unet_in_channels(directory: Path): 6 | "Get the number of input channels for the UNet model." 7 | 8 | try: 9 | with directory.joinpath("config.json").open() as f: 10 | config = json.load(f) 11 | return int(config["unet_in_channels"]) 12 | except FileNotFoundError: 13 | return 4 14 | -------------------------------------------------------------------------------- /core/aitemplate/src/common.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | def torch_dtype_from_str(dtype: str): 5 | return torch.__dict__.get(dtype, None) 6 | 7 | 8 | def get_shape(x): 9 | shape = [it.value() for it in x._attrs["shape"]] 10 | return shape 11 | 12 | 13 | def mark_output(y): 14 | if type(y) is not tuple: 15 | y = (y,) 16 | for i in range(len(y)): 17 | y[i]._attrs["is_output"] = True 18 | y[i]._attrs["name"] = "output_%d" % (i) 19 | y_shape = [d._attrs["values"] for d in y[i]._attrs["shape"]] 20 | print("AIT output_{} shape: {}".format(i, y_shape)) 21 | -------------------------------------------------------------------------------- /core/config/__init__.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from diffusers.utils.constants import DIFFUSERS_CACHE 4 | 5 | from ._config import ( 6 | Configuration, 7 | load_config, 8 | save_config, 9 | ) 10 | from .default_settings import ( 11 | Txt2ImgConfig, 12 | Img2ImgConfig, 13 | ) 14 | 15 | config = load_config() 16 | 17 | # Create cache directory if it doesn't exist 18 | Path(DIFFUSERS_CACHE).mkdir(parents=True, exist_ok=True) 19 | 20 | __all__ = [ 21 | "config", 22 | "Img2ImgConfig", 23 | "Txt2ImgConfig", 24 | "Configuration", 25 | "save_config", 26 | "load_config", 27 | ] 28 | -------------------------------------------------------------------------------- /core/config/bot_settings.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from diffusers.schedulers.scheduling_utils import KarrasDiffusionSchedulers 4 | 5 | 6 | @dataclass 7 | class BotConfig: 8 | "Configuration for the bot" 9 | 10 | default_scheduler: KarrasDiffusionSchedulers = ( 11 | KarrasDiffusionSchedulers.DPMSolverSinglestepScheduler 12 | ) 13 | verbose: bool = False 14 | use_default_negative_prompt: bool = True 15 | -------------------------------------------------------------------------------- /core/config/flags_settings.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass, field 2 | 3 | from core.flags import SDXLFlag, SDXLRefinerFlag 4 | 5 | 6 | @dataclass 7 | class FlagsConfig: 8 | "Configuration for flags" 9 | 10 | refiner: SDXLRefinerFlag = field(default_factory=SDXLRefinerFlag) 11 | sdxl: SDXLFlag = field(default_factory=SDXLFlag) 12 | -------------------------------------------------------------------------------- /core/config/frontend_settings.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | 4 | @dataclass 5 | class FrontendConfig: 6 | "Configuration for the frontend" 7 | 8 | theme: str = "dark" 9 | background_image_override: str = "" 10 | enable_theme_editor: bool = False 11 | image_browser_columns: int = 5 12 | on_change_timer: int = 0 13 | nsfw_ok_threshold: int = 0 14 | disable_analytics: bool = False 15 | -------------------------------------------------------------------------------- /core/config/interrogator_settings.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | 4 | @dataclass 5 | class InterrogatorConfig: 6 | "Configuration for interrogation models" 7 | 8 | # set to "Salesforce/blip-image-captioning-base" for an extra gig of vram 9 | caption_model: str = "Salesforce/blip-image-captioning-large" 10 | visualizer_model: str = "ViT-L-14/openai" 11 | 12 | offload_captioner: bool = False 13 | offload_visualizer: bool = False 14 | 15 | chunk_size: int = 2048 # set to 1024 for lower vram usage 16 | flavor_intermediate_count: int = 2048 # set to 1024 for lower vram usage 17 | 18 | flamingo_model: str = "dhansmair/flamingo-mini" 19 | 20 | caption_max_length: int = 32 21 | -------------------------------------------------------------------------------- /core/errors.py: -------------------------------------------------------------------------------- 1 | class DimensionError(Exception): 2 | "Raised when the dimension of the input is not correct" 3 | 4 | 5 | class ModelFailedError(Exception): 6 | "Raised when the model fails to generate and image or fails to load" 7 | 8 | 9 | class ModelNotLoadedError(Exception): 10 | "Raised when the model is blocked from being loaded automatically" 11 | 12 | 13 | class InferenceInterruptedError(Exception): 14 | "Raised when the model is interrupted" 15 | -------------------------------------------------------------------------------- /core/inference/ait/__init__.py: -------------------------------------------------------------------------------- 1 | from .aitemplate import AITemplateStableDiffusion 2 | -------------------------------------------------------------------------------- /core/inference/base_model.py: -------------------------------------------------------------------------------- 1 | import gc 2 | from abc import ABC, abstractmethod 3 | from typing import List, Union 4 | 5 | import torch 6 | from PIL import Image 7 | 8 | from core.config import config 9 | from core.types import Backend, Job 10 | 11 | 12 | class InferenceModel(ABC): 13 | "Base class for all inference models that will be used in the API" 14 | 15 | def __init__(self, model_id: str, device: Union[str, torch.device] = "cuda"): 16 | self.model_id = model_id 17 | self.device = device 18 | self.backend: Backend = "unknown" 19 | 20 | @abstractmethod 21 | def load(self): 22 | "Loads the model into the memory" 23 | 24 | @abstractmethod 25 | def unload(self): 26 | "Unloads the model from the memory" 27 | 28 | @abstractmethod 29 | def generate(self, job: Job) -> List[Image.Image]: 30 | "Generates the output of the model" 31 | 32 | def memory_cleanup(self) -> None: 33 | "Cleanup the GPU memory" 34 | 35 | if config.api.clear_memory_policy == "always": 36 | gc.collect() 37 | if torch.cuda.is_available(): 38 | torch.cuda.empty_cache() 39 | torch.cuda.ipc_collect() 40 | if torch.backends.mps.is_available(): # type: ignore 41 | torch.mps.empty_cache() # type: ignore 42 | try: 43 | if torch.xpu.is_available(): # type: ignore 44 | torch.xpu.empty_cache() # type: ignore 45 | except AttributeError: 46 | pass 47 | -------------------------------------------------------------------------------- /core/inference/esrgan/__init__.py: -------------------------------------------------------------------------------- 1 | from .real_esrgan import RealESRGAN 2 | from .upscale import Upscaler 3 | -------------------------------------------------------------------------------- /core/inference/esrgan/utils/architecture/__index__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/core/inference/esrgan/utils/architecture/__index__.py -------------------------------------------------------------------------------- /core/inference/esrgan/utils/net_interp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | from collections import OrderedDict 6 | 7 | import torch 8 | 9 | alpha = float(sys.argv[1]) 10 | 11 | net_PSNR_path = "./models/RRDB_PSNR_x4_old_arch.pth" 12 | net_ESRGAN_path = "./models/RRDB_ESRGAN_x4_old_arch.pth" 13 | net_interp_path = "./models/interp_{:02d}.pth".format(int(alpha * 10)) 14 | 15 | net_PSNR = torch.load(net_PSNR_path) 16 | net_ESRGAN = torch.load(net_ESRGAN_path) 17 | net_interp = OrderedDict() 18 | 19 | print("Interpolating with alpha = ", alpha) 20 | 21 | for k, v_PSNR in net_PSNR.items(): 22 | v_ESRGAN = net_ESRGAN[k] 23 | net_interp[k] = (1 - alpha) * v_PSNR + alpha * v_ESRGAN 24 | 25 | torch.save(net_interp, net_interp_path) 26 | -------------------------------------------------------------------------------- /core/inference/injectables/utils.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from pathlib import Path 3 | from typing import Any, Dict, List, Tuple, Type, Union 4 | 5 | import torch 6 | 7 | 8 | class HookObject(ABC): 9 | "Module containing information on this subset of injectables." 10 | 11 | def __init__( 12 | self, 13 | name: str, 14 | prompt_key: str, 15 | module_class: Type, 16 | targets: List[str], 17 | default_attributes: List[Tuple[str, Any]] = [], 18 | ) -> None: 19 | self.name = name 20 | self.prompt_key = prompt_key 21 | self.module_type = module_class 22 | self.targets = targets 23 | self.default_attributes = default_attributes 24 | 25 | self.containers: Dict[str, module_class] = {} 26 | 27 | def unload(self, file: Union[Path, str]): 28 | "Unload a modifier file." 29 | if not isinstance(file, Path): 30 | file = Path(file) 31 | del self.containers[file.name] 32 | 33 | @abstractmethod 34 | def load( 35 | self, 36 | name: str, 37 | state_dict: Dict[str, torch.nn.Module], 38 | modules: Dict[str, torch.nn.Module], 39 | ) -> Any: 40 | "Load a modifier file." 41 | 42 | @abstractmethod 43 | def apply_hooks(self, p: torch.nn.Module) -> None: 44 | "Apply weights of this modifier to the module given in argument `p`." 45 | -------------------------------------------------------------------------------- /core/inference/onnx/__init__.py: -------------------------------------------------------------------------------- 1 | from .pipeline import OnnxStableDiffusion 2 | -------------------------------------------------------------------------------- /core/inference/pytorch/__init__.py: -------------------------------------------------------------------------------- 1 | from .pytorch import PyTorchStableDiffusion 2 | -------------------------------------------------------------------------------- /core/inference/sdxl/__init__.py: -------------------------------------------------------------------------------- 1 | from .sdxl import SDXLStableDiffusion 2 | -------------------------------------------------------------------------------- /core/inference/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | from .aitemplate import init_ait_module 2 | from .controlnet import image_to_controlnet_input 3 | from .latents import ( 4 | pad_tensor, 5 | prepare_image, 6 | prepare_latents, 7 | prepare_mask_and_masked_image, 8 | prepare_mask_latents, 9 | preprocess_adapter_image, 10 | preprocess_image, 11 | preprocess_mask, 12 | scale_latents, 13 | ) 14 | from .lwp import get_weighted_text_embeddings 15 | from .scheduling import change_scheduler, get_timesteps, prepare_extra_step_kwargs 16 | from .random import create_generator, randn, randn_like 17 | from .vae import taesd, full_vae, cheap_approximation, numpy_to_pil, decode_latents 18 | from .prompt_expansion import download_model, expand 19 | from .cfg import calculate_cfg 20 | from .kohya_hires import post_process as postprocess_kohya, modify_unet as modify_kohya 21 | from .scalecrafter import ( 22 | ScalecrafterSettings, 23 | find_config_closest_to as get_scalecrafter_config, 24 | post_scale as post_scalecrafter, 25 | scale as step_scalecrafter, 26 | scale_setup as setup_scalecrafter, 27 | ) 28 | -------------------------------------------------------------------------------- /core/inference/utilities/aitemplate.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | from typing import Any, Union 4 | 5 | 6 | def init_ait_module( 7 | model_name: str, 8 | workdir: Union[str, Path], 9 | ) -> Any: 10 | "Initialize a new AITemplate Module object" 11 | from aitemplate.compiler import Model 12 | 13 | mod = Model(os.path.join(workdir, model_name, "test.so")) 14 | return mod 15 | -------------------------------------------------------------------------------- /core/inference/utilities/prompt_expansion/__init__.py: -------------------------------------------------------------------------------- 1 | from .downloader import download_model 2 | from .expand import expand 3 | 4 | __ALL__ = ["download_model", "expand"] 5 | -------------------------------------------------------------------------------- /core/inference/utilities/random.py: -------------------------------------------------------------------------------- 1 | from typing import Optional, Union 2 | 3 | import torch 4 | from torch import Generator as native 5 | 6 | from core.config import config 7 | 8 | from .philox import PhiloxGenerator 9 | 10 | 11 | def create_generator(seed: int) -> Union[PhiloxGenerator, torch.Generator]: 12 | generator = config.api.generator 13 | if generator == "device" and config.api.overwrite_generator: 14 | generator = "cpu" 15 | if generator == "philox": 16 | return PhiloxGenerator(seed) 17 | 18 | return native(config.api.device if generator == "device" else "cpu").manual_seed( 19 | seed 20 | ) 21 | 22 | 23 | def randn( 24 | shape, 25 | generator: Union[PhiloxGenerator, torch.Generator], 26 | device: Optional[torch.device] = None, 27 | dtype: Optional[torch.dtype] = None, 28 | ) -> torch.Tensor: 29 | if isinstance(generator, PhiloxGenerator): 30 | return torch.asarray(generator.randn(shape), device=device, dtype=dtype) 31 | 32 | return torch.randn( 33 | shape, 34 | generator=generator, 35 | dtype=dtype, 36 | device="cpu" if config.api.overwrite_generator else generator.device, 37 | ).to(device) 38 | 39 | 40 | def randn_like( 41 | x: torch.Tensor, 42 | generator: Union[PhiloxGenerator, torch.Generator], 43 | device: Optional[torch.device] = None, 44 | dtype: Optional[torch.dtype] = None, 45 | ) -> torch.Tensor: 46 | return randn(x.shape, generator, device, dtype) 47 | -------------------------------------------------------------------------------- /core/inference/utilities/sag/cross_attn.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | class CrossAttnStoreProcessor: 5 | "Modified Cross Attention Processor with capabilities to store probabilities." 6 | 7 | def __init__(self): 8 | self.attention_probs = None 9 | 10 | def __call__( 11 | self, 12 | attn, 13 | hidden_states, 14 | encoder_hidden_states=None, 15 | attention_mask=None, 16 | ): 17 | batch_size, sequence_length, _ = hidden_states.shape 18 | attention_mask = attn.prepare_attention_mask( 19 | attention_mask, sequence_length, batch_size 20 | ) 21 | query = attn.to_q(hidden_states) 22 | 23 | if encoder_hidden_states is None: 24 | encoder_hidden_states = hidden_states 25 | elif attn.norm_cross: 26 | encoder_hidden_states = attn.norm_encoder_hidden_states( 27 | encoder_hidden_states 28 | ) 29 | 30 | key = attn.to_k(encoder_hidden_states) 31 | value = attn.to_v(encoder_hidden_states) 32 | 33 | query = attn.head_to_batch_dim(query) 34 | key = attn.head_to_batch_dim(key) 35 | value = attn.head_to_batch_dim(value) 36 | 37 | self.attention_probs = attn.get_attention_scores(query, key, attention_mask) 38 | hidden_states = torch.bmm(self.attention_probs, value) 39 | hidden_states = attn.batch_to_head_dim(hidden_states) 40 | 41 | # linear proj 42 | hidden_states = attn.to_out[0](hidden_states) 43 | # dropout 44 | hidden_states = attn.to_out[1](hidden_states) 45 | 46 | return hidden_states 47 | -------------------------------------------------------------------------------- /core/inference/utilities/sag/diffusers.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | 3 | import torch 4 | 5 | from .sag_utils import sag_masking, pred_epsilon, pred_x0 6 | 7 | 8 | def calculate_sag( 9 | pipe, 10 | call: Callable, 11 | store_processor, 12 | latent: torch.Tensor, 13 | noise: torch.Tensor, 14 | timestep: torch.IntTensor, 15 | map_size: tuple, 16 | text_embeddings: torch.Tensor, 17 | scale: float, 18 | cfg: float, 19 | dtype: torch.dtype, 20 | **additional_kwargs, 21 | ) -> torch.Tensor: 22 | pred: torch.Tensor = pred_x0(pipe, latent, noise, timestep) 23 | if cfg > 1: 24 | cond_attn, _ = store_processor.attention_probs.chunk(2) 25 | text_embeddings, _ = text_embeddings.chunk(2) 26 | else: 27 | cond_attn = store_processor.attention_probs 28 | 29 | eps = pred_epsilon(pipe, latent, noise, timestep) 30 | degraded: torch.Tensor = sag_masking(pipe, pred, cond_attn, map_size, timestep, eps) 31 | 32 | degraded_prep = call( 33 | degraded.to(dtype=dtype), 34 | timestep, 35 | cond=text_embeddings, 36 | **additional_kwargs, 37 | ) 38 | return scale * (noise - degraded_prep) 39 | -------------------------------------------------------------------------------- /core/inference/utilities/sag/kdiff.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | 3 | import torch 4 | 5 | from .sag_utils import sag_masking 6 | 7 | 8 | def calculate_sag( 9 | pipe, 10 | call: Callable, 11 | store_processor, 12 | latent: torch.Tensor, 13 | noise: torch.Tensor, 14 | timestep: torch.IntTensor, 15 | map_size: tuple, 16 | text_embeddings: torch.Tensor, 17 | scale: float, 18 | cfg: float, 19 | dtype: torch.dtype, 20 | **additional_kwargs, 21 | ) -> torch.Tensor: 22 | pred: torch.Tensor = noise # noise is already pred_x0 with kdiff 23 | if cfg > 1: 24 | cond_attn, _ = store_processor.attention_probs.chunk(2) 25 | text_embeddings, _ = text_embeddings.chunk(2) 26 | else: 27 | cond_attn = store_processor.attention_probs 28 | 29 | degraded: torch.Tensor = sag_masking(pipe, pred, cond_attn, map_size, timestep, 0) 30 | 31 | # messed up the order of these two, spent half an hour looking for problems. 32 | # Epsilon 33 | compensation = noise - degraded 34 | degraded = degraded - (noise - latent) 35 | 36 | degraded_pred = call( 37 | degraded.to(dtype=dtype), 38 | timestep, 39 | cond=text_embeddings, 40 | **additional_kwargs, 41 | ) 42 | return (noise - (degraded_pred + compensation)) * scale 43 | -------------------------------------------------------------------------------- /core/interrogation/base_interrogator.py: -------------------------------------------------------------------------------- 1 | import gc 2 | from abc import ABC, abstractmethod 3 | from dataclasses import dataclass 4 | from typing import List, Tuple, Union 5 | 6 | import torch 7 | 8 | from core.config import config 9 | from core.types import Backend, Job 10 | 11 | 12 | @dataclass 13 | class InterrogationResult: 14 | "Contains results from the interrogation" 15 | positive: List[Tuple[str, float]] 16 | negative: List[Tuple[str, float]] 17 | 18 | 19 | class InterrogationModel(ABC): 20 | "Base class for all interrogator models that will be used in the API" 21 | 22 | def __init__(self, device: Union[str, torch.device] = "cuda"): 23 | self.device = device 24 | self.backend: Backend = "unknown" 25 | 26 | @abstractmethod 27 | def load(self): 28 | "Loads the model into the memory" 29 | 30 | @abstractmethod 31 | def unload(self): 32 | "Unloads the model from the memory" 33 | 34 | @abstractmethod 35 | def generate(self, job: Job) -> InterrogationResult: 36 | "Generates the output of the model" 37 | 38 | def memory_cleanup(self) -> None: 39 | "Cleanup the GPU memory" 40 | 41 | if "cpu" in config.api.device or "privateuseone" in config.api.device: 42 | gc.collect() 43 | else: 44 | torch.cuda.empty_cache() 45 | torch.cuda.ipc_collect() 46 | gc.collect() 47 | -------------------------------------------------------------------------------- /core/logger/websocket_logging.py: -------------------------------------------------------------------------------- 1 | from logging import LogRecord, StreamHandler 2 | from typing import TYPE_CHECKING, Optional 3 | 4 | from api import websocket_manager 5 | from api.websockets.data import Data 6 | from core.functions import debounce 7 | 8 | if TYPE_CHECKING: 9 | from core.config.config import Configuration 10 | 11 | 12 | class WebSocketLoggingHandler(StreamHandler): 13 | "Broadcasts log messages to all connected clients." 14 | 15 | def __init__(self, config: Optional["Configuration"]): 16 | super().__init__() 17 | self.buffer = [] 18 | self.config = config 19 | 20 | def emit(self, record: LogRecord): 21 | if not self.config: 22 | return 23 | if self.config.api.enable_websocket_logging is False: 24 | return 25 | 26 | msg = f"{record.levelname} {self.format(record)}" 27 | self.buffer.insert(0, msg) 28 | 29 | # Prevent buffer from growing too large 30 | if len(self.buffer) > 100: 31 | self.send() 32 | 33 | self.debounced_send() 34 | 35 | @debounce(0.5) 36 | def debounced_send(self): 37 | self.send() 38 | 39 | def send(self): 40 | msg = "\n".join(self.buffer) 41 | self.buffer.clear() 42 | websocket_manager.broadcast_sync(Data(data={"message": msg}, data_type="log")) 43 | -------------------------------------------------------------------------------- /core/optimizations/__init__.py: -------------------------------------------------------------------------------- 1 | from .autocast_utils import autocast, without_autocast 2 | from .context_manager import inference_context, InferenceContext 3 | from .pytorch_optimizations import optimize_model, optimize_vae 4 | from .upcast import upcast_vae 5 | from .offload import ensure_correct_device, unload_all 6 | from .hypertile import is_hypertile_available, hypertile 7 | from .compile.stable_fast import compile as compile_sfast 8 | 9 | __all__ = [ 10 | "optimize_model", 11 | "optimize_vae", 12 | "without_autocast", 13 | "autocast", 14 | "upcast_vae", 15 | "ensure_correct_device", 16 | "unload_all", 17 | "inference_context", 18 | "InferenceContext", 19 | "is_hypertile_available", 20 | "hypertile", 21 | "compile_sfast", 22 | ] 23 | -------------------------------------------------------------------------------- /core/optimizations/context_manager.py: -------------------------------------------------------------------------------- 1 | from contextlib import ExitStack 2 | 3 | import torch 4 | 5 | from core.config import config 6 | from .autocast_utils import autocast 7 | from .hypertile import is_hypertile_available, hypertile 8 | 9 | 10 | class InferenceContext(ExitStack): 11 | """inference context""" 12 | 13 | unet: torch.nn.Module 14 | vae: torch.nn.Module 15 | 16 | 17 | def inference_context(unet, vae, height, width) -> InferenceContext: 18 | "Helper function for centralizing context management" 19 | s = InferenceContext() 20 | s.unet = unet 21 | s.vae = vae 22 | s.enter_context( 23 | autocast( 24 | config.api.load_dtype, 25 | disable=config.api.autocast and not unet.force_autocast, 26 | ) 27 | ) 28 | if is_hypertile_available() and config.api.hypertile: 29 | s.enter_context(hypertile(unet, height, width)) 30 | if config.api.torch_compile: 31 | s.unet = torch.compile( # type: ignore 32 | unet, 33 | fullgraph=config.api.torch_compile_fullgraph, 34 | dynamic=config.api.torch_compile_dynamic, 35 | mode=config.api.torch_compile_mode, 36 | ) 37 | return s 38 | -------------------------------------------------------------------------------- /core/optimizations/hypertile.py: -------------------------------------------------------------------------------- 1 | from contextlib import ExitStack 2 | from importlib.util import find_spec 3 | 4 | from core.config import config 5 | 6 | 7 | def is_hypertile_available(): 8 | "Checks whether hypertile is available" 9 | return find_spec("hyper_tile") is not None 10 | 11 | 12 | def hypertile(unet, height: int, width: int) -> ExitStack: 13 | from hyper_tile import split_attention # noqa: F811 14 | 15 | s = ExitStack() 16 | s.enter_context( 17 | split_attention(unet, height / width, tile_size=config.api.hypertile_unet_chunk) 18 | ) 19 | return s 20 | -------------------------------------------------------------------------------- /core/optimizations/offload.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=global-statement 2 | 3 | import logging 4 | 5 | from accelerate import cpu_offload 6 | import torch 7 | 8 | from core.config import config 9 | 10 | logger = logging.getLogger(__name__) 11 | _module: torch.nn.Module = None # type: ignore 12 | 13 | 14 | def unload_all(): 15 | global _module 16 | if _module is not None: 17 | _module.cpu() 18 | _module = None # type: ignore 19 | 20 | 21 | def ensure_correct_device(module: torch.nn.Module): 22 | global _module 23 | if _module is not None: 24 | if module.__class__.__name__ == _module.__class__.__name__: 25 | return 26 | logger.debug(f"Transferring {_module.__class__.__name__} to cpu.") 27 | _module.cpu() 28 | _module = None # type: ignore 29 | if hasattr(module, "v_offload_device"): 30 | device = getattr(module, "v_offload_device", config.api.device) 31 | 32 | logger.debug(f"Transferring {module.__class__.__name__} to {str(device)}.") 33 | module.to(device=torch.device(device)) 34 | _module = module 35 | else: 36 | logger.debug(f"Don't need to do anything with {module.__class__.__name__}.") 37 | 38 | 39 | def set_offload(module: torch.nn.Module, device: torch.device): 40 | if config.api.offload == "module": 41 | class_name = module.__class__.__name__ 42 | if "CLIP" not in class_name and "Autoencoder" not in class_name: 43 | return cpu_offload( 44 | module, device, offload_buffers=len(module._parameters) > 0 45 | ) 46 | setattr(module, "v_offload_device", device) 47 | return module 48 | -------------------------------------------------------------------------------- /core/optimizations/upcast.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | import torch 4 | from diffusers.models.attention_processor import AttnProcessor2_0, XFormersAttnProcessor 5 | from diffusers.models.autoencoder_kl import AutoencoderKL 6 | 7 | from core.config import config 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | def upcast_vae(vae: AutoencoderKL): 13 | if ( 14 | vae.config["force_upcast"] or config.api.upcast_vae 15 | ) and vae.dtype == torch.float16: 16 | dtype = vae.dtype 17 | logger.info( 18 | 'Upcasting VAE to FP32 (vae["force_upcast"] OR config.api.upcast_vae)' 19 | ) 20 | vae.to(dtype=torch.float32) 21 | use_torch_2_0_or_xformers = isinstance( 22 | vae.decoder.mid_block.attentions[0].processor, # type: ignore 23 | ( 24 | AttnProcessor2_0, 25 | XFormersAttnProcessor, 26 | ), 27 | ) 28 | # if xformers or torch_2_0 is used attention block does not need 29 | # to be in float32 which can save lots of memory 30 | if use_torch_2_0_or_xformers: 31 | vae.post_quant_conv.to(dtype=dtype) 32 | vae.decoder.conv_in.to(dtype=dtype) 33 | vae.decoder.mid_block.to(dtype=dtype) # type: ignore 34 | return vae 35 | -------------------------------------------------------------------------------- /core/scheduling/__init__.py: -------------------------------------------------------------------------------- 1 | from .adapter.k_adapter import KdiffusionSchedulerAdapter 2 | from .adapter.unipc_adapter import UnipcSchedulerAdapter 3 | from .scheduling import create_sampler 4 | -------------------------------------------------------------------------------- /core/scheduling/custom/lcm.py: -------------------------------------------------------------------------------- 1 | from k_diffusion.sampling import default_noise_sampler 2 | import torch 3 | from tqdm import trange 4 | 5 | 6 | @torch.no_grad() 7 | def sample_lcm( 8 | model, 9 | x: torch.Tensor, 10 | sigmas, 11 | extra_args=None, 12 | callback=None, 13 | disable=None, 14 | noise_sampler=None, 15 | ): 16 | extra_args = {} if extra_args is None else extra_args 17 | noise_sampler = default_noise_sampler(x) if noise_sampler is None else noise_sampler 18 | s_in = x.new_ones([x.shape[0]]) 19 | for i in trange(len(sigmas) - 1, disable=disable): 20 | denoised = model(x, sigmas[i] * s_in, **extra_args) 21 | if callback is not None: 22 | callback( 23 | { 24 | "x": x, 25 | "i": i, 26 | "sigma": sigmas[i], 27 | "sigma_hat": sigmas[i], 28 | "denoised": denoised, 29 | } 30 | ) 31 | 32 | x = denoised 33 | if sigmas[i + 1] > 0: 34 | x += sigmas[i + 1] * noise_sampler(sigmas[i], sigmas[i + 1]) 35 | return x 36 | -------------------------------------------------------------------------------- /core/scheduling/hijack.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | 3 | import torch 4 | 5 | from core.inference.utilities.philox import PhiloxGenerator 6 | 7 | 8 | class TorchHijack: 9 | """This is here to replace torch.randn_like of k-diffusion. 10 | 11 | k-diffusion has random_sampler argument for most samplers, but not for all, so 12 | this is needed to properly replace every use of torch.randn_like. 13 | 14 | We need to replace to make images generated in batches to be same as images generated individually. 15 | """ 16 | 17 | def __init__(self, generator: Union[PhiloxGenerator, torch.Generator]) -> None: 18 | self.generator = generator 19 | 20 | super().__init__() 21 | 22 | def __getattr__(self, item): 23 | if item == "randn_like": 24 | return self.randn_like 25 | 26 | if hasattr(torch, item): 27 | return getattr(torch, item) 28 | 29 | raise AttributeError( 30 | f"'{type(self).__name__}' object has no attribute '{item}'" 31 | ) 32 | 33 | def randn_like(self, x): 34 | from core.inference.utilities import randn_like 35 | 36 | return randn_like(x, self.generator, x.device, x.dtype) 37 | -------------------------------------------------------------------------------- /core/scheduling/types.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Callable, Dict, Literal, Tuple, Union 2 | 3 | from k_diffusion.external import CompVisDenoiser, CompVisVDenoiser 4 | 5 | Sampler = Tuple[str, Union[Callable, str], Dict[str, Any]] 6 | Denoiser = Union[CompVisVDenoiser, CompVisDenoiser] 7 | 8 | # UniPC 9 | AlgorithmType = Literal["noise_prediction", "data_prediction"] 10 | ModelType = Literal["v", "noise"] # "v" for 2.x and "noise" for 1.x 11 | Variant = Literal["bh1", "bh2"] 12 | SkipType = Literal["logSNR", "time_uniform", "time_quadratic"] 13 | Method = Literal["multistep", "singlestep", "singlestep_fixed"] 14 | UniPCSchedule = Literal["discrete", "linear", "cosine"] 15 | -------------------------------------------------------------------------------- /core/scheduling/unipc/__init__.py: -------------------------------------------------------------------------------- 1 | from .unipc import UniPC 2 | from .noise_scheduler import NoiseScheduleVP 3 | -------------------------------------------------------------------------------- /core/shared.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from concurrent.futures import ThreadPoolExecutor 3 | from typing import TYPE_CHECKING, List, Optional, Literal 4 | 5 | from .types import PyTorchModelBase 6 | 7 | if TYPE_CHECKING: 8 | from uvicorn import Server 9 | 10 | amd: bool = False 11 | all_gpus: List = [] 12 | current_model: Optional[PyTorchModelBase] = None 13 | current_method: Literal[None, "txt2img", "img2img", "inpainting", "controlnet"] = None 14 | current_steps: int = 50 15 | current_done_steps: int = 0 16 | asyncio_loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() 17 | interrupt: bool = False 18 | threadpool = ThreadPoolExecutor(max_workers=1) 19 | 20 | uvicorn_server: Optional["Server"] = None 21 | uvicorn_loop: Optional[asyncio.AbstractEventLoop] = None 22 | asyncio_tasks: List[asyncio.Task] = [] 23 | 24 | api_port: int = 5003 25 | -------------------------------------------------------------------------------- /core/shared_dependent.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING, Any, Optional, Tuple, Union 2 | 3 | from core.files import CachedModelList 4 | from core.gpu import GPU 5 | 6 | if TYPE_CHECKING: 7 | from controlnet_aux import ( 8 | CannyDetector, 9 | HEDdetector, 10 | LineartAnimeDetector, 11 | LineartDetector, 12 | MidasDetector, 13 | MLSDdetector, 14 | NormalBaeDetector, 15 | OpenposeDetector, 16 | ) 17 | from transformers.models.upernet import UperNetForSemanticSegmentation 18 | 19 | from core.extra.cloudflare_r2 import R2Bucket 20 | 21 | 22 | disable_hardware_warning: bool = False 23 | cached_model_list = CachedModelList() 24 | gpu = GPU() 25 | cached_controlnet_preprocessor: Union[ 26 | None, 27 | "CannyDetector", 28 | "MidasDetector", 29 | "HEDdetector", 30 | "MLSDdetector", 31 | "OpenposeDetector", 32 | "NormalBaeDetector", 33 | "LineartDetector", 34 | "LineartAnimeDetector", 35 | Tuple["Any", "UperNetForSemanticSegmentation"], 36 | ] = None 37 | 38 | r2: Optional["R2Bucket"] = None 39 | -------------------------------------------------------------------------------- /data/autofill/quality.txt: -------------------------------------------------------------------------------- 1 | masterpiece 2 | unreal engine 3 | 8k 4 | octane render 5 | cinematic 6 | concept art 7 | photorealistic 8 | vibrant colors 9 | high quality 10 | ultra realistic 11 | highly detailed 12 | highres 13 | CG 14 | wallpaper 15 | best illustration 16 | delicate 17 | beautiful 18 | fine detail 19 | -------------------------------------------------------------------------------- /data/lycoris/put lycoris here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/lycoris/put lycoris here.txt -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd1.5_1024x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2 2 | down_blocks.1.resnets.0.conv2:2 3 | down_blocks.1.resnets.1.conv1:2 4 | down_blocks.1.resnets.1.conv2:2 5 | down_blocks.1.downsamplers.0.conv:2 6 | down_blocks.2.resnets.0.conv1:2 7 | down_blocks.2.resnets.0.conv2:2 8 | down_blocks.2.resnets.1.conv1:2 9 | down_blocks.2.resnets.1.conv2:2 10 | down_blocks.2.downsamplers.0.conv:2 11 | down_blocks.3.resnets.0.conv1:2 12 | down_blocks.3.resnets.0.conv2:2 13 | down_blocks.3.resnets.1.conv1:2 14 | down_blocks.3.resnets.1.conv2:2 15 | up_blocks.0.resnets.0.conv1:2 16 | up_blocks.0.resnets.0.conv2:2 17 | up_blocks.0.resnets.1.conv1:2 18 | up_blocks.0.resnets.1.conv2:2 19 | up_blocks.0.resnets.2.conv1:2 20 | up_blocks.0.resnets.2.conv2:2 21 | up_blocks.0.upsamplers.0.conv:2 22 | up_blocks.1.resnets.0.conv1:2 23 | up_blocks.1.resnets.0.conv2:2 24 | up_blocks.1.resnets.1.conv1:2 25 | up_blocks.1.resnets.1.conv2:2 26 | up_blocks.1.resnets.2.conv1:2 27 | up_blocks.1.resnets.2.conv2:2 28 | up_blocks.1.upsamplers.0.conv:2 29 | up_blocks.2.resnets.0.conv1:2 30 | up_blocks.2.resnets.0.conv2:2 31 | up_blocks.2.resnets.1.conv1:2 32 | up_blocks.2.resnets.1.conv2:2 33 | up_blocks.2.resnets.2.conv1:2 34 | up_blocks.2.resnets.2.conv2:2 35 | up_blocks.2.upsamplers.0.conv:2 36 | mid_block.resnets.0.conv1:2 37 | mid_block.resnets.0.conv2:2 38 | mid_block.resnets.1.conv1:2 39 | mid_block.resnets.1.conv2:2 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd1.5_1280x1280.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2.5 2 | down_blocks.1.resnets.0.conv2:2.5 3 | down_blocks.1.resnets.1.conv1:2.5 4 | down_blocks.1.resnets.1.conv2:2.5 5 | down_blocks.1.downsamplers.0.conv:2.5 6 | down_blocks.2.resnets.0.conv1:2.5 7 | down_blocks.2.resnets.0.conv2:2.5 8 | down_blocks.2.resnets.1.conv1:2.5 9 | down_blocks.2.resnets.1.conv2:2.5 10 | down_blocks.2.downsamplers.0.conv:2.5 11 | down_blocks.3.resnets.0.conv1:2.5 12 | down_blocks.3.resnets.0.conv2:2.5 13 | down_blocks.3.resnets.1.conv1:2.5 14 | down_blocks.3.resnets.1.conv2:2.5 15 | up_blocks.0.resnets.0.conv1:2.5 16 | up_blocks.0.resnets.0.conv2:2.5 17 | up_blocks.0.resnets.1.conv1:2.5 18 | up_blocks.0.resnets.1.conv2:2.5 19 | up_blocks.0.resnets.2.conv1:2.5 20 | up_blocks.0.resnets.2.conv2:2.5 21 | up_blocks.0.upsamplers.0.conv:2.5 22 | up_blocks.1.resnets.0.conv1:2.5 23 | up_blocks.1.resnets.0.conv2:2.5 24 | up_blocks.1.resnets.1.conv1:2.5 25 | up_blocks.1.resnets.1.conv2:2.5 26 | up_blocks.1.resnets.2.conv1:2.5 27 | up_blocks.1.resnets.2.conv2:2.5 28 | up_blocks.1.upsamplers.0.conv:2.5 29 | up_blocks.2.resnets.0.conv1:2.5 30 | up_blocks.2.resnets.0.conv2:2.5 31 | up_blocks.2.resnets.1.conv1:2.5 32 | up_blocks.2.resnets.1.conv2:2.5 33 | up_blocks.2.resnets.2.conv1:2.5 34 | up_blocks.2.resnets.2.conv2:2.5 35 | up_blocks.2.upsamplers.0.conv:2.5 36 | mid_block.resnets.0.conv1:2.5 37 | mid_block.resnets.0.conv2:2.5 38 | mid_block.resnets.1.conv1:2.5 39 | mid_block.resnets.1.conv2:2.5 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd1.5_2048x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2 2 | down_blocks.1.resnets.0.conv2:2 3 | down_blocks.1.resnets.1.conv1:2 4 | down_blocks.1.resnets.1.conv2:2 5 | down_blocks.1.downsamplers.0.conv:2 6 | down_blocks.2.resnets.0.conv1:3 7 | down_blocks.2.resnets.0.conv2:3 8 | down_blocks.2.resnets.1.conv1:3 9 | down_blocks.2.resnets.1.conv2:3 10 | down_blocks.2.downsamplers.0.conv:3 11 | down_blocks.3.resnets.0.conv1:4 12 | down_blocks.3.resnets.0.conv2:4 13 | down_blocks.3.resnets.1.conv1:4 14 | down_blocks.3.resnets.1.conv2:4 15 | up_blocks.0.resnets.0.conv1:4 16 | up_blocks.0.resnets.0.conv2:4 17 | up_blocks.0.resnets.1.conv1:4 18 | up_blocks.0.resnets.1.conv2:4 19 | up_blocks.0.resnets.2.conv1:4 20 | up_blocks.0.resnets.2.conv2:4 21 | up_blocks.0.upsamplers.0.conv:4 22 | up_blocks.1.resnets.0.conv1:3 23 | up_blocks.1.resnets.0.conv2:3 24 | up_blocks.1.resnets.1.conv1:3 25 | up_blocks.1.resnets.1.conv2:3 26 | up_blocks.1.resnets.2.conv1:3 27 | up_blocks.1.resnets.2.conv2:3 28 | up_blocks.1.upsamplers.0.conv:3 29 | up_blocks.2.resnets.0.conv1:2 30 | up_blocks.2.resnets.0.conv2:2 31 | up_blocks.2.resnets.1.conv1:2 32 | up_blocks.2.resnets.1.conv2:2 33 | up_blocks.2.resnets.2.conv1:2 34 | up_blocks.2.resnets.2.conv2:2 35 | up_blocks.2.upsamplers.0.conv:2 36 | mid_block.resnets.0.conv1:4 37 | mid_block.resnets.0.conv2:4 38 | mid_block.resnets.1.conv1:4 39 | mid_block.resnets.1.conv2:4 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd1.5_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2 2 | down_blocks.1.resnets.0.conv2:2 3 | down_blocks.1.resnets.1.conv1:2 4 | down_blocks.1.resnets.1.conv2:2 5 | down_blocks.1.downsamplers.0.conv:2 6 | down_blocks.2.resnets.0.conv1:3 7 | down_blocks.2.resnets.0.conv2:3 8 | down_blocks.2.resnets.1.conv1:3 9 | down_blocks.2.resnets.1.conv2:3 10 | down_blocks.2.downsamplers.0.conv:3 11 | down_blocks.3.resnets.0.conv1:4 12 | down_blocks.3.resnets.0.conv2:4 13 | down_blocks.3.resnets.1.conv1:4 14 | down_blocks.3.resnets.1.conv2:4 15 | up_blocks.0.resnets.0.conv1:4 16 | up_blocks.0.resnets.0.conv2:4 17 | up_blocks.0.resnets.1.conv1:4 18 | up_blocks.0.resnets.1.conv2:4 19 | up_blocks.0.resnets.2.conv1:4 20 | up_blocks.0.resnets.2.conv2:4 21 | up_blocks.0.upsamplers.0.conv:4 22 | up_blocks.1.resnets.0.conv1:3 23 | up_blocks.1.resnets.0.conv2:3 24 | up_blocks.1.resnets.1.conv1:3 25 | up_blocks.1.resnets.1.conv2:3 26 | up_blocks.1.resnets.2.conv1:3 27 | up_blocks.1.resnets.2.conv2:3 28 | up_blocks.1.upsamplers.0.conv:3 29 | up_blocks.2.resnets.0.conv1:2 30 | up_blocks.2.resnets.0.conv2:2 31 | up_blocks.2.resnets.1.conv1:2 32 | up_blocks.2.resnets.1.conv2:2 33 | up_blocks.2.resnets.2.conv1:2 34 | up_blocks.2.resnets.2.conv2:2 35 | up_blocks.2.upsamplers.0.conv:2 36 | mid_block.resnets.0.conv1:4 37 | mid_block.resnets.0.conv2:4 38 | mid_block.resnets.1.conv1:4 39 | mid_block.resnets.1.conv2:4 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd2.1_1024x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2 2 | down_blocks.1.resnets.0.conv2:2 3 | down_blocks.1.resnets.1.conv1:2 4 | down_blocks.1.resnets.1.conv2:2 5 | down_blocks.1.downsamplers.0.conv:2 6 | down_blocks.2.resnets.0.conv1:2 7 | down_blocks.2.resnets.0.conv2:2 8 | down_blocks.2.resnets.1.conv1:2 9 | down_blocks.2.resnets.1.conv2:2 10 | down_blocks.2.downsamplers.0.conv:2 11 | down_blocks.3.resnets.0.conv1:2 12 | down_blocks.3.resnets.0.conv2:2 13 | down_blocks.3.resnets.1.conv1:2 14 | down_blocks.3.resnets.1.conv2:2 15 | up_blocks.0.resnets.0.conv1:2 16 | up_blocks.0.resnets.0.conv2:2 17 | up_blocks.0.resnets.1.conv1:2 18 | up_blocks.0.resnets.1.conv2:2 19 | up_blocks.0.resnets.2.conv1:2 20 | up_blocks.0.resnets.2.conv2:2 21 | up_blocks.0.upsamplers.0.conv:2 22 | up_blocks.1.resnets.0.conv1:2 23 | up_blocks.1.resnets.0.conv2:2 24 | up_blocks.1.resnets.1.conv1:2 25 | up_blocks.1.resnets.1.conv2:2 26 | up_blocks.1.resnets.2.conv1:2 27 | up_blocks.1.resnets.2.conv2:2 28 | up_blocks.1.upsamplers.0.conv:2 29 | up_blocks.2.resnets.0.conv1:2 30 | up_blocks.2.resnets.0.conv2:2 31 | up_blocks.2.resnets.1.conv1:2 32 | up_blocks.2.resnets.1.conv2:2 33 | up_blocks.2.resnets.2.conv1:2 34 | up_blocks.2.resnets.2.conv2:2 35 | up_blocks.2.upsamplers.0.conv:2 36 | mid_block.resnets.0.conv1:2 37 | mid_block.resnets.0.conv2:2 38 | mid_block.resnets.1.conv1:2 39 | mid_block.resnets.1.conv2:2 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd2.1_1280x1280.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2.5 2 | down_blocks.1.resnets.0.conv2:2.5 3 | down_blocks.1.resnets.1.conv1:2.5 4 | down_blocks.1.resnets.1.conv2:2.5 5 | down_blocks.1.downsamplers.0.conv:2.5 6 | down_blocks.2.resnets.0.conv1:2.5 7 | down_blocks.2.resnets.0.conv2:2.5 8 | down_blocks.2.resnets.1.conv1:2.5 9 | down_blocks.2.resnets.1.conv2:2.5 10 | down_blocks.2.downsamplers.0.conv:2.5 11 | down_blocks.3.resnets.0.conv1:2.5 12 | down_blocks.3.resnets.0.conv2:2.5 13 | down_blocks.3.resnets.1.conv1:2.5 14 | down_blocks.3.resnets.1.conv2:2.5 15 | up_blocks.0.resnets.0.conv1:2.5 16 | up_blocks.0.resnets.0.conv2:2.5 17 | up_blocks.0.resnets.1.conv1:2.5 18 | up_blocks.0.resnets.1.conv2:2.5 19 | up_blocks.0.resnets.2.conv1:2.5 20 | up_blocks.0.resnets.2.conv2:2.5 21 | up_blocks.0.upsamplers.0.conv:2.5 22 | up_blocks.1.resnets.0.conv1:2.5 23 | up_blocks.1.resnets.0.conv2:2.5 24 | up_blocks.1.resnets.1.conv1:2.5 25 | up_blocks.1.resnets.1.conv2:2.5 26 | up_blocks.1.resnets.2.conv1:2.5 27 | up_blocks.1.resnets.2.conv2:2.5 28 | up_blocks.1.upsamplers.0.conv:2.5 29 | up_blocks.2.resnets.0.conv1:2.5 30 | up_blocks.2.resnets.0.conv2:2.5 31 | up_blocks.2.resnets.1.conv1:2.5 32 | up_blocks.2.resnets.1.conv2:2.5 33 | up_blocks.2.resnets.2.conv1:2.5 34 | up_blocks.2.resnets.2.conv2:2.5 35 | up_blocks.2.upsamplers.0.conv:2.5 36 | mid_block.resnets.0.conv1:2.5 37 | mid_block.resnets.0.conv2:2.5 38 | mid_block.resnets.1.conv1:2.5 39 | mid_block.resnets.1.conv2:2.5 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd2.1_2048x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1:2 2 | down_blocks.1.resnets.0.conv2:2 3 | down_blocks.1.resnets.1.conv1:2 4 | down_blocks.1.resnets.1.conv2:2 5 | down_blocks.1.downsamplers.0.conv:2 6 | down_blocks.2.resnets.0.conv1:3 7 | down_blocks.2.resnets.0.conv2:3 8 | down_blocks.2.resnets.1.conv1:3 9 | down_blocks.2.resnets.1.conv2:3 10 | down_blocks.2.downsamplers.0.conv:3 11 | down_blocks.3.resnets.0.conv1:4 12 | down_blocks.3.resnets.0.conv2:4 13 | down_blocks.3.resnets.1.conv1:4 14 | down_blocks.3.resnets.1.conv2:4 15 | up_blocks.0.resnets.0.conv1:4 16 | up_blocks.0.resnets.0.conv2:4 17 | up_blocks.0.resnets.1.conv1:4 18 | up_blocks.0.resnets.1.conv2:4 19 | up_blocks.0.resnets.2.conv1:4 20 | up_blocks.0.resnets.2.conv2:4 21 | up_blocks.0.upsamplers.0.conv:4 22 | up_blocks.1.resnets.0.conv1:3 23 | up_blocks.1.resnets.0.conv2:3 24 | up_blocks.1.resnets.1.conv1:3 25 | up_blocks.1.resnets.1.conv2:3 26 | up_blocks.1.resnets.2.conv1:3 27 | up_blocks.1.resnets.2.conv2:3 28 | up_blocks.1.upsamplers.0.conv:3 29 | up_blocks.2.resnets.0.conv1:2 30 | up_blocks.2.resnets.0.conv2:2 31 | up_blocks.2.resnets.1.conv1:2 32 | up_blocks.2.resnets.1.conv2:2 33 | up_blocks.2.resnets.2.conv1:2 34 | up_blocks.2.resnets.2.conv2:2 35 | up_blocks.2.upsamplers.0.conv:2 36 | mid_block.resnets.0.conv1:4 37 | mid_block.resnets.0.conv2:4 38 | mid_block.resnets.1.conv1:4 39 | mid_block.resnets.1.conv2:4 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sd2.1_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:4 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:4 18 | up_blocks.1.resnets.0.conv2:4 19 | up_blocks.1.resnets.1.conv1:4 20 | up_blocks.1.resnets.1.conv2:4 21 | up_blocks.1.resnets.2.conv1:4 22 | up_blocks.1.resnets.2.conv2:4 23 | up_blocks.1.upsamplers.0.conv:4 24 | up_blocks.2.resnets.0.conv1:3 25 | up_blocks.2.resnets.0.conv2:3 26 | up_blocks.2.resnets.1.conv1:3 27 | up_blocks.2.resnets.1.conv2:3 28 | up_blocks.2.resnets.2.conv1:3 29 | up_blocks.2.resnets.2.conv2:3 30 | up_blocks.2.upsamplers.0.conv:3 31 | up_blocks.3.resnets.0.conv1:2 32 | up_blocks.3.resnets.0.conv2:2 33 | up_blocks.3.resnets.1.conv1:2 34 | up_blocks.3.resnets.1.conv2:2 35 | up_blocks.3.resnets.2.conv1:2 36 | up_blocks.3.resnets.2.conv2:2 37 | mid_block.resnets.0.conv1:4 38 | mid_block.resnets.0.conv2:4 39 | mid_block.resnets.1.conv1:4 40 | mid_block.resnets.1.conv2:4 41 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sdxl_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.3.resnets.0.conv1:2 2 | down_blocks.3.resnets.0.conv2:2 3 | down_blocks.3.resnets.1.conv1:2 4 | down_blocks.3.resnets.1.conv2:2 5 | up_blocks.0.resnets.0.conv1:2 6 | up_blocks.0.resnets.0.conv2:2 7 | up_blocks.0.resnets.1.conv1:2 8 | up_blocks.0.resnets.1.conv2:2 9 | up_blocks.0.resnets.2.conv1:2 10 | up_blocks.0.resnets.2.conv2:2 11 | up_blocks.0.upsamplers.0.conv:2 12 | mid_block.resnets.0.conv1:2 13 | mid_block.resnets.0.conv2:2 14 | mid_block.resnets.1.conv1:2 15 | mid_block.resnets.1.conv2:2 16 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sdxl_2560x2560.txt: -------------------------------------------------------------------------------- 1 | down_blocks.3.resnets.0.conv1:2.5 2 | down_blocks.3.resnets.0.conv2:2.5 3 | down_blocks.3.resnets.1.conv1:2.5 4 | down_blocks.3.resnets.1.conv2:2.5 5 | up_blocks.0.resnets.0.conv1:2.5 6 | up_blocks.0.resnets.0.conv2:2.5 7 | up_blocks.0.resnets.1.conv1:2.5 8 | up_blocks.0.resnets.1.conv2:2.5 9 | up_blocks.0.resnets.2.conv1:2.5 10 | up_blocks.0.resnets.2.conv2:2.5 11 | up_blocks.0.upsamplers.0.conv:2.5 12 | mid_block.resnets.0.conv1:2.5 13 | mid_block.resnets.0.conv2:2.5 14 | mid_block.resnets.1.conv1:2.5 15 | mid_block.resnets.1.conv2:2.5 16 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sdxl_4096x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:3 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:3 18 | up_blocks.1.resnets.0.conv2:3 19 | up_blocks.1.resnets.1.conv1:3 20 | up_blocks.1.resnets.1.conv2:3 21 | up_blocks.1.resnets.2.conv1:3 22 | up_blocks.1.resnets.2.conv2:3 23 | up_blocks.1.upsamplers.0.conv:3 24 | up_blocks.2.resnets.0.conv1:2 25 | up_blocks.2.resnets.0.conv2:2 26 | up_blocks.2.resnets.1.conv1:2 27 | up_blocks.2.resnets.1.conv2:2 28 | up_blocks.2.resnets.2.conv1:2 29 | up_blocks.2.resnets.2.conv2:2 30 | up_blocks.2.upsamplers.0.conv:2 31 | mid_block.resnets.0.conv1:4 32 | mid_block.resnets.0.conv2:4 33 | mid_block.resnets.1.conv1:4 34 | mid_block.resnets.1.conv2:4 35 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/dilate_settings/sdxl_4096x4096.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:4 2 | down_blocks.2.resnets.0.conv2:4 3 | down_blocks.2.resnets.1.conv1:4 4 | down_blocks.2.resnets.1.conv2:4 5 | down_blocks.2.downsamplers.0.conv:4 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:3 18 | up_blocks.1.resnets.0.conv2:3 19 | up_blocks.1.resnets.1.conv1:3 20 | up_blocks.1.resnets.1.conv2:3 21 | up_blocks.1.resnets.2.conv1:3 22 | up_blocks.1.resnets.2.conv2:3 23 | up_blocks.1.upsamplers.0.conv:3 24 | up_blocks.2.resnets.0.conv1:2 25 | up_blocks.2.resnets.0.conv2:2 26 | up_blocks.2.resnets.1.conv1:2 27 | up_blocks.2.resnets.1.conv2:2 28 | up_blocks.2.resnets.2.conv1:2 29 | up_blocks.2.resnets.2.conv2:2 30 | up_blocks.2.upsamplers.0.conv:2 31 | mid_block.resnets.0.conv1:4 32 | mid_block.resnets.0.conv2:4 33 | mid_block.resnets.1.conv1:4 34 | mid_block.resnets.1.conv2:4 35 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/disperse_settings/sd1.5_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.downsamplers.0.conv 2 | down_blocks.3.resnets.0.conv1 3 | down_blocks.3.resnets.0.conv2 4 | down_blocks.3.resnets.1.conv1 5 | down_blocks.3.resnets.1.conv2 6 | up_blocks.0.resnets.0.conv1 7 | up_blocks.0.resnets.0.conv2 8 | up_blocks.0.resnets.1.conv1 9 | up_blocks.0.resnets.1.conv2 10 | up_blocks.0.resnets.2.conv1 11 | up_blocks.0.resnets.2.conv2 12 | up_blocks.0.upsamplers.0.conv 13 | up_blocks.1.resnets.0.conv1 14 | up_blocks.1.resnets.0.conv2 15 | up_blocks.1.resnets.1.conv1 16 | up_blocks.1.resnets.1.conv2 17 | up_blocks.1.resnets.2.conv1 18 | up_blocks.1.resnets.2.conv2 19 | up_blocks.1.upsamplers.0.conv 20 | mid_block.resnets.0.conv1 21 | mid_block.resnets.0.conv2 22 | mid_block.resnets.1.conv1 23 | mid_block.resnets.1.conv2 24 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/disperse_settings/sd2.1_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.downsamplers.0.conv 2 | down_blocks.3.resnets.0.conv1 3 | down_blocks.3.resnets.0.conv2 4 | down_blocks.3.resnets.1.conv1 5 | down_blocks.3.resnets.1.conv2 6 | up_blocks.0.resnets.0.conv1 7 | up_blocks.0.resnets.0.conv2 8 | up_blocks.0.resnets.1.conv1 9 | up_blocks.0.resnets.1.conv2 10 | up_blocks.0.resnets.2.conv1 11 | up_blocks.0.resnets.2.conv2 12 | up_blocks.0.upsamplers.0.conv 13 | up_blocks.1.resnets.0.conv1 14 | up_blocks.1.resnets.0.conv2 15 | up_blocks.1.resnets.1.conv1 16 | up_blocks.1.resnets.1.conv2 17 | up_blocks.1.resnets.2.conv1 18 | up_blocks.1.resnets.2.conv2 19 | up_blocks.1.upsamplers.0.conv 20 | mid_block.resnets.0.conv1 21 | mid_block.resnets.0.conv2 22 | mid_block.resnets.1.conv1 23 | mid_block.resnets.1.conv2 24 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/disperse_settings/sdxl_4096x4096.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1 2 | down_blocks.2.resnets.0.conv2 3 | down_blocks.2.resnets.1.conv1 4 | down_blocks.2.resnets.1.conv2 5 | down_blocks.2.downsamplers.0.conv 6 | up_blocks.0.resnets.0.conv1 7 | up_blocks.0.resnets.0.conv2 8 | up_blocks.0.resnets.1.conv1 9 | up_blocks.0.resnets.1.conv2 10 | up_blocks.0.resnets.2.conv1 11 | up_blocks.0.resnets.2.conv2 12 | up_blocks.0.upsamplers.0.conv 13 | mid_block.resnets.0.conv1 14 | mid_block.resnets.0.conv2 15 | mid_block.resnets.1.conv1 16 | mid_block.resnets.1.conv2 -------------------------------------------------------------------------------- /data/scalecrafter/assets/inflate_settings/sd1.5_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.1.resnets.0.conv1 2 | down_blocks.1.resnets.0.conv2 3 | down_blocks.1.resnets.1.conv1 4 | down_blocks.1.resnets.1.conv2 5 | down_blocks.1.downsamplers.0.conv 6 | down_blocks.2.resnets.0.conv1 7 | down_blocks.2.resnets.0.conv2 8 | down_blocks.2.resnets.1.conv1 9 | down_blocks.2.resnets.1.conv2 10 | down_blocks.2.downsamplers.0.conv 11 | down_blocks.3.resnets.0.conv1 12 | down_blocks.3.resnets.0.conv2 13 | down_blocks.3.resnets.1.conv1 14 | down_blocks.3.resnets.1.conv2 15 | up_blocks.0.resnets.0.conv1 16 | up_blocks.0.resnets.0.conv2 17 | up_blocks.0.resnets.1.conv1 18 | up_blocks.0.resnets.1.conv2 19 | up_blocks.0.resnets.2.conv1 20 | up_blocks.0.resnets.2.conv2 21 | up_blocks.0.upsamplers.0.conv 22 | up_blocks.1.resnets.0.conv1 23 | up_blocks.1.resnets.0.conv2 24 | up_blocks.1.resnets.1.conv1 25 | up_blocks.1.resnets.1.conv2 26 | up_blocks.1.resnets.2.conv1 27 | up_blocks.1.resnets.2.conv2 28 | up_blocks.1.upsamplers.0.conv 29 | up_blocks.2.resnets.0.conv1 30 | up_blocks.2.resnets.0.conv2 31 | up_blocks.2.resnets.1.conv1 32 | up_blocks.2.resnets.1.conv2 33 | up_blocks.2.resnets.2.conv1 34 | up_blocks.2.resnets.2.conv2 35 | up_blocks.2.upsamplers.0.conv 36 | mid_block.resnets.0.conv1 37 | mid_block.resnets.0.conv2 38 | mid_block.resnets.1.conv1 39 | mid_block.resnets.1.conv2 40 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/inflate_settings/sdxl_4096x4096.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/scalecrafter/assets/inflate_settings/sdxl_4096x4096.txt -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sd1.5_2048x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:3 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:3 18 | up_blocks.1.resnets.0.conv2:3 19 | up_blocks.1.resnets.1.conv1:3 20 | up_blocks.1.resnets.1.conv2:3 21 | up_blocks.1.resnets.2.conv1:3 22 | up_blocks.1.resnets.2.conv2:3 23 | up_blocks.1.upsamplers.0.conv:3 24 | mid_block.resnets.0.conv1:4 25 | mid_block.resnets.0.conv2:4 26 | mid_block.resnets.1.conv1:4 27 | mid_block.resnets.1.conv2:4 28 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sd1.5_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:3 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:3 18 | up_blocks.1.resnets.0.conv2:3 19 | up_blocks.1.resnets.1.conv1:3 20 | up_blocks.1.resnets.1.conv2:3 21 | up_blocks.1.resnets.2.conv1:3 22 | up_blocks.1.resnets.2.conv2:3 23 | up_blocks.1.upsamplers.0.conv:3 24 | mid_block.resnets.0.conv1:4 25 | mid_block.resnets.0.conv2:4 26 | mid_block.resnets.1.conv1:4 27 | mid_block.resnets.1.conv2:4 28 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sd2.1_2048x1024.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:4 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:4 18 | up_blocks.1.resnets.0.conv2:4 19 | up_blocks.1.resnets.1.conv1:4 20 | up_blocks.1.resnets.1.conv2:4 21 | up_blocks.1.resnets.2.conv1:4 22 | up_blocks.1.resnets.2.conv2:4 23 | up_blocks.1.upsamplers.0.conv:4 24 | up_blocks.2.resnets.0.conv1:3 25 | up_blocks.2.resnets.0.conv2:3 26 | up_blocks.2.resnets.1.conv1:3 27 | up_blocks.2.resnets.1.conv2:3 28 | up_blocks.2.resnets.2.conv1:3 29 | up_blocks.2.resnets.2.conv2:3 30 | up_blocks.2.upsamplers.0.conv:3 31 | mid_block.resnets.0.conv1:4 32 | mid_block.resnets.0.conv2:4 33 | mid_block.resnets.1.conv1:4 34 | mid_block.resnets.1.conv2:4 35 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sd2.1_2048x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.2.resnets.0.conv1:3 2 | down_blocks.2.resnets.0.conv2:3 3 | down_blocks.2.resnets.1.conv1:3 4 | down_blocks.2.resnets.1.conv2:3 5 | down_blocks.2.downsamplers.0.conv:4 6 | down_blocks.3.resnets.0.conv1:4 7 | down_blocks.3.resnets.0.conv2:4 8 | down_blocks.3.resnets.1.conv1:4 9 | down_blocks.3.resnets.1.conv2:4 10 | up_blocks.0.resnets.0.conv1:4 11 | up_blocks.0.resnets.0.conv2:4 12 | up_blocks.0.resnets.1.conv1:4 13 | up_blocks.0.resnets.1.conv2:4 14 | up_blocks.0.resnets.2.conv1:4 15 | up_blocks.0.resnets.2.conv2:4 16 | up_blocks.0.upsamplers.0.conv:4 17 | up_blocks.1.resnets.0.conv1:4 18 | up_blocks.1.resnets.0.conv2:4 19 | up_blocks.1.resnets.1.conv1:4 20 | up_blocks.1.resnets.1.conv2:4 21 | up_blocks.1.resnets.2.conv1:4 22 | up_blocks.1.resnets.2.conv2:4 23 | up_blocks.1.upsamplers.0.conv:4 24 | up_blocks.2.resnets.0.conv1:3 25 | up_blocks.2.resnets.0.conv2:3 26 | up_blocks.2.resnets.1.conv1:3 27 | up_blocks.2.resnets.1.conv2:3 28 | up_blocks.2.resnets.2.conv1:3 29 | up_blocks.2.resnets.2.conv2:3 30 | up_blocks.2.upsamplers.0.conv:3 31 | mid_block.resnets.0.conv1:4 32 | mid_block.resnets.0.conv2:4 33 | mid_block.resnets.1.conv1:4 34 | mid_block.resnets.1.conv2:4 35 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sdxl_4096x2048.txt: -------------------------------------------------------------------------------- 1 | down_blocks.3.resnets.0.conv1:2 2 | down_blocks.3.resnets.0.conv2:2 3 | down_blocks.3.resnets.1.conv1:2 4 | down_blocks.3.resnets.1.conv2:2 5 | up_blocks.0.resnets.0.conv1:2 6 | up_blocks.0.resnets.0.conv2:2 7 | up_blocks.0.resnets.1.conv1:2 8 | up_blocks.0.resnets.1.conv2:2 9 | up_blocks.0.resnets.2.conv1:2 10 | up_blocks.0.resnets.2.conv2:2 11 | up_blocks.0.upsamplers.0.conv:2 12 | mid_block.resnets.0.conv1:2 13 | mid_block.resnets.0.conv2:2 14 | mid_block.resnets.1.conv1:2 15 | mid_block.resnets.1.conv2:2 16 | -------------------------------------------------------------------------------- /data/scalecrafter/assets/ndcfg_dilate_settings/sdxl_4096x4096.txt: -------------------------------------------------------------------------------- 1 | down_blocks.3.resnets.0.conv1:2 2 | down_blocks.3.resnets.0.conv2:2 3 | down_blocks.3.resnets.1.conv1:2 4 | down_blocks.3.resnets.1.conv2:2 5 | up_blocks.0.resnets.0.conv1:2 6 | up_blocks.0.resnets.0.conv2:2 7 | up_blocks.0.resnets.1.conv1:2 8 | up_blocks.0.resnets.1.conv2:2 9 | up_blocks.0.resnets.2.conv1:2 10 | up_blocks.0.resnets.2.conv2:2 11 | up_blocks.0.upsamplers.0.conv:2 12 | mid_block.resnets.0.conv1:2 13 | mid_block.resnets.0.conv2:2 14 | mid_block.resnets.1.conv1:2 15 | mid_block.resnets.1.conv2:2 16 | -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd1.5_1024x1024.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 30 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd1.5_1024x1024.txt 5 | ndcfg_dilate_settings: ~ 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: false 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 128 13 | latent_width: 128 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd1.5_1280x1280.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd1.5_1280x1280.txt 5 | ndcfg_dilate_settings: ~ 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: false 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 160 13 | latent_width: 160 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd1.5_2048x1024.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd1.5_2048x1024.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd1.5_2048x1024.txt 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 128 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd1.5_2048x2048.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd1.5_2048x2048.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd1.5_2048x2048.txt 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 256 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd1.5_2048x2048_disperse.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd1.5_2048x2048.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd1.5_2048x2048.txt 6 | disperse_settings: ./assets/disperse_settings/sd1.5_2048x2048.txt 7 | disperse_transform: ./transforms/R20to1_new.mat 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 256 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd2.1_1024x1024.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 20 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd2.1_1024x1024.txt 5 | ndcfg_dilate_settings: ~ 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: false 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 128 13 | latent_width: 128 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd2.1_1280x1280.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 30 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd2.1_1280x1280.txt 5 | ndcfg_dilate_settings: ~ 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: false 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 160 13 | latent_width: 160 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd2.1_2048x1024.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 37 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd2.1_2048x1024.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd2.1_2048x1024.txt 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 4 11 | num_iters_per_prompt: 1 12 | latent_height: 128 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd2.1_2048x2048.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 37 2 | dilate_tau: 37 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd2.1_2048x2048.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd2.1_2048x2048.txt 6 | disperse_settings: ~ 7 | disperse_transform: ~ 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 1 11 | num_iters_per_prompt: 1 12 | latent_height: 256 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sd2.1_2048x2048_disperse.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 37 2 | dilate_tau: 37 3 | inflate_tau: 0 4 | dilate_settings: ./assets/dilate_settings/sd2.1_2048x2048.txt 5 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sd2.1_2048x2048.txt 6 | disperse_settings: ./assets/disperse_settings/sd2.1_2048x2048.txt 7 | disperse_transform: ./transforms/R20to1_new.mat 8 | progressive: true 9 | num_inference_steps: 50 10 | inference_batch_size: 1 11 | num_iters_per_prompt: 1 12 | latent_height: 256 13 | latent_width: 256 -------------------------------------------------------------------------------- /data/scalecrafter/configs/sdxl_2048x2048.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 30 3 | inflate_tau: 0 4 | sdedit_tau: 0 5 | dilate_settings: ./assets/dilate_settings/sdxl_2048x2048.txt 6 | ndcfg_dilate_settings: ~ 7 | disperse_settings: ~ 8 | disperse_transform: ~ 9 | progressive: false 10 | num_inference_steps: 50 11 | inference_batch_size: 4 12 | num_iters_per_prompt: 1 13 | latent_height: 256 14 | latent_width: 256 15 | pixel_height: 2048 16 | pixel_width: 2048 17 | -------------------------------------------------------------------------------- /data/scalecrafter/configs/sdxl_2560x2560.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 0 2 | dilate_tau: 30 3 | inflate_tau: 0 4 | sdedit_tau: 0 5 | dilate_settings: ./assets/dilate_settings/sdxl_2560x2560.txt 6 | ndcfg_dilate_settings: ~ 7 | disperse_settings: ~ 8 | disperse_transform: ~ 9 | progressive: false 10 | num_inference_steps: 50 11 | inference_batch_size: 4 12 | num_iters_per_prompt: 1 13 | latent_height: 320 14 | latent_width: 320 15 | pixel_height: 2560 16 | pixel_width: 2560 17 | -------------------------------------------------------------------------------- /data/scalecrafter/configs/sdxl_4096x2048.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | sdedit_tau: 0 5 | dilate_settings: ./assets/dilate_settings/sdxl_4096x2048.txt 6 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sdxl_4096x2048.txt 7 | disperse_settings: ~ 8 | disperse_transform: ~ 9 | progressive: true 10 | num_inference_steps: 50 11 | inference_batch_size: 1 12 | num_iters_per_prompt: 1 13 | latent_height: 256 14 | latent_width: 512 15 | pixel_height: 2048 16 | pixel_width: 4096 17 | -------------------------------------------------------------------------------- /data/scalecrafter/configs/sdxl_4096x4096.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | sdedit_tau: 0 5 | dilate_settings: ./assets/dilate_settings/sdxl_4096x4096.txt 6 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sdxl_4096x4096.txt 7 | disperse_settings: ~ 8 | disperse_transform: ~ 9 | progressive: true 10 | num_inference_steps: 50 11 | inference_batch_size: 1 12 | num_iters_per_prompt: 1 13 | latent_height: 512 14 | latent_width: 512 15 | pixel_height: 4096 16 | pixel_width: 4096 17 | -------------------------------------------------------------------------------- /data/scalecrafter/configs/sdxl_4096x4096_disperse.yaml: -------------------------------------------------------------------------------- 1 | ndcfg_tau: 35 2 | dilate_tau: 35 3 | inflate_tau: 0 4 | sdedit_tau: 0 5 | dilate_settings: ./assets/dilate_settings/sdxl_4096x4096.txt 6 | ndcfg_dilate_settings: ./assets/ndcfg_dilate_settings/sdxl_4096x4096.txt 7 | disperse_settings: ./assets/disperse_settings/sdxl_4096x4096.txt 8 | disperse_transform: ./transforms/R20to1_new.mat 9 | progressive: true 10 | num_inference_steps: 50 11 | inference_batch_size: 1 12 | num_iters_per_prompt: 1 13 | latent_height: 512 14 | latent_width: 512 15 | pixel_height: 4096 16 | pixel_width: 4096 17 | -------------------------------------------------------------------------------- /data/scalecrafter/disperse/conv2d.m: -------------------------------------------------------------------------------- 1 | function out = conv2d(input, kernel, padding) 2 | % Get the dimensions of the input and kernel 3 | [input_rows, input_cols] = size(input); 4 | [kernel_rows, kernel_cols] = size(kernel); 5 | 6 | % Calculate the output dimensions with padding 7 | output_rows = input_rows + 2 * padding - kernel_rows + 1; 8 | output_cols = input_cols + 2 * padding - kernel_cols + 1; 9 | 10 | % Initialize the padded input with zeros 11 | padded_input = sym(zeros(input_rows + 2 * padding, input_cols + 2 * padding)); 12 | 13 | % Fill the padded input with the original input values 14 | padded_input(padding + 1 : padding + input_rows, padding + 1 : padding + input_cols) = input; 15 | 16 | % Initialize the output matrix with zeros 17 | out = sym(zeros(output_rows, output_cols)); 18 | 19 | % Perform the 2D convolution 20 | for m = 1 : output_rows 21 | for n = 1 : output_cols 22 | temp_sum = 0; 23 | for k = 1 : kernel_rows 24 | for l = 1 : kernel_cols 25 | temp_sum = temp_sum + kernel(k, l) * padded_input(m + k - 1, n + l - 1); 26 | end 27 | end 28 | out(m, n) = temp_sum; 29 | end 30 | end 31 | end -------------------------------------------------------------------------------- /data/scalecrafter/disperse/sym_kernel.m: -------------------------------------------------------------------------------- 1 | function kernel = sym_kernel(symbol, height, width) 2 | kernel = sym(zeros([height, width])); 3 | for i = 1:height 4 | for j = 1:width 5 | index = (i - 1) * width + j; 6 | kernel(i, j) = str2sym(sprintf("%s%d", symbol, index)); 7 | end 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /data/scalecrafter/transforms/R20to1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/scalecrafter/transforms/R20to1.mat -------------------------------------------------------------------------------- /data/scalecrafter/transforms/R20to1_new.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/scalecrafter/transforms/R20to1_new.mat -------------------------------------------------------------------------------- /data/scalecrafter/transforms/R2to1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/scalecrafter/transforms/R2to1.mat -------------------------------------------------------------------------------- /data/themes/dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "volta": { 3 | "base": "dark", 4 | "blur": "6px", 5 | "backgroundImage": "https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/2cf7a8abf1e5035a0dc57a67cd13505653c492f6/static/volta-dark-background.svg" 6 | }, 7 | "common": { 8 | "fontSize": "15px", 9 | "fontWeight": "600" 10 | }, 11 | "Card": { 12 | "color": "rgba(24, 24, 28, 0.6)" 13 | }, 14 | "Layout": { 15 | "color": "rgba(16, 16, 20, 0.6)", 16 | "siderColor": "rgba(24, 24, 28, 0)", 17 | "siderBorderColor": "rgba(255, 255, 255, 0)" 18 | }, 19 | "Tabs": { 20 | "colorSegment": "rgba(24, 24, 28, 0.6)" 21 | }, 22 | "Drawer": { 23 | "color": "rgba(44, 44, 50, 0)" 24 | } 25 | } -------------------------------------------------------------------------------- /data/themes/dark_flat.json: -------------------------------------------------------------------------------- 1 | { 2 | "volta": { 3 | "base": "dark", 4 | "blur": "0" 5 | }, 6 | "common": { 7 | "fontSize": "15px", 8 | "fontWeight": "600" 9 | } 10 | } -------------------------------------------------------------------------------- /data/themes/light.json: -------------------------------------------------------------------------------- 1 | { 2 | "volta": { 3 | "base": "light", 4 | "blur": "6px", 5 | "backgroundImage": "https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/2cf7a8abf1e5035a0dc57a67cd13505653c492f6/static/volta-light-background.svg" 6 | }, 7 | "common": { 8 | "fontSize": "15px", 9 | "fontWeight": "600" 10 | }, 11 | "Card": { 12 | "color": "rgba(255, 255, 255, 0.6)" 13 | }, 14 | "Layout": { 15 | "color": "rgba(255, 255, 255, 0.6)", 16 | "siderColor": "rgba(24, 24, 28, 0)", 17 | "siderBorderColor": "rgba(255, 255, 255, 0)" 18 | }, 19 | "Tabs": { 20 | "colorSegment": "rgba(255, 255, 255, 0.6)" 21 | }, 22 | "Tooltip": { 23 | "color": "rgba(255, 255, 255, 1)", 24 | "textColor": "rgba(21, 21, 21, 1)" 25 | } 26 | } -------------------------------------------------------------------------------- /data/themes/light_flat.json: -------------------------------------------------------------------------------- 1 | { 2 | "volta": { 3 | "base": "light", 4 | "blur": "0" 5 | }, 6 | "common": { 7 | "fontSize": "15px", 8 | "fontWeight": "600" 9 | }, 10 | "Tooltip": { 11 | "color": "rgba(255, 255, 255, 1)", 12 | "textColor": "rgba(21, 21, 21, 1)" 13 | } 14 | } -------------------------------------------------------------------------------- /data/vae/put vae here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/data/vae/put vae here.txt -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | voltaml: 5 | image: stax124/volta:latest 6 | pull_policy: always # Pull the latest image - feel free to remove this line if you want to stay on your current version 7 | environment: 8 | # General 9 | - HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN} 10 | - LOG_LEVEL=${LOG_LEVEL} 11 | - EXTRA_ARGS=${EXTRA_ARGS} 12 | 13 | # Extra api keys 14 | - FASTAPI_ANALYTICS_KEY=${FASTAPI_ANALYTICS_KEY} 15 | - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN} 16 | 17 | # R2 18 | - R2_ENDPOINT=${R2_ENDPOINT} 19 | - R2_BUCKET_NAME=${R2_BUCKET_NAME} 20 | - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} 21 | - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} 22 | - R2_DEV_ADDRESS=${R2_DEV_ADDRESS} 23 | volumes: 24 | - XXX:/app/data # XXX is the path to the folder where all the outputs will be saved 25 | - YYY/.cache/huggingface:/root/.cache/huggingface # YYY is path to your home folder (you may need to change the YYY/.cache/huggingface to YYY\.cache\huggingface on Windows) 26 | ports: 27 | - "5003:5003" 28 | deploy: 29 | resources: 30 | reservations: 31 | devices: 32 | - driver: nvidia 33 | capabilities: ["gpu"] 34 | 35 | volumes: 36 | cache: {} 37 | -------------------------------------------------------------------------------- /docker/ait-no-mount.docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | voltaml: 5 | image: stax124/volta:experimental-ait 6 | environment: 7 | # General 8 | - HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN:-} 9 | - LOG_LEVEL=${LOG_LEVEL:-INFO} 10 | - EXTRA_ARGS=${EXTRA_ARGS:-} 11 | 12 | # Extra api keys 13 | - FASTAPI_ANALYTICS_KEY=${FASTAPI_ANALYTICS_KEY:-} 14 | - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-} 15 | 16 | # R2 17 | - R2_ENDPOINT=${R2_ENDPOINT:-} 18 | - R2_BUCKET_NAME=${R2_BUCKET_NAME:-} 19 | - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-} 20 | - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} 21 | - R2_DEV_ADDRESS=${R2_DEV_ADDRESS:-} 22 | ports: 23 | - "5003:5003" 24 | deploy: 25 | resources: 26 | reservations: 27 | devices: 28 | - driver: nvidia 29 | capabilities: ["gpu"] 30 | -------------------------------------------------------------------------------- /docker/ait.docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | voltaml: 5 | image: stax124/volta:experimental-ait 6 | environment: 7 | # General 8 | - HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN:-} 9 | - LOG_LEVEL=${LOG_LEVEL:-INFO} 10 | - EXTRA_ARGS=${EXTRA_ARGS:-} 11 | 12 | # Extra api keys 13 | - FASTAPI_ANALYTICS_KEY=${FASTAPI_ANALYTICS_KEY:-} 14 | - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-} 15 | 16 | # R2 17 | - R2_ENDPOINT=${R2_ENDPOINT:-} 18 | - R2_BUCKET_NAME=${R2_BUCKET_NAME:-} 19 | - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-} 20 | - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} 21 | - R2_DEV_ADDRESS=${R2_DEV_ADDRESS:-} 22 | volumes: 23 | - ${HOME}/voltaML/data:/app/data # XXX is the path to the folder where all the outputs will be saved 24 | - ${HOME}/.cache/huggingface:/root/.cache/huggingface # YYY is path to your home folder (you may need to change the YYY/.cache/huggingface to YYY\.cache\huggingface on Windows) 25 | ports: 26 | - "5003:5003" 27 | deploy: 28 | resources: 29 | reservations: 30 | devices: 31 | - driver: nvidia 32 | capabilities: ["gpu"] 33 | -------------------------------------------------------------------------------- /docker/cuda-no-mount.docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | voltaml: 5 | image: stax124/volta:experimental-cuda 6 | environment: 7 | # General 8 | - HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN:-} 9 | - LOG_LEVEL=${LOG_LEVEL:-INFO} 10 | - EXTRA_ARGS=${EXTRA_ARGS:-} 11 | 12 | # Extra api keys 13 | - FASTAPI_ANALYTICS_KEY=${FASTAPI_ANALYTICS_KEY:-} 14 | - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-} 15 | 16 | # R2 17 | - R2_ENDPOINT=${R2_ENDPOINT:-} 18 | - R2_BUCKET_NAME=${R2_BUCKET_NAME:-} 19 | - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-} 20 | - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} 21 | - R2_DEV_ADDRESS=${R2_DEV_ADDRESS:-} 22 | ports: 23 | - "5003:5003" 24 | deploy: 25 | resources: 26 | reservations: 27 | devices: 28 | - driver: nvidia 29 | capabilities: ["gpu"] 30 | -------------------------------------------------------------------------------- /docker/cuda.docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | voltaml: 5 | image: stax124/volta:experimental-cuda 6 | environment: 7 | # General 8 | - HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN:-} 9 | - LOG_LEVEL=${LOG_LEVEL:-INFO} 10 | - EXTRA_ARGS=${EXTRA_ARGS:-} 11 | 12 | # Extra api keys 13 | - FASTAPI_ANALYTICS_KEY=${FASTAPI_ANALYTICS_KEY:-} 14 | - DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-} 15 | 16 | # R2 17 | - R2_ENDPOINT=${R2_ENDPOINT:-} 18 | - R2_BUCKET_NAME=${R2_BUCKET_NAME:-} 19 | - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-} 20 | - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} 21 | - R2_DEV_ADDRESS=${R2_DEV_ADDRESS:-} 22 | volumes: 23 | - ${HOME}/voltaML/data:/app/data # XXX is the path to the folder where all the outputs will be saved 24 | - ${HOME}/.cache/huggingface:/root/.cache/huggingface # YYY is path to your home folder (you may need to change the YYY/.cache/huggingface to YYY\.cache\huggingface on Windows) 25 | ports: 26 | - "5003:5003" 27 | deploy: 28 | resources: 29 | reservations: 30 | devices: 31 | - driver: nvidia 32 | capabilities: ["gpu"] 33 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | // https://vitepress.dev/guide/custom-theme 2 | import { h } from 'vue' 3 | import Theme from 'vitepress/theme' 4 | import './style.css' 5 | 6 | export default { 7 | extends: Theme, 8 | Layout: () => { 9 | return h(Theme.Layout, null, { 10 | // https://vitepress.dev/guide/extending-default-theme#layout-slots 11 | }) 12 | }, 13 | enhanceApp({ app, router, siteData }) { 14 | // ... 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /docs/api/index.md: -------------------------------------------------------------------------------- 1 | # API 2 | 3 | Documentation can be found on `http://localhost:5003/api/docs` 4 | 5 | ## Basic structure 6 | 7 | API endpoints are divided into few categories: 8 | 9 | - Generate (inference and model conversions) 10 | - Hardware (hardware statistics) 11 | - Models (model management) 12 | - Output (generated images) 13 | - General (generally useful endpoints) 14 | - Default (non categorized endpoints) 15 | 16 | ## Schedulers (Samplers) 17 | 18 | ```py 19 | class KarrasDiffusionSchedulers(Enum): 20 | DDIMScheduler = 1 21 | DDPMScheduler = 2 22 | PNDMScheduler = 3 23 | LMSDiscreteScheduler = 4 24 | EulerDiscreteScheduler = 5 25 | HeunDiscreteScheduler = 6 26 | EulerAncestralDiscreteScheduler = 7 27 | DPMSolverMultistepScheduler = 8 28 | DPMSolverSinglestepScheduler = 9 29 | KDPM2DiscreteScheduler = 10 30 | KDPM2AncestralDiscreteScheduler = 11 31 | DEISMultistepScheduler = 12 32 | UniPCMultistepScheduler = 13 33 | DPMSolverSDEScheduler = 14 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/basics/aitemplate.md: -------------------------------------------------------------------------------- 1 | # AITemplate Acceleration 2 | 3 | ## Benefits 4 | 5 | - About 1.7x faster generation 6 | 7 | ## Downsides 8 | 9 | - No LoRA support 10 | - No Textual Inversion support 11 | - Locked down resolution (if you use static AITemplate) 12 | 13 | ## Acceleration 14 | 15 | Make sure that you are one the correct page as can be seen in the image below. 16 | 17 |  18 | 19 | 1. Width and Height - these cannot be changed after the model is compiled 20 | 2. Batch Size - this cannot be changed after the model is compiled as well - but Batch Count can - for this reason, I recommend setting it to 1 21 | 3. CPU Threads - Number of CPU threads that will be used for compilation - **MORE THREADS, MORE RAM NEEDED** - if you do not have enough RAM, lower this number down, **6-8 Threads is recommended (about 7GB free RAM needed)** 22 | 4. Model - model that will be accelerated 23 | 5. Accelerate Button - click this to start the acceleration process 24 | 25 | ::: warning 26 | Due to extreme load on the CPU, connection between the browser and the server will be lost. If this happens, you need to click the reconnect button - acceleration should not be affected. 27 | 28 | WE WOULD RECOMMEND RESTARTING VOLTA AFTER ACCELERATION IS DONE, AS WEBSOCKETS MIGHT BE TOTALLY BROKEN 29 | ::: 30 | 31 | ## How to use 32 | 33 | 1. Switch the Model tab to AITemplate 34 | 2. Click the `Load` button 35 | 3. Generate an image - only txt2img, img2img and ControlNet are supported 36 | 37 |  38 | -------------------------------------------------------------------------------- /docs/basics/autoload.md: -------------------------------------------------------------------------------- 1 | # Autoload 2 | 3 | Volta can be configured to automatically load a model (or even multiple models at once), Textual Inversion or even a custom VAE for a specific model. 4 | 5 | ::: tip 6 | To see autoload in action, save the settings and restart Volta. You should see the model loading automatically. 7 | ::: 8 | 9 | ## How to use 10 | 11 | Navigate to `Settings > API > Autoload` and select a model that you would like to load at the startup. Feel free to select multiple models at once if you have enough GPU memory / Offload enabled. 12 | 13 | ::: warning 14 | To save settings, click either on the `Save settings` button or navigate to other tab. Notification will appear if the settings were saved successfully. 15 | ::: 16 | 17 | ## Autoloading Textual Inversion 18 | 19 | Autoloading Textual inversion will apply to all models. You can check the status in the Model Loader. 20 | 21 | ## Autoloading custom VAE 22 | 23 | Custom VAEs are loaded depending on the model and should be applied automatically. You can check this behavior in the Model Loader. 24 | -------------------------------------------------------------------------------- /docs/basics/lora.md: -------------------------------------------------------------------------------- 1 | # LoRA 2 | 3 | [Low-Rank Adaptation (LoRA)](https://arxiv.org/abs/2106.09685) is a mathematical technique developed for fine-tuning large language models (LLMs). It can also be used with Stable Diffusion. 4 | 5 | ## Benefits 6 | 7 | - Much faster training 8 | - Lower memory usage 9 | - Lower file size 10 | 11 | ## Downloading 12 | 13 | ::: tip 14 | We now have CivitAI downloader, head to Models -> CivitAI to download Models, LoRAs and Textual Inversions. 15 | ::: 16 | 17 | LoRAs are available to download from [Civit.ai](https://civit.ai/). You can download them from there and then upload them to Volta via the Model Manager: 18 | 19 |  20 | 21 | ## Loading and Usage 22 | 23 | All you need to do is provide the token \ in the prompt to load and activate the LoRA. This should work with LyCORIS as well. 24 | 25 | Autocomplete should help you with this way of using LoRAs. It will be triggered after every `,` and should ignore whitespace characters. 26 | 27 |  28 | 29 | ::: tip 30 | You can use multiple LoRA models at once. 31 | ::: 32 | 33 | ::: tip 34 | You can also use the number after LoRA to control the strength of the LoRA. 35 | ::: 36 | -------------------------------------------------------------------------------- /docs/basics/textual-inversion.md: -------------------------------------------------------------------------------- 1 | # Textual Inversion 2 | 3 | Textual Inversion (Embedding) is a way to define new keywords in a model without modifying the model itself. With this technology, you can inject new objects and styles without training a full model from scratch. 4 | 5 | ## Downloading 6 | 7 | ::: tip 8 | We now have CivitAI downloader, head to Models -> CivitAI to download Models, LoRAs and Textual Inversions. 9 | ::: 10 | 11 | Textual Inversion is available to download from [Civit.ai](https://civit.ai/). You can download them from there and then upload them to Volta via the Model Manager: 12 | 13 |  14 | 15 | ## Loading 16 | 17 | 1. Load any model and click the `Select` button 18 | 2. Click `Load` on the Textual Inversion model you want to use 19 | 20 |  21 | 22 | ::: tip 23 | You can use multiple Textual Inversion models at once. 24 | ::: 25 | 26 | ::: tip 27 | Textual Inversions can be set to autoload in settings. 28 | ::: 29 | 30 | ## Usage 31 | 32 | You can activate the embedding by using the name of the file you loaded. For example, if you loaded `flowers.pt`, you can activate it by using `flowers` in your prompt. 33 | 34 |  35 | -------------------------------------------------------------------------------- /docs/developers/documentation.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | This is will show you how to edit our documentation and how to properly contribute while outlining some rules for us. 4 | 5 | ## Rules 6 | 7 | ::: warning 8 | Please read the rules before you start editing the documentation. 9 | ::: 10 | 11 | - All images will be in WEBP format with maximal 90% image quality 12 | - Images will be of sensible resolution (no 4k or higher resolution images) 13 | - English only 14 | - Grammatically correct when possible 15 | - Keep it simple 16 | 17 | ## How to edit 18 | 19 | All documentation is written in Markdown and is located in the `docs` folder. You can edit it directly on GitHub or you can clone the repository and edit it locally. 20 | 21 | Edits on GitHub will create a Pull Request with the changes and they will be waiting for review. 22 | 23 | Once the change is reviewed and approved it will be merged into the branch and will be deployed by our CI/CD pipeline. 24 | 25 | ## Running documentation locally 26 | 27 | Clone the repository 28 | 29 | ```bash 30 | git clone https://github.com/VoltaML/voltaML-fast-stable-diffusion.git 31 | ``` 32 | 33 | Install dependencies 34 | 35 | ```bash 36 | yarn install 37 | ``` 38 | 39 | Run the documentation 40 | 41 | ```bash 42 | yarn docs:dev 43 | ``` 44 | 45 | You should now be able to access the documentation on `http://localhost:5173/voltaML-fast-stable-diffusion/` 46 | -------------------------------------------------------------------------------- /docs/developers/frontend.md: -------------------------------------------------------------------------------- 1 | # Frontend 2 | 3 | This is the documentation for setting up the WebUI for local development. 4 | 5 | ## 1. Clone the repository 6 | 7 | ```bash 8 | git clone https://github.com/VoltaML/voltaML-fast-stable-diffusion --branch experimental 9 | ``` 10 | 11 | ## 2. Move into the frontend directory 12 | 13 | ```bash 14 | cd voltaML-fast-stable-diffusion/frontend 15 | ``` 16 | 17 | ## 3. Install dependencies 18 | 19 | ::: warning 20 | Node.js version 18+ installed is required. (16 might work as well but it's not tested) 21 | ::: 22 | 23 | ::: info 24 | If you are using Linux, you might need to use `sudo` before the command. 25 | ::: 26 | 27 | Install yarn if you don't have it already. 28 | 29 | ```bash 30 | npm install -g yarn 31 | ``` 32 | 33 | Install dependencies 34 | 35 | ```bash 36 | yarn install 37 | ``` 38 | 39 | ## 4. Run the development server 40 | 41 | ```bash 42 | yarn dev 43 | ``` 44 | 45 | ## 5. Open the WebUI 46 | 47 | Open [http://127.0.0.1:5173/](http://127.0.0.1:5173/) with your browser to see the result. 48 | -------------------------------------------------------------------------------- /docs/guides/test.vue: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/guides/test.vue -------------------------------------------------------------------------------- /docs/installation/stability-matrix.md: -------------------------------------------------------------------------------- 1 | # Stability Matrix 2 | 3 | ::: danger IMPORTANT 4 | Stability Matrix mislabeled Volta as MacOS compatible. Volta does not officially support MacOS. 5 | ::: 6 | 7 | ::: warning 8 | If you encounter any issues, please report them on our GitHub repository or Discord server first. Problem is usually on our side and we will fix it as soon as possible. Do not bother Stability Matrix developers with issues related to Volta unless you are sure that the problem is on their side. 9 | ::: 10 | 11 | ::: info 12 | We are not affiliated with the Stability Matrix. Compatibility with Volta is not guaranteed. 13 | ::: 14 | 15 | Stability Matrix is a manager for Stable Diffusion WebUIs and provides fast and easy way to install Volta. 16 | 17 | ## Installing Stability Matrix 18 | 19 | Download the official [Stability Matrix installer](https://lykos.ai/) and run it. 20 | If you want to grab it from the official GitHub repository or you want to check the source code, you can find it [here](https://github.com/LykosAI/StabilityMatrix) 21 | 22 |  23 | 24 | ## Installing Volta 25 | 26 | Once you have installed Stability Matrix, you can install Volta by clicking on the `Install` button on the quick setup page. 27 | Feel free to change the branch or other settings if you need to. 28 | 29 | > *yes...that picture is really outdated* 30 | 31 |  32 | 33 | ## Updating Volta 34 | 35 | Updating Volta is as easy as installing it. Just click on the `Update` button on the packages page. -------------------------------------------------------------------------------- /docs/installation/wsl.md: -------------------------------------------------------------------------------- 1 | # WSL Installation 2 | 3 | ::: warning 4 | This setup will requires WSL2. If you installed WSL before the version 2 was released, you will need to switch manually to WSL2. How to upgrade guide: [CLICK HERE](https://learn.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2). 5 | ::: 6 | 7 | ## Backends 8 | 9 | - ✅ Backend available and supported 10 | - ❌ Backend not available yet 11 | - 🚧 Backend is in the development or testing phase 12 | 13 | | Backend | Supported | 14 | | ---------- | --------- | 15 | | PyTorch | ✅ | 16 | | AITemplate | ✅ | 17 | | ONNX | 🚧 | 18 | 19 | ## Installation 20 | 21 | ### Install Ubuntu WSL 22 | 23 | 1. Install Ubuntu from the Microsoft Store. 24 | 25 | 2. Launch Ubuntu and follow the prompts to finish the setup. 26 | 27 | ### Run Automated Setup Script 28 | 29 | ```bash 30 | curl -fsSLO https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/experimental/scripts/wsl-install.sh 31 | chmod +x wsl-install.sh 32 | . wsl-install.sh 33 | ``` 34 | 35 | ## How to start the application after closing it 36 | 37 | ::: tip 38 | I have an easier way planned for the future, but for now, you'll have to run the following commands every time you want to start the application. 39 | ::: 40 | 41 | 1. Launch Ubuntu from the Start Menu 42 | 2. `cd voltaML-fast-stable-diffusion` (or wherever you cloned the repository) 43 | 3. `source venv/bin/activate` 44 | 4. `python main.py` 45 | -------------------------------------------------------------------------------- /docs/installation/xformers.md: -------------------------------------------------------------------------------- 1 | # xFormers 2 | 3 | Xformers library is an optional way to save some of your VRAM. 4 | 5 | ## Downsides 6 | 7 | Images are no longer determinisic. This means that you can't use the same seed to get the same results. 8 | 9 | ## Installation 10 | 11 | Users need to install manually if they use local installation of volta. 12 | 13 | ```bash 14 | pip install xformers 15 | ``` 16 | 17 | ## Usage 18 | 19 | Head over to `Settings > API` and select `xFormers` in `Attention processor`. 20 | You need to reload the model after changing this setting to apply the changes. 21 | -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/volta-og-image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/public/volta-og-image.webp -------------------------------------------------------------------------------- /docs/public/volta-rounded.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/public/volta-rounded.webp -------------------------------------------------------------------------------- /docs/settings/settings.md: -------------------------------------------------------------------------------- 1 | # Settings 2 | 3 | This is an experimental feature that is available in both the UI and the API. It can be fund in the `Settings` tab in the UI. 4 | 5 | Settings are split into multiple categories: 6 | 7 | - `Frontend` - UI settings (usually default values for the UI) 8 | - `API` - API settings 9 | - `Bot` - Settings for the Discord bot 10 | - `General` - General settings 11 | 12 | All settings will be stored as a json file on your local machine (server). 13 | This file is named `settings.json` and can be found in the `data` directory of the project. 14 | 15 | ::: warning 16 | Settings are not automatically saved. You need to click the `Save Settings` button to save the settings. 17 | ::: 18 | 19 | ::: warning 20 | When resetting the settings, the settings will be reset to the default values, but will once again need to be saved manually. 21 | ::: 22 | -------------------------------------------------------------------------------- /docs/static/basics/aitemplate-accelerate.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/aitemplate-accelerate.webp -------------------------------------------------------------------------------- /docs/static/basics/aitemplate-load.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/aitemplate-load.webp -------------------------------------------------------------------------------- /docs/static/basics/hf_download.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/hf_download.webp -------------------------------------------------------------------------------- /docs/static/basics/lora-load.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/lora-load.webp -------------------------------------------------------------------------------- /docs/static/basics/lora.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/lora.webp -------------------------------------------------------------------------------- /docs/static/basics/textual-inversion-download.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/textual-inversion-download.webp -------------------------------------------------------------------------------- /docs/static/basics/textual-inversion-load.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/textual-inversion-load.webp -------------------------------------------------------------------------------- /docs/static/basics/textual-inversion-usage.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/basics/textual-inversion-usage.webp -------------------------------------------------------------------------------- /docs/static/frontend/frontend-browser-annotated.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/frontend-browser-annotated.webp -------------------------------------------------------------------------------- /docs/static/frontend/frontend-browser.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/frontend-browser.webp -------------------------------------------------------------------------------- /docs/static/frontend/frontend-img2img.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/frontend-img2img.webp -------------------------------------------------------------------------------- /docs/static/frontend/frontend-txt2img.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/frontend-txt2img.webp -------------------------------------------------------------------------------- /docs/static/frontend/model-downloader/civitai-landing.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/model-downloader/civitai-landing.webp -------------------------------------------------------------------------------- /docs/static/frontend/model-downloader/civitai-popup.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/frontend/model-downloader/civitai-popup.webp -------------------------------------------------------------------------------- /docs/static/getting-started/download-model-1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/download-model-1.webp -------------------------------------------------------------------------------- /docs/static/getting-started/download-model-2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/download-model-2.webp -------------------------------------------------------------------------------- /docs/static/getting-started/download-model.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/download-model.webp -------------------------------------------------------------------------------- /docs/static/getting-started/download-page.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/download-page.webp -------------------------------------------------------------------------------- /docs/static/getting-started/final.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/final.webp -------------------------------------------------------------------------------- /docs/static/getting-started/gen-settings.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/gen-settings.webp -------------------------------------------------------------------------------- /docs/static/getting-started/generate-button.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/generate-button.webp -------------------------------------------------------------------------------- /docs/static/getting-started/highres/highres-base.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/highres/highres-base.webp -------------------------------------------------------------------------------- /docs/static/getting-started/highres/highres-diagram.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/highres/highres-diagram.webp -------------------------------------------------------------------------------- /docs/static/getting-started/highres/image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/highres/image.webp -------------------------------------------------------------------------------- /docs/static/getting-started/highres/latent.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/highres/latent.webp -------------------------------------------------------------------------------- /docs/static/getting-started/highres/without.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/highres/without.webp -------------------------------------------------------------------------------- /docs/static/getting-started/left-bar-download.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/left-bar-download.webp -------------------------------------------------------------------------------- /docs/static/getting-started/load-model-modal.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/load-model-modal.webp -------------------------------------------------------------------------------- /docs/static/getting-started/loaded-model.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/loaded-model.webp -------------------------------------------------------------------------------- /docs/static/getting-started/model-loader-button.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/model-loader-button.webp -------------------------------------------------------------------------------- /docs/static/getting-started/models.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/models.webp -------------------------------------------------------------------------------- /docs/static/getting-started/progress.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/progress.webp -------------------------------------------------------------------------------- /docs/static/getting-started/select_model.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/select_model.webp -------------------------------------------------------------------------------- /docs/static/getting-started/txt2img-button.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/getting-started/txt2img-button.webp -------------------------------------------------------------------------------- /docs/static/installation/manager-github-release.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/installation/manager-github-release.webp -------------------------------------------------------------------------------- /docs/static/installation/stability-matrix-installing-volta.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/installation/stability-matrix-installing-volta.webp -------------------------------------------------------------------------------- /docs/static/installation/stability-matrix-website.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/installation/stability-matrix-website.webp -------------------------------------------------------------------------------- /docs/static/installation/vastai-instances.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/installation/vastai-instances.webp -------------------------------------------------------------------------------- /docs/static/installation/vastai-search.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/installation/vastai-search.webp -------------------------------------------------------------------------------- /docs/static/settings/reproducibility/quant_on.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/settings/reproducibility/quant_on.webp -------------------------------------------------------------------------------- /docs/static/settings/reproducibility/sgm_off.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/settings/reproducibility/sgm_off.webp -------------------------------------------------------------------------------- /docs/static/settings/reproducibility/sgm_on.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/docs/static/settings/reproducibility/sgm_on.webp -------------------------------------------------------------------------------- /docs/todo.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | 3 | ## Might deserve their own page 4 | 5 | - prompt expansion 6 | - rewrite lora docs 7 | - extra sampler settings 8 | - Samplers (+ Kdiffusion samplers) 9 | - SAG 10 | - Hi-res 11 | - Add examples to Img2img 12 | - Upscaling and how to add another upscaler 13 | - Taggers 14 | - ONNX (if it even works) 15 | - VAE 16 | - Attention processors 17 | - Stable-Fast 18 | - Torch compile 19 | - Offload 20 | - Update docs with bfloat16 21 | - SGM noise multiplier 22 | - Quantization in k-samplers 23 | - CLIP skip 24 | - TomeSD 25 | - Huggingface style prompting 26 | 27 | ## Probably bundle together 28 | 29 | - Attention slicing 30 | - Channels last 31 | - Hypertile 32 | - Reduced Precision 33 | - Cudnn benchmark 34 | - VAE Slicing + VAE Tiling 35 | - Dont merge latents 36 | - Continuous generation 37 | - Sending logs to UI 38 | -------------------------------------------------------------------------------- /docs/troubleshooting/docker.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting Docker 2 | 3 | ## no configuration file provided: not found 4 | 5 | You probably just cloned the repo but forgot to do `cd voltaML-fast-stable-diffusion` 6 | -------------------------------------------------------------------------------- /docs/troubleshooting/linux.md: -------------------------------------------------------------------------------- 1 | # Linux (WIP) 2 | -------------------------------------------------------------------------------- /docs/troubleshooting/windows.md: -------------------------------------------------------------------------------- 1 | # Windows (WIP) 2 | -------------------------------------------------------------------------------- /docs/webui/download.md: -------------------------------------------------------------------------------- 1 | # Model Downloader 2 | 3 | ## Huggingface 4 | 5 | ### How to use 6 | 7 | Select something from the curated models (will be updated soon) and click the `Download` button. 8 | 9 | **OR** 10 | 11 | 1. Search for the model you want to download on the [HuggingFace model hub](https://huggingface.co/models) 12 | 2. Copy the model name (e.g. `andite/anything-v4.0`, not the URL) 13 | 3. Paste the model name into the `Model name` input 14 | 4. Click `Download` button 15 | 5. See the terminal output for progress feedback 16 | 17 | ## CivitAI 18 | 19 | ### How to use 20 | 21 |  22 | 23 | 1. Click on the `Model` tab 24 | 2. Click on the `CivitAI` section 25 | 3. Select a model you want to download (optionally, you can filter the models using the dropdowns and filter input) 26 | 27 |  28 | 29 | 1. Select the version of the model you want to download 30 | 2. Feel free to check out provided images (drag to switch between them) 31 | 3. Select correct format and click `Download` button 32 | 33 | Model should get downloaded, but might require clicking on Refresh button in the model loader. You can check the terminal output for progress feedback. 34 | -------------------------------------------------------------------------------- /docs/webui/imagebrowser.md: -------------------------------------------------------------------------------- 1 | # Image browser 2 | 3 | The image browser is a tool to browse and manage images on your system. 4 | 5 | ## How to use 6 | 7 |  8 | 9 | 1. Click on the `Image Browser` tab 10 | 2. Optionally, you can filter the images 11 | 3. Size of the images can be changed using the slider (can be set permanently in the settings) 12 | -------------------------------------------------------------------------------- /example.env: -------------------------------------------------------------------------------- 1 | # Hugging Face Token (https://huggingface.co/settings/tokens) 2 | HUGGINGFACE_TOKEN= 3 | 4 | # Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) 5 | LOG_LEVEL=INFO 6 | 7 | # [Optional] Analytics (https://my-api-analytics.vercel.app/generate) (https://my-api-analytics.vercel.app/dashboard) 8 | FASTAPI_ANALYTICS_KEY= 9 | 10 | # [Optional] Discord Bot Token (https://discord.com/developers/applications) 11 | DISCORD_BOT_TOKEN= 12 | 13 | # [Optional] Extra arguments for the API 14 | EXTRA_ARGS= 15 | 16 | # R2 - Cloudflare bucket storage (also pass in --enable-r2 in the EXTRA_ARGS) 17 | R2_ENDPOINT= 18 | R2_BUCKET_NAME= 19 | AWS_ACCESS_KEY_ID= 20 | AWS_SECRET_ACCESS_KEY= 21 | R2_DEV_ADDRESS= 22 | -------------------------------------------------------------------------------- /frontend/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | require("@rushstack/eslint-patch/modern-module-resolution"); 3 | 4 | module.exports = { 5 | root: true, 6 | extends: [ 7 | "plugin:vue/vue3-essential", 8 | "eslint:recommended", 9 | "@vue/eslint-config-typescript", 10 | "@vue/eslint-config-prettier", 11 | ], 12 | parserOptions: { 13 | ecmaVersion: "latest", 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | .DS_Store 12 | dist-ssr 13 | coverage 14 | *.local 15 | 16 | /cypress/videos/ 17 | /cypress/screenshots/ 18 | 19 | # Editor directories and files 20 | .vscode/* 21 | !.vscode/extensions.json 22 | .idea 23 | *.suo 24 | *.ntvs* 25 | *.njsproj 26 | *.sln 27 | *.sw? 28 | -------------------------------------------------------------------------------- /frontend/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5" 3 | } -------------------------------------------------------------------------------- /frontend/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"] 3 | } 4 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | ## Recommended IDE Setup 2 | 3 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). 4 | 5 | ## Type Support for `.vue` Imports in TS 6 | 7 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. 8 | 9 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 10 | 11 | 1. Disable the built-in TypeScript Extension 12 | 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette 13 | 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 14 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. 15 | 16 | ## Project Setup 17 | 18 | ```sh 19 | yarn 20 | ``` 21 | 22 | ### Compile and Hot-Reload for Development 23 | 24 | ```sh 25 | yarn dev 26 | ``` 27 | 28 | ### Type-Check, Compile and Minify for Production 29 | 30 | ```sh 31 | yarn build 32 | ``` 33 | 34 | ### Lint with [ESLint](https://eslint.org/) 35 | 36 | ```sh 37 | yarn lint 38 | ``` 39 | -------------------------------------------------------------------------------- /frontend/dist/assets/404View.js: -------------------------------------------------------------------------------- 1 | import { d as defineComponent, o as openBlock, g as createElementBlock, e as createVNode, w as withCtx, f as unref, c6 as NResult, N as NCard } from "./index.js"; 2 | const _hoisted_1 = { style: { "width": "100vw", "height": "100vh", "display": "flex", "align-items": "center", "justify-content": "center", "backdrop-filter": "blur(4px)" } }; 3 | const _sfc_main = /* @__PURE__ */ defineComponent({ 4 | __name: "404View", 5 | setup(__props) { 6 | return (_ctx, _cache) => { 7 | return openBlock(), createElementBlock("div", _hoisted_1, [ 8 | createVNode(unref(NCard), { style: { "max-width": "40vw", "border-radius": "12px" } }, { 9 | default: withCtx(() => [ 10 | createVNode(unref(NResult), { 11 | status: "404", 12 | title: "You got lucky, this page doesn't exist!", 13 | description: "Next time, there will be a rickroll.", 14 | size: "large" 15 | }) 16 | ]), 17 | _: 1 18 | }) 19 | ]); 20 | }; 21 | } 22 | }); 23 | export { 24 | _sfc_main as default 25 | }; 26 | -------------------------------------------------------------------------------- /frontend/dist/assets/AboutView.js: -------------------------------------------------------------------------------- 1 | import { _ as _export_sfc, g as createElementBlock, o as openBlock, b as createBaseVNode } from "./index.js"; 2 | const _sfc_main = {}; 3 | const _hoisted_1 = { class: "about" }; 4 | const _hoisted_2 = /* @__PURE__ */ createBaseVNode("h1", null, "This is an about page", -1); 5 | const _hoisted_3 = [ 6 | _hoisted_2 7 | ]; 8 | function _sfc_render(_ctx, _cache) { 9 | return openBlock(), createElementBlock("div", _hoisted_1, _hoisted_3); 10 | } 11 | const AboutView = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); 12 | export { 13 | AboutView as default 14 | }; 15 | -------------------------------------------------------------------------------- /frontend/dist/assets/CloudUpload.js: -------------------------------------------------------------------------------- 1 | import { d as defineComponent, o as openBlock, g as createElementBlock, b as createBaseVNode } from "./index.js"; 2 | const _hoisted_1 = { 3 | xmlns: "http://www.w3.org/2000/svg", 4 | "xmlns:xlink": "http://www.w3.org/1999/xlink", 5 | viewBox: "0 0 512 512" 6 | }; 7 | const _hoisted_2 = /* @__PURE__ */ createBaseVNode( 8 | "path", 9 | { 10 | d: "M473.66 210c-14-10.38-31.2-18-49.36-22.11a16.11 16.11 0 0 1-12.19-12.22c-7.8-34.75-24.59-64.55-49.27-87.13C334.15 62.25 296.21 47.79 256 47.79c-35.35 0-68 11.08-94.37 32.05a150.07 150.07 0 0 0-42.06 53a16 16 0 0 1-11.31 8.87c-26.75 5.4-50.9 16.87-69.34 33.12C13.46 197.33 0 227.24 0 261.39c0 34.52 14.49 66 40.79 88.76c25.12 21.69 58.94 33.64 95.21 33.64h104V230.42l-36.69 36.69a16 16 0 0 1-23.16-.56c-5.8-6.37-5.24-16.3.85-22.39l63.69-63.68a16 16 0 0 1 22.62 0L331 244.14c6.28 6.29 6.64 16.6.39 22.91a16 16 0 0 1-22.68.06L272 230.42v153.37h124c31.34 0 59.91-8.8 80.45-24.77c23.26-18.1 35.55-44 35.55-74.83c0-29.94-13.26-55.61-38.34-74.19z", 11 | fill: "currentColor" 12 | }, 13 | null, 14 | -1 15 | /* HOISTED */ 16 | ); 17 | const _hoisted_3 = /* @__PURE__ */ createBaseVNode( 18 | "path", 19 | { 20 | d: "M240 448.21a16 16 0 1 0 32 0v-64.42h-32z", 21 | fill: "currentColor" 22 | }, 23 | null, 24 | -1 25 | /* HOISTED */ 26 | ); 27 | const _hoisted_4 = [_hoisted_2, _hoisted_3]; 28 | const CloudUpload = defineComponent({ 29 | name: "CloudUpload", 30 | render: function render(_ctx, _cache) { 31 | return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_4); 32 | } 33 | }); 34 | export { 35 | CloudUpload as C 36 | }; 37 | -------------------------------------------------------------------------------- /frontend/dist/assets/ImageBrowserView.css: -------------------------------------------------------------------------------- 1 | 2 | .img-slider[data-v-c3083c91] { 3 | aspect-ratio: 1/1; 4 | height: 182px; 5 | width: auto; 6 | } 7 | .image-grid[data-v-c3083c91] { 8 | display: grid; 9 | grid-template-columns: repeat( 10 | var(--0b0e0cc2), 11 | 1fr 12 | ); 13 | grid-gap: 8px; 14 | } 15 | .top-bar[data-v-c3083c91] { 16 | background-color: var(--4fde547c); 17 | } 18 | .image-column[data-v-c3083c91] { 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | -------------------------------------------------------------------------------- /frontend/dist/assets/TaggerView.css: -------------------------------------------------------------------------------- 1 | 2 | .image-container img[data-v-94d16b9f] { 3 | width: 100%; 4 | height: 100%; 5 | object-fit: contain; 6 | overflow: hidden; 7 | } 8 | .image-container[data-v-94d16b9f] { 9 | height: 70vh; 10 | width: 100%; 11 | display: flex; 12 | justify-content: center; 13 | } 14 | -------------------------------------------------------------------------------- /frontend/dist/assets/TestView.js: -------------------------------------------------------------------------------- 1 | import { d as defineComponent, y as ref, o as openBlock, c as createBlock, f as unref } from "./index.js"; 2 | import { _ as _sfc_main$1 } from "./ModelPopup.vue_vue_type_script_setup_true_lang.js"; 3 | import "./DescriptionsItem.js"; 4 | const _sfc_main = /* @__PURE__ */ defineComponent({ 5 | __name: "TestView", 6 | setup(__props) { 7 | const model = ref(null); 8 | const showModal = ref(false); 9 | fetch("https://civitai.com/api/v1/models/7240").then((res) => { 10 | res.json().then((data) => { 11 | model.value = data; 12 | }); 13 | }); 14 | return (_ctx, _cache) => { 15 | return openBlock(), createBlock(unref(_sfc_main$1), { 16 | model: model.value, 17 | "show-modal": showModal.value, 18 | "onUpdate:showModal": _cache[0] || (_cache[0] = (e) => showModal.value = e) 19 | }, null, 8, ["model", "show-modal"]); 20 | }; 21 | } 22 | }); 23 | export { 24 | _sfc_main as default 25 | }; 26 | -------------------------------------------------------------------------------- /frontend/dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/frontend/dist/favicon.ico -------------------------------------------------------------------------------- /frontend/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | VoltaML 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /frontend/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | VoltaML 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "run-p type-check build-only", 8 | "preview": "vite preview", 9 | "build-only": "vite build", 10 | "type-check": "vue-tsc --noEmit", 11 | "format": "prettier --write \"src/**/*.{vue,js,jsx,ts,tsx,json,md}\"", 12 | "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" 13 | }, 14 | "dependencies": { 15 | "pinia": "^2.0.28", 16 | "semver": "^5.7.2", 17 | "uuid": "^9.0.0", 18 | "v3-infinite-loading": "^1.2.2", 19 | "vue": "^3.2.45", 20 | "vue-drawing-canvas": "^1.0.14", 21 | "vue-gtag-next": "^1.14.0", 22 | "vue-router": "^4.1.6", 23 | "word-wrap": "^1.2.4" 24 | }, 25 | "devDependencies": { 26 | "@rushstack/eslint-patch": "^1.1.4", 27 | "@types/node": "^18.11.12", 28 | "@types/uuid": "^9.0.0", 29 | "@vicons/ionicons5": "^0.12.0", 30 | "@vitejs/plugin-vue": "^4.0.0", 31 | "@vitejs/plugin-vue-jsx": "^3.0.0", 32 | "@vue/eslint-config-prettier": "^7.0.0", 33 | "@vue/eslint-config-typescript": "^11.0.0", 34 | "@vue/tsconfig": "^0.1.3", 35 | "@vueuse/core": "^9.9.0", 36 | "eslint": "^8.22.0", 37 | "eslint-plugin-vue": "^9.3.0", 38 | "naive-ui": "^2.34.3", 39 | "npm-run-all": "^4.1.5", 40 | "prettier": "^2.7.1", 41 | "sass": "^1.69.4", 42 | "typescript": "~4.7.4", 43 | "vite": "^4.0.0", 44 | "vue-tsc": "^1.0.12" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/src/Content.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 37 | 38 | 43 | -------------------------------------------------------------------------------- /frontend/src/assets/2img.css: -------------------------------------------------------------------------------- 1 | .left-container { 2 | margin: 0 12px; 3 | } 4 | 5 | .flex-container { 6 | width: 100%; 7 | display: inline-flex; 8 | align-items: center; 9 | gap: 0 8px; 10 | } 11 | 12 | .flex-container.space-between { 13 | justify-content: space-between; 14 | } 15 | 16 | .slider-label { 17 | margin-right: 12px; 18 | width: 128px; 19 | } 20 | 21 | .main-container { 22 | margin: 18px; 23 | padding-top: 18px; 24 | } 25 | 26 | .highlight { 27 | color: #63e2b7; 28 | } 29 | 30 | .generate-extra-card { 31 | margin-top: 12px; 32 | } 33 | 34 | .generate-extra-card:last-child { 35 | margin-bottom: 12px; 36 | } 37 | -------------------------------------------------------------------------------- /frontend/src/assets/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #fff; 3 | font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 4 | Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | font-size: 18px; 7 | text-rendering: optimizeLegibility; 8 | -webkit-font-smoothing: antialiased; 9 | -moz-osx-font-smoothing: grayscale; 10 | } 11 | 12 | /* width */ 13 | ::-webkit-scrollbar { 14 | width: 10px; 15 | } 16 | 17 | /* Track */ 18 | ::-webkit-scrollbar-track { 19 | border-radius: 10px; 20 | } 21 | 22 | /* Handle */ 23 | ::-webkit-scrollbar-thumb { 24 | background: rgb(39, 39, 39); 25 | border-radius: 10px; 26 | } 27 | 28 | a, 29 | .green { 30 | text-decoration: none; 31 | color: hsla(160, 100%, 37%, 1); 32 | transition: 0.4s; 33 | } 34 | 35 | .n-menu-item:last-child { 36 | margin-top: auto; 37 | } 38 | 39 | .n-drawer-content-wrapper { 40 | backdrop-filter: blur(10px); 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/components/InitHandler.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | -------------------------------------------------------------------------------- /frontend/src/components/LogDrawer.vue: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | -------------------------------------------------------------------------------- /frontend/src/components/OutputStats.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ genData.time_taken }}s 6 | 7 | {{ genData.seed }} 8 | 9 | 10 | 11 | 12 | 24 | -------------------------------------------------------------------------------- /frontend/src/components/WIP.vue: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | -------------------------------------------------------------------------------- /frontend/src/components/accelerate/index.ts: -------------------------------------------------------------------------------- 1 | export { default as AITemplateDynamicAccelerate } from "./AITemplateDynamicAccelerate.vue"; 2 | export { default as ONNXAccelerate } from "./ONNXAccelerate.vue"; 3 | -------------------------------------------------------------------------------- /frontend/src/components/extra/AutofillManager.vue: -------------------------------------------------------------------------------- 1 | Autofill manager 2 | 3 | 4 | -------------------------------------------------------------------------------- /frontend/src/components/extra/DependencyManager.vue: -------------------------------------------------------------------------------- 1 | Dependency manager 2 | 3 | 4 | -------------------------------------------------------------------------------- /frontend/src/components/extra/index.ts: -------------------------------------------------------------------------------- 1 | export { default as AutofillManager } from "./AutofillManager.vue"; 2 | export { default as DependencyManager } from "./DependencyManager.vue"; 3 | -------------------------------------------------------------------------------- /frontend/src/components/generate/HighResFixTabs.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 35 | -------------------------------------------------------------------------------- /frontend/src/components/generate/Restoration.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 30 | -------------------------------------------------------------------------------- /frontend/src/components/generate/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ADetailer } from "./ADetailer.vue"; 2 | export { default as BatchSizeInput } from "./BatchSizeInput.vue"; 3 | export { default as CFGScale } from "./CFGScaleInput.vue"; 4 | export { default as DeepShrink } from "./DeepShrink.vue"; 5 | export { default as DimensionsInput } from "./DimensionsInput.vue"; 6 | export { default as HighResFix } from "./HighResFix.vue"; 7 | export { default as HighResFixTabs } from "./HighResFixTabs.vue"; 8 | export { default as Prompt } from "./Prompt.vue"; 9 | export { default as ResizeFromDimensionsInput } from "./ResizeFromDimensionsInput.vue"; 10 | export { default as Restoration } from "./Restoration.vue"; 11 | export { default as SAGInput } from "./SAGInput.vue"; 12 | export { default as SamplerPicker } from "./SamplerPicker.vue"; 13 | export { default as Scalecrafter } from "./Scalecrafter.vue"; 14 | export { default as Upscale } from "./Upscale.vue"; 15 | export { default as XLRefiner } from "./XLRefiner.vue"; 16 | -------------------------------------------------------------------------------- /frontend/src/components/imageProcessing/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ESRGAN } from "./ESRGAN.vue"; 2 | -------------------------------------------------------------------------------- /frontend/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as CollapsibleNavbar } from "./CollapsibleNavbar.vue"; 2 | export { default as DownloadDelete } from "./DownloadDelete.vue"; 3 | export { default as GenerateSection } from "./GenerateSection.vue"; 4 | export { default as ImageOutput } from "./ImageOutput.vue"; 5 | export { default as ImageUpload } from "./ImageUpload.vue"; 6 | export { default as InitHandler } from "./InitHandler.vue"; 7 | export { default as LogDrawer } from "./LogDrawer.vue"; 8 | export { default as OutputStats } from "./OutputStats.vue"; 9 | export { default as PerformanceDrawer } from "./PerformanceDrawer.vue"; 10 | export { default as SecretsHandler } from "./SecretsHandler.vue"; 11 | export { default as SendOutputTo } from "./SendOutputTo.vue"; 12 | export { default as TopBar } from "./TopBar.vue"; 13 | export { default as WIP } from "./WIP.vue"; 14 | 15 | export * from "./accelerate"; 16 | export * from "./extra"; 17 | export * from "./generate"; 18 | export * from "./imageProcessing"; 19 | export * from "./inference"; 20 | export * from "./models"; 21 | export * from "./settings"; 22 | -------------------------------------------------------------------------------- /frontend/src/components/inference/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ControlNet } from "./ControlNet.vue"; 2 | export { default as ImageToImage } from "./Img2Img.vue"; 3 | export { default as Inpainting } from "./Inpainting.vue"; 4 | export { default as TextToImage } from "./Txt2Img.vue"; 5 | -------------------------------------------------------------------------------- /frontend/src/components/models/index.ts: -------------------------------------------------------------------------------- 1 | export { default as CivitAIDownload } from "./CivitAIDownload.vue"; 2 | export { default as CivitAIModelImage } from "./CivitAIModelImage.vue"; 3 | export { default as HuggingfaceDownload } from "./HuggingfaceDownload.vue"; 4 | export { default as ModelConvert } from "./ModelConvert.vue"; 5 | export { default as ModelManager } from "./ModelManager.vue"; 6 | export { default as ModelPopup } from "./ModelPopup.vue"; 7 | -------------------------------------------------------------------------------- /frontend/src/components/settings/BotSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /frontend/src/components/settings/FilesSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 27 | 28 | 33 | 39 | 40 | 41 | 42 | 43 | 56 | -------------------------------------------------------------------------------- /frontend/src/components/settings/FrontendSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 31 | ./defaultSettings/ControlNetSettings.vue./defaultSettings/ImageBrowserSettings.vue./defaultSettings/ImageToImageSettings.vue./defaultSettings/InpaintingSettings.vue./defaultSettings/TextToImageSettings.vue 32 | -------------------------------------------------------------------------------- /frontend/src/components/settings/GeneralSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 13 | 14 | 15 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 40 | -------------------------------------------------------------------------------- /frontend/src/components/settings/NSFWSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 29 | 30 | 31 | 32 | 33 | 34 | 48 | -------------------------------------------------------------------------------- /frontend/src/components/settings/UISettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 19 | 20 | 24 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /frontend/src/components/settings/defaultSettings/ImageBrowserSettings.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | -------------------------------------------------------------------------------- /frontend/src/components/settings/defaultSettings/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ControlNetSettings } from "./ControlNetSettings.vue"; 2 | export { default as ImageBrowserSettings } from "./ImageBrowserSettings.vue"; 3 | export { default as ImageToImageSettings } from "./ImageToImageSettings.vue"; 4 | export { default as InpaintingSettings } from "./InpaintingSettings.vue"; 5 | export { default as TextToImageSettings } from "./TextToImageSettings.vue"; 6 | export { default as ThemeSettings } from "./ThemeSettings.vue"; 7 | -------------------------------------------------------------------------------- /frontend/src/components/settings/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./defaultSettings"; 2 | 3 | export { default as AutoloadSettings } from "./AutoloadSettings.vue"; 4 | export { default as BotSettings } from "./BotSettings.vue"; 5 | export { default as FilesSettings } from "./FilesSettings.vue"; 6 | export { default as FrontendSettings } from "./FrontendSettings.vue"; 7 | export { default as GeneralSettings } from "./GeneralSettings.vue"; 8 | export { default as NSFWSettings } from "./NSFWSettings.vue"; 9 | export { default as OptimizationSettings } from "./OptimizationSettings.vue"; 10 | export { default as ReproducibilitySettings } from "./ReproducibilitySettings.vue"; 11 | export { default as SettingsDiffResolver } from "./SettingsDiffResolver.vue"; 12 | export { default as UISettings } from "./UISettings.vue"; 13 | -------------------------------------------------------------------------------- /frontend/src/env.ts: -------------------------------------------------------------------------------- 1 | const loc = window.location; 2 | let new_uri; 3 | if (loc.protocol === "https:") { 4 | new_uri = "wss:"; 5 | } else { 6 | new_uri = "ws:"; 7 | } 8 | 9 | export const serverUrl = import.meta.env.DEV 10 | ? "http://localhost:5003" 11 | : loc.protocol + "//" + loc.host; 12 | export const webSocketUrl = import.meta.env.DEV 13 | ? "ws://localhost:5003" 14 | : new_uri + "//" + loc.host; 15 | export const huggingfaceModelsFile = import.meta.env.DEV 16 | ? `${serverUrl}/api/test/huggingface-models.json` 17 | : "https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/experimental/static/huggingface-models.json"; 18 | 19 | export const isDev = import.meta.env.DEV; 20 | -------------------------------------------------------------------------------- /frontend/src/helper/capabilities.ts: -------------------------------------------------------------------------------- 1 | import type { Capabilities } from "@/core/interfaces"; 2 | import { serverUrl } from "@/env"; 3 | 4 | export const defaultCapabilities: Capabilities = { 5 | supported_backends: [["CPU", "cpu"]], 6 | supported_precisions_cpu: ["float32"], 7 | supported_precisions_gpu: ["float32"], 8 | supported_torch_compile_backends: ["inductor"], 9 | supported_self_attentions: [ 10 | ["Cross-Attention", "cross-attention"], 11 | ["Subquadratic Attention", "subquadratic"], 12 | ["Multihead Attention", "multihead"], 13 | ], 14 | has_tensorfloat: false, 15 | has_tensor_cores: false, 16 | supports_xformers: false, 17 | supports_triton: false, 18 | supports_int8: false, 19 | }; 20 | 21 | export async function getCapabilities() { 22 | try { 23 | const response = await fetch(`${serverUrl}/api/hardware/capabilities`); 24 | if (response.status !== 200) { 25 | console.error("Server is not responding"); 26 | return defaultCapabilities; 27 | } 28 | const data = await response.json(); 29 | return data; 30 | } catch (error) { 31 | console.error(error); 32 | return defaultCapabilities; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /frontend/src/helper/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./capabilities"; 2 | export * from "./mediaQueries"; 3 | -------------------------------------------------------------------------------- /frontend/src/helper/mediaQueries.ts: -------------------------------------------------------------------------------- 1 | import { useMediaQuery } from "@vueuse/core"; 2 | 3 | export const isLargeScreen = useMediaQuery("(min-width: 1000px)"); 4 | -------------------------------------------------------------------------------- /frontend/src/injectionKeys.ts: -------------------------------------------------------------------------------- 1 | import type { BuiltInGlobalTheme } from "naive-ui/es/themes/interface"; 2 | import type { ComputedRef, InjectionKey, Ref } from "vue"; 3 | import type { ExtendedThemeOverrides } from "./types"; 4 | 5 | // Theme key 6 | export const themeOverridesKey: InjectionKey< 7 | Ref 8 | > = Symbol("themeOverrides"); 9 | 10 | export const themeKey: InjectionKey> = 11 | Symbol("theme"); 12 | -------------------------------------------------------------------------------- /frontend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createPinia } from "pinia"; 2 | import { createApp } from "vue"; 3 | import VueGtag from "vue-gtag-next"; 4 | import App from "./App.vue"; 5 | import router from "./router"; 6 | 7 | import "./assets/main.css"; 8 | 9 | const app = createApp(App); 10 | 11 | app.use(createPinia()); 12 | app.use(router); 13 | app.use(VueGtag, { 14 | isEnabled: false, 15 | property: { 16 | id: "G-PYLCYXF7B8", 17 | }, 18 | }); 19 | 20 | app.mount("#app"); 21 | -------------------------------------------------------------------------------- /frontend/src/router/router-container.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/aitemplate.ts: -------------------------------------------------------------------------------- 1 | export interface IAITemplateSettings { 2 | num_threads: number; 3 | } 4 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/bot.ts: -------------------------------------------------------------------------------- 1 | import type { Sampler } from "."; 2 | 3 | export interface IBotSettings { 4 | default_scheduler: Sampler; 5 | verbose: boolean; 6 | use_default_negative_prompt: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/controlnet.ts: -------------------------------------------------------------------------------- 1 | import type { ControlNetType } from "@/core/interfaces"; 2 | import type { 3 | IADetailerSettings, 4 | IDeepShrinkFlag, 5 | IHighResFixFlag, 6 | IScaleCrafterFlag, 7 | IUpscaleFlag, 8 | Sampler, 9 | SigmaType, 10 | } from "."; 11 | 12 | export interface IControlNetSettings { 13 | prompt: string; 14 | negative_prompt: string; 15 | width: number; 16 | height: number; 17 | seed: number; 18 | cfg_scale: number; 19 | steps: number; 20 | batch_count: number; 21 | batch_size: number; 22 | sampler: Sampler | string; 23 | controlnet: ControlNetType; 24 | controlnet_conditioning_scale: number; 25 | detection_resolution: number; 26 | image: string; 27 | is_preprocessed: boolean; 28 | save_preprocessed: boolean; 29 | return_preprocessed: boolean; 30 | self_attention_scale: number; 31 | sigmas: SigmaType; 32 | highres: IHighResFixFlag; 33 | upscale: IUpscaleFlag; 34 | deepshrink: IDeepShrinkFlag; 35 | scalecrafter: IScaleCrafterFlag; 36 | adetailer: IADetailerSettings; 37 | } 38 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/adetailer.ts: -------------------------------------------------------------------------------- 1 | import type { Sampler, SigmaType } from ".."; 2 | 3 | export interface IADetailerSettings { 4 | enabled: boolean; 5 | 6 | // Inpainting 7 | seed: number; 8 | cfg_scale: number; 9 | steps: number; 10 | sampler: Sampler | string; 11 | self_attention_scale: number; 12 | sigmas: SigmaType; 13 | strength: number; 14 | 15 | // ADetailer specific 16 | mask_dilation: number; 17 | mask_blur: number; 18 | mask_padding: number; 19 | iterations: number; 20 | upscale: number; 21 | } 22 | 23 | export const defaultADetailerSettings: IADetailerSettings = { 24 | enabled: false, 25 | 26 | steps: 30, 27 | cfg_scale: 7, 28 | seed: -1, 29 | sampler: "dpmpp_2m", 30 | self_attention_scale: 0, 31 | sigmas: "exponential", 32 | strength: 0.4, 33 | 34 | mask_dilation: 0, 35 | mask_blur: 0, 36 | mask_padding: 0, 37 | iterations: 1, 38 | upscale: 2, 39 | }; 40 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/deepshrink.ts: -------------------------------------------------------------------------------- 1 | export interface IDeepShrinkFlag { 2 | enabled: boolean; 3 | 4 | depth_1: number; 5 | stop_at_1: number; 6 | 7 | depth_2: number; 8 | stop_at_2: number; 9 | 10 | scaler: string; 11 | base_scale: number; 12 | early_out: boolean; 13 | } 14 | 15 | export const deepShrinkFlagDefault: IDeepShrinkFlag = Object.freeze({ 16 | enabled: false, 17 | 18 | depth_1: 3, 19 | stop_at_1: 0.15, 20 | 21 | depth_2: 4, 22 | stop_at_2: 0.3, 23 | 24 | scaler: "bislerp", 25 | base_scale: 0.5, 26 | early_out: false, 27 | }); 28 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/highres.ts: -------------------------------------------------------------------------------- 1 | export interface IHighResFixFlag { 2 | enabled: boolean; 3 | scale: number; 4 | mode: "latent" | "image"; 5 | image_upscaler: string; 6 | latent_scale_mode: 7 | | "nearest" 8 | | "area" 9 | | "bilinear" 10 | | "bislerp" 11 | | "bicubic" 12 | | "nearest-exact"; 13 | antialiased: boolean; 14 | strength: number; 15 | steps: number; 16 | } 17 | 18 | export const highresFixFlagDefault: IHighResFixFlag = Object.freeze({ 19 | enabled: false, 20 | scale: 2, 21 | mode: "image", 22 | image_upscaler: "RealESRGAN_x4plus_anime_6B", 23 | latent_scale_mode: "bislerp", 24 | antialiased: false, 25 | strength: 0.65, 26 | steps: 50, 27 | }); 28 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/index.ts: -------------------------------------------------------------------------------- 1 | import type { IRefinerSettings } from "./refiner"; 2 | import type { ISDXLSettings } from "./sdxl"; 3 | 4 | export * from "./adetailer"; 5 | export * from "./deepshrink"; 6 | export * from "./highres"; 7 | export * from "./refiner"; 8 | export * from "./scalecraft"; 9 | export * from "./sdxl"; 10 | export * from "./upscale"; 11 | 12 | export interface IFlagSettings { 13 | sdxl: ISDXLSettings; 14 | refiner: IRefinerSettings; 15 | } 16 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/refiner.ts: -------------------------------------------------------------------------------- 1 | export interface IRefinerSettings { 2 | model: string | undefined; 3 | aesthetic_score: number; 4 | negative_aesthetic_score: number; 5 | steps: 50; 6 | strength: number; 7 | } 8 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/scalecraft.ts: -------------------------------------------------------------------------------- 1 | export interface IScaleCrafterFlag { 2 | enabled: boolean; 3 | 4 | base: string; 5 | unsafe_resolutions: boolean; 6 | disperse: boolean; 7 | } 8 | 9 | export const scaleCrafterFlagDefault: IScaleCrafterFlag = Object.freeze({ 10 | enabled: false, 11 | 12 | base: "sd15", 13 | unsafe_resolutions: true, 14 | disperse: false, 15 | }); 16 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/sdxl.ts: -------------------------------------------------------------------------------- 1 | export interface ISDXLSettings { 2 | original_size: { 3 | width: number; 4 | height: number; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/flags/upscale.ts: -------------------------------------------------------------------------------- 1 | export interface IUpscaleFlag { 2 | enabled: boolean; 3 | upscale_factor: number; 4 | tile_size: number; 5 | tile_padding: number; 6 | model: string; 7 | } 8 | 9 | export const upscaleFlagDefault: IUpscaleFlag = Object.freeze({ 10 | enabled: false, 11 | upscale_factor: 4, 12 | tile_size: 128, 13 | tile_padding: 10, 14 | model: "RealESRGAN_x4plus_anime_6B", 15 | }); 16 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/frontend.ts: -------------------------------------------------------------------------------- 1 | export interface IFrontendSettings { 2 | theme: string; 3 | enable_theme_editor: boolean; 4 | image_browser_columns: number; 5 | on_change_timer: number; 6 | nsfw_ok_threshold: number; 7 | background_image_override: string; 8 | disable_analytics: boolean; 9 | } 10 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/img2img.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | IADetailerSettings, 3 | IDeepShrinkFlag, 4 | IHighResFixFlag, 5 | IScaleCrafterFlag, 6 | IUpscaleFlag, 7 | Sampler, 8 | SigmaType, 9 | } from "."; 10 | 11 | export interface IImg2ImgSettings { 12 | prompt: string; 13 | negative_prompt: string; 14 | width: number; 15 | height: number; 16 | seed: number; 17 | cfg_scale: number; 18 | sampler: Sampler | string; 19 | steps: number; 20 | batch_count: number; 21 | batch_size: number; 22 | denoising_strength: number; 23 | image: string; 24 | self_attention_scale: number; 25 | sigmas: SigmaType; 26 | highres: IHighResFixFlag; 27 | upscale: IUpscaleFlag; 28 | deepshrink: IDeepShrinkFlag; 29 | scalecrafter: IScaleCrafterFlag; 30 | adetailer: IADetailerSettings; 31 | } 32 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./aitemplate"; 2 | export * from "./api"; 3 | export * from "./controlnet"; 4 | export * from "./flags"; 5 | export * from "./img2img"; 6 | export * from "./inpainting"; 7 | export * from "./quantization"; 8 | export * from "./sampler"; 9 | export * from "./sigma"; 10 | export * from "./tagger"; 11 | export * from "./txt2img"; 12 | export * from "./upscale"; 13 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/inpainting.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | IADetailerSettings, 3 | IDeepShrinkFlag, 4 | IHighResFixFlag, 5 | IScaleCrafterFlag, 6 | IUpscaleFlag, 7 | Sampler, 8 | SigmaType, 9 | } from "."; 10 | 11 | export interface IInpaintingSettings { 12 | prompt: string; 13 | negative_prompt: string; 14 | width: number; 15 | height: number; 16 | seed: number; 17 | cfg_scale: number; 18 | steps: number; 19 | batch_count: number; 20 | batch_size: number; 21 | sampler: Sampler | string; 22 | image: string; 23 | mask_image: string; 24 | self_attention_scale: number; 25 | sigmas: SigmaType; 26 | strength: number; 27 | highres: IHighResFixFlag; 28 | upscale: IUpscaleFlag; 29 | deepshrink: IDeepShrinkFlag; 30 | scalecrafter: IScaleCrafterFlag; 31 | adetailer: IADetailerSettings; 32 | } 33 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/onnx.ts: -------------------------------------------------------------------------------- 1 | import type { IQuantDict } from "."; 2 | 3 | export interface IONNXSettings { 4 | quant_dict: IQuantDict; 5 | convert_to_fp16: boolean; 6 | simplify_unet: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/quantization.ts: -------------------------------------------------------------------------------- 1 | export interface IQuantDict { 2 | vae_decoder: boolean | null; 3 | vae_encoder: boolean | null; 4 | unet: boolean | null; 5 | text_encoder: boolean | null; 6 | } 7 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/sampler.ts: -------------------------------------------------------------------------------- 1 | export enum Sampler { 2 | DDIM = 1, 3 | DDPM = 2, 4 | PNDM = 3, 5 | LMSD = 4, 6 | EulerDiscrete = 5, 7 | HeunDiscrete = 6, 8 | EulerAncestralDiscrete = 7, 9 | DPMSolverMultistep = 8, 10 | DPMSolverSinglestep = 9, 11 | KDPM2Discrete = 10, 12 | KDPM2AncestralDiscrete = 11, 13 | DEISMultistep = 12, 14 | UniPCMultistep = 13, 15 | DPMSolverSDEScheduler = 14, 16 | } 17 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/sigma.ts: -------------------------------------------------------------------------------- 1 | export type SigmaType = 2 | | "automatic" 3 | | "karras" 4 | | "exponential" 5 | | "polyexponential" 6 | | "vp"; 7 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/tagger.ts: -------------------------------------------------------------------------------- 1 | export interface ITaggerSettings { 2 | image: string; 3 | model: string; 4 | threshold: number; 5 | } 6 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/txt2img.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | IADetailerSettings, 3 | IDeepShrinkFlag, 4 | IHighResFixFlag, 5 | IScaleCrafterFlag, 6 | IUpscaleFlag, 7 | Sampler, 8 | SigmaType, 9 | } from "."; 10 | 11 | export interface ITxt2ImgSettings { 12 | prompt: string; 13 | negative_prompt: string; 14 | width: number; 15 | height: number; 16 | seed: number; 17 | cfg_scale: number; 18 | sampler: Sampler | string; 19 | steps: number; 20 | batch_count: number; 21 | batch_size: number; 22 | self_attention_scale: number; 23 | sigmas: SigmaType; 24 | highres: IHighResFixFlag; 25 | upscale: IUpscaleFlag; 26 | deepshrink: IDeepShrinkFlag; 27 | scalecrafter: IScaleCrafterFlag; 28 | adetailer: IADetailerSettings; 29 | } 30 | -------------------------------------------------------------------------------- /frontend/src/settingsTypes/upscale.ts: -------------------------------------------------------------------------------- 1 | export interface IUpscaleSettings { 2 | image: string; 3 | upscale_factor: number; 4 | model: 5 | | "RealESRGAN_x4plus" 6 | | "RealESRNet_x4plus" 7 | | "RealESRGAN_x4plus_anime_6B" 8 | | "RealESRGAN_x2plus" 9 | | "RealESR-general-x4v3"; 10 | tile_size: number; 11 | tile_padding: number; 12 | } 13 | -------------------------------------------------------------------------------- /frontend/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { GlobalThemeOverrides } from "naive-ui"; 2 | 3 | export type ExtendedThemeOverrides = GlobalThemeOverrides & { 4 | volta: { 5 | base: "light" | "dark" | undefined; 6 | blur: string | undefined; 7 | backgroundImage: string | undefined; 8 | }; 9 | }; 10 | 11 | export type PyTorchModelBase = 12 | | "SD1.x" 13 | | "SD2.x" 14 | | "SDXL" 15 | | "Kandinsky 2.1" 16 | | "Kandinsky 2.2" 17 | | "Wuerstchen" 18 | | "IF" 19 | | "Unknown"; 20 | 21 | export type PyTorchModelStage = "text_encoding" | "first_stage" | "last_stage"; 22 | 23 | export type InferenceTabs = "txt2img" | "img2img" | "inpainting" | "controlnet"; 24 | -------------------------------------------------------------------------------- /frontend/src/views/404View.vue: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 26 | -------------------------------------------------------------------------------- /frontend/src/views/AboutView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is an about page 4 | 5 | 6 | -------------------------------------------------------------------------------- /frontend/src/views/AccelerateView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | -------------------------------------------------------------------------------- /frontend/src/views/ExtraView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /frontend/src/views/Image2ImageView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /frontend/src/views/ImageProcessingView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | -------------------------------------------------------------------------------- /frontend/src/views/ModelsView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 30 | -------------------------------------------------------------------------------- /frontend/src/views/TestView.vue: -------------------------------------------------------------------------------- 1 | 2 | (showModal = e)" 6 | /> 7 | 8 | 9 | 23 | -------------------------------------------------------------------------------- /frontend/src/views/TextToImageView.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /frontend/tsconfig.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.node.json", 3 | "include": [ 4 | "vite.config.*", 5 | "vitest.config.*", 6 | "cypress.config.*", 7 | "playwright.config.*" 8 | ], 9 | "compilerOptions": { 10 | "composite": true, 11 | "types": ["node"], 12 | "preserveValueImports": false, 13 | "verbatimModuleSyntax": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.web.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "paths": { 7 | "@/*": ["./src/*"] 8 | }, 9 | "target": "es2019", 10 | "module": "esnext", 11 | "lib": ["es2019", "dom"], 12 | "preserveValueImports": false, 13 | "verbatimModuleSyntax": true 14 | }, 15 | 16 | "references": [ 17 | { 18 | "path": "./tsconfig.config.json" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /frontend/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from "node:url"; 2 | 3 | import vue from "@vitejs/plugin-vue"; 4 | import vueJsx from "@vitejs/plugin-vue-jsx"; 5 | import { defineConfig } from "vite"; 6 | 7 | // https://vitejs.dev/config/ 8 | export default defineConfig({ 9 | plugins: [vue(), vueJsx()], 10 | resolve: { 11 | alias: { 12 | "@": fileURLToPath(new URL("./src", import.meta.url)), 13 | }, 14 | }, 15 | build: { 16 | rollupOptions: { 17 | treeshake: "recommended", 18 | output: { 19 | entryFileNames: `assets/[name].js`, 20 | chunkFileNames: `assets/[name].js`, 21 | assetFileNames: `assets/[name].[ext]`, 22 | }, 23 | }, 24 | minify: false, 25 | }, 26 | }); 27 | -------------------------------------------------------------------------------- /libs/hardware-accel-test.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/libs/hardware-accel-test.dll -------------------------------------------------------------------------------- /manager/.gitignore: -------------------------------------------------------------------------------- 1 | venv -------------------------------------------------------------------------------- /manager/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "voltaml-manager" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | indicatif = "0.17.2" 10 | dialoguer = "0.10.3" 11 | shlex = "1.1.0" 12 | console = "0.15.5" 13 | prettytable-rs = "0.10.0" 14 | regex = "1.7.3" 15 | shellexpand = "3.1.0" 16 | 17 | [target.'cfg(target_os = "windows")'.build-dependencies] 18 | winres = "0.1" 19 | -------------------------------------------------------------------------------- /manager/build.rs: -------------------------------------------------------------------------------- 1 | use std::io; 2 | 3 | #[cfg(windows)] 4 | use winres::WindowsResource; 5 | 6 | fn main() -> io::Result<()> { 7 | #[cfg(windows)] 8 | { 9 | WindowsResource::new() 10 | // This path can be absolute, or relative to your crate root. 11 | .set_icon("../static/volta-rounded.ico") 12 | .compile()?; 13 | } 14 | Ok(()) 15 | } 16 | -------------------------------------------------------------------------------- /manager/src/apt.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use crate::utils::shell::spawn_command; 4 | use console::style; 5 | 6 | pub fn update() { 7 | println!("{} {}", style("[!]").yellow(), "Updating packages..."); 8 | let res = spawn_command("sudo apt update", "Update apt"); 9 | if res.is_err() { 10 | println!("Error: {}", res.err().unwrap()); 11 | } 12 | } 13 | 14 | pub fn upgrade() { 15 | println!("{} {}", style("[!]").yellow(), "Upgrading packages..."); 16 | let res = spawn_command("sudo apt upgrade -y", "Upgrade apt"); 17 | if res.is_err() { 18 | println!("Error: {}", res.err().unwrap()); 19 | } 20 | } 21 | 22 | pub fn install(package: &str) -> Result<(), Box> { 23 | println!( 24 | "{} {}", 25 | style("[!]").yellow(), 26 | format!("Installing {}...", package) 27 | ); 28 | spawn_command( 29 | format!("sudo apt install -y {}", package).as_str(), 30 | "Install package", 31 | )?; 32 | Ok(()) 33 | } 34 | -------------------------------------------------------------------------------- /manager/src/debug.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use crate::utils::python::installed_packages_venv; 4 | use prettytable::{row, Table}; 5 | 6 | pub fn python_packages() -> Result> { 7 | let mut table = Table::new(); 8 | table.add_row(row![FGb->"Name", FYb->"Version"]); 9 | let packages = installed_packages_venv()?; 10 | for package in packages { 11 | table.add_row(row![FG->package.name, FY->package.version]); 12 | } 13 | return Ok(table); 14 | } 15 | -------------------------------------------------------------------------------- /manager/src/git/checkout.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use crate::utils::shell::spawn_command; 4 | 5 | pub fn checkout_commit(repo_path_str: &str, commit_string: &str) -> Result<(), Box> { 6 | spawn_command( 7 | &format!( 8 | "bash -c \"cd {} && git checkout {}\"", 9 | repo_path_str, commit_string 10 | ), 11 | &format!( 12 | "Checked out to commit {} in {}", 13 | commit_string, repo_path_str 14 | ), 15 | )?; 16 | 17 | Ok(()) 18 | } 19 | 20 | pub fn checkout_branch(repo_path_str: &str, branch_name: &str) -> Result<(), Box> { 21 | spawn_command( 22 | &format!( 23 | "git --work-tree=\"{}\" checkout {}", 24 | repo_path_str, branch_name 25 | ), 26 | &format!("Checkout branch {} in {}", branch_name, repo_path_str), 27 | )?; 28 | 29 | Ok(()) 30 | } 31 | -------------------------------------------------------------------------------- /manager/src/git/clone.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use crate::utils::shell::spawn_command; 4 | 5 | pub fn clone_repo(url: &str, path: &str, branch_name: &str) -> Result<(), Box> { 6 | spawn_command( 7 | &format!("git clone {} -b {} {}", url, branch_name, path), 8 | &format!("Clone repo {} into {}", url, path), 9 | )?; 10 | 11 | Ok(()) 12 | } 13 | -------------------------------------------------------------------------------- /manager/src/git/git.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use crate::utils::shell::{run_command, spawn_command}; 4 | 5 | pub fn is_git_repo_up_to_date() -> Result> { 6 | run_command("git fetch", "")?; 7 | 8 | let current_branch_raw = 9 | run_command(&"git rev-parse --abbrev-ref HEAD", "Get current git branch")?; 10 | let current_branch = current_branch_raw.trim(); 11 | 12 | let remote_command = format!("git rev-parse origin/{}", current_branch); 13 | let remote_commit_raw = run_command(&remote_command, "Parse remote commit hash")?; 14 | let remote_commit = remote_commit_raw.trim(); 15 | 16 | let local_commit_raw = run_command("git rev-parse HEAD", "Parse local commit hash")?; 17 | let local_commit = local_commit_raw.trim(); 18 | 19 | Ok(remote_commit == local_commit) 20 | } 21 | 22 | pub fn update_git_repo() -> Result> { 23 | let output = spawn_command("git pull", "Update git repo")?; 24 | Ok(output) 25 | } 26 | 27 | pub fn get_branches() -> Result, Box> { 28 | let output = run_command("git branch -l", "Get all git branches")?; 29 | let branches = output 30 | .replace("*", "") 31 | .split("\n") 32 | .collect::>() 33 | .iter() 34 | .map(|s| s.trim()) 35 | .filter(|s| !s.is_empty()) 36 | .map(|s| s.to_owned()) 37 | .collect(); 38 | Ok(branches) 39 | } 40 | -------------------------------------------------------------------------------- /manager/src/git/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod checkout; 2 | pub mod clone; 3 | pub mod git; 4 | -------------------------------------------------------------------------------- /manager/src/install.rs: -------------------------------------------------------------------------------- 1 | use crate::targets; 2 | use console::style; 3 | use dialoguer::{theme::ColorfulTheme, Confirm, Select}; 4 | 5 | pub fn install() { 6 | let response = Confirm::with_theme(&ColorfulTheme::default()) 7 | .with_prompt(format!("{} Project will be installed in CURRENT directory. Are you sure you want to install here?", style("[WARNING]").yellow())) 8 | .interact() 9 | .unwrap_or(false); 10 | if !response { 11 | return; 12 | } 13 | 14 | let items = vec!["Windows", "WSL", "Ubuntu"]; 15 | let response = Select::with_theme(&ColorfulTheme::default()) 16 | .default(0) 17 | .items(&items) 18 | .interact() 19 | .unwrap(); 20 | 21 | let branches = vec!["Main", "Experimental"]; 22 | let branch = Select::with_theme(&ColorfulTheme::default()) 23 | .default(0) 24 | .items(&branches) 25 | .interact() 26 | .unwrap(); 27 | 28 | match response { 29 | 0 => targets::windows::install(branch == 1), 30 | 1 => targets::ubuntu::install(true, branch == 1), 31 | 2 => targets::ubuntu::install(false, branch == 1), 32 | _ => println!("Error"), 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /manager/src/targets/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::utils::shell::run_command; 2 | 3 | pub mod ubuntu; 4 | pub mod windows; 5 | 6 | #[derive(PartialEq)] 7 | pub enum Target { 8 | Windows, 9 | Linux, 10 | WSL, 11 | Unknown, 12 | } 13 | 14 | impl ToString for Target { 15 | fn to_string(&self) -> String { 16 | match *self { 17 | Target::Linux => "Linux".to_string(), 18 | Target::Windows => "Windows".to_string(), 19 | Target::WSL => "WSL".to_string(), 20 | Target::Unknown => "Unknown".to_string(), 21 | } 22 | } 23 | } 24 | 25 | pub fn detect_target() -> Target { 26 | if cfg!(target_os = "windows") { 27 | return Target::Windows; 28 | } else if cfg!(target_os = "linux") { 29 | let uname = run_command("uname -r", ""); 30 | if uname.is_ok() { 31 | let uname = uname.unwrap(); 32 | if uname.contains("microsoft") { 33 | Target::WSL 34 | } else { 35 | Target::Linux 36 | } 37 | } else { 38 | Target::Linux 39 | } 40 | } else { 41 | Target::Unknown 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /manager/src/utils/aitemplate.rs: -------------------------------------------------------------------------------- 1 | use std::{error::Error, fs, path::Path}; 2 | 3 | use console::style; 4 | use shellexpand::tilde; 5 | 6 | pub fn does_aitemplate_folder_exist() -> bool { 7 | let path = Path::new("AITemplate"); 8 | path.exists() 9 | } 10 | 11 | pub fn is_aitemplate_installed() -> bool { 12 | let res = crate::utils::python::is_package_installed_venv("aitemplate"); 13 | if res.is_ok() { 14 | return res.unwrap(); 15 | } else { 16 | return false; 17 | } 18 | } 19 | 20 | pub fn reinstall_aitemplate_python_package() -> Result<(), Box> { 21 | crate::utils::shell::spawn_command( 22 | "bash -c \"cd AITemplate/python && ../../venv/bin/python setup.py bdist_wheel && ../../venv/bin/pip install dist/*.whl --force-reinstall\"", 23 | "Install AITemplate", 24 | )?; 25 | Ok(()) 26 | } 27 | 28 | pub fn wipe_aitemplate_cache_dir() -> Result<(), Box> { 29 | let path = tilde("~/.aitemplate").to_string(); 30 | let path = Path::new(&path); 31 | 32 | if !path.exists() { 33 | return Ok(()); 34 | } 35 | println!( 36 | "{} Wiping AITemplate cache directory: {}", 37 | style("[INFO]").yellow(), 38 | path.display() 39 | ); 40 | fs::remove_dir_all(path)?; 41 | Ok(()) 42 | } 43 | -------------------------------------------------------------------------------- /manager/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod aitemplate; 2 | pub mod nvidia; 3 | pub mod python; 4 | pub mod shell; 5 | 6 | pub fn is_root() -> bool { 7 | let output = shell::run_command("whoami", "Check if root"); 8 | if output.is_ok() { 9 | let output = output.unwrap(); 10 | if output == "root" { 11 | return true; 12 | } else { 13 | return false; 14 | } 15 | } else { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "voltaml-fast-stable-diffusion" 3 | authors = [{ name = "Tomáš Novák", email = "tamoncz@gmail.com" }] 4 | description = "Advanced Stable Diffusion WebUI with support for model acceleration" 5 | readme = "README.md" 6 | requires-python = ">=3.8" 7 | license = { text = "GPL-3.0" } 8 | dynamic = ["version"] 9 | 10 | [project.urls] 11 | homepage = "https://voltaml.github.io/voltaML-fast-stable-diffusion/" 12 | documentation = "https://voltaml.github.io/voltaML-fast-stable-diffusion/" 13 | repository = "https://github.com/voltaML/voltaML-fast-stable-diffusion" 14 | 15 | [tool.ruff] 16 | ignore = [ 17 | "E501", # line too long 18 | "E731", # do not assign a lambda expression, use a def 19 | ] 20 | target-version = "py39" 21 | 22 | [tool.ruff.flake8-quotes] 23 | docstring-quotes = "double" 24 | 25 | [tool.ruff.per-file-ignores] 26 | "__init__.py" = ["F401"] 27 | 28 | [tool.poetry] 29 | name = "voltaml-fast-stable-diffusion" 30 | version = "0.1.0" 31 | description = "" 32 | authors = ["Stax124 "] 33 | readme = "README.md" 34 | 35 | [tool.poetry.dependencies] 36 | python = "3.10.*" 37 | 38 | 39 | [build-system] 40 | requires = ["poetry-core"] 41 | build-backend = "poetry.core.masonry.api" 42 | -------------------------------------------------------------------------------- /pyrightconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": [ 3 | "core/hijack/diffusers/", 4 | "venv/", 5 | "venv-intel/", 6 | "core/submodules/", 7 | "typings/", 8 | "AITemplate" 9 | ], 10 | "reportMissingImports": "none" 11 | } -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --ignore=core/submodules --ignore=AITemplate 3 | pythonpath = . 4 | filterwarnings = ignore 5 | 6 | markers: 7 | regression: tests against previous bugs 8 | 9 | optional_tests: 10 | slow: slow tests -------------------------------------------------------------------------------- /requirements/api.txt: -------------------------------------------------------------------------------- 1 | requests==2.31.0 2 | fastapi==0.95.0 3 | websockets==12.0 4 | uvicorn==0.24.0.post1 5 | pyngrok==7.0.0 6 | nest_asyncio==1.5.8 7 | fastapi-analytics==1.1.5 8 | fastapi-simple-cachecontrol==0.1.0 9 | python-multipart==0.0.6 10 | streaming-form-data==1.13.0 11 | rich==13.6.0 12 | -------------------------------------------------------------------------------- /requirements/bot.txt: -------------------------------------------------------------------------------- 1 | discord.py==2.3.0 2 | -------------------------------------------------------------------------------- /requirements/dev.txt: -------------------------------------------------------------------------------- 1 | pre-commit==3.5.0 2 | black==23.11.0 3 | ruff==0.1.5 -------------------------------------------------------------------------------- /requirements/interrogation.txt: -------------------------------------------------------------------------------- 1 | open-clip-torch==2.23.0 2 | git+https://github.com/dhansmair/flamingo-mini@3f2234da433cad5aae07d5fee12c6c61cda9cca0 # 0.0.2 -------------------------------------------------------------------------------- /requirements/onnx.txt: -------------------------------------------------------------------------------- 1 | onnxruntime==1.16.2 2 | onnx==1.15.0 -------------------------------------------------------------------------------- /requirements/pytorch.txt: -------------------------------------------------------------------------------- 1 | --extra-index-url https://pypi.ngc.nvidia.com 2 | coloredlogs==15.0.1 3 | dataclasses-json==0.6.1 4 | diffusers==0.24.0 5 | huggingface-hub==0.19.4 6 | tokenizers==0.15.0 7 | scipy==1.10.1 8 | transformers==4.36.1 9 | accelerate==0.24.1 10 | ftfy==6.1.1 11 | OmegaConf==2.3.0 12 | safetensors==0.4.0 13 | pytorch-lightning==2.1.1 14 | gpustat==1.1.1 15 | opencv-contrib-python-headless==4.7.0.72 16 | controlnet-aux==0.0.7 17 | realesrgan==0.3.0 18 | timm==0.9.10 19 | boto3==1.28.83 20 | tomesd==0.1.3 21 | invisible-watermark==0.2.0 22 | cpufeature==0.2.1; platform_system != "Darwin" 23 | pyamdgpuinfo==2.1.6; platform_system == "Linux" 24 | piexif==1.1.3 25 | git+https://github.com/tfernd/HyperTile@2ef64b2800d007d305755c33550537410310d7df # 0.1.5 26 | k-diffusion==0.1.1 27 | asdff==0.2.1 28 | -------------------------------------------------------------------------------- /requirements/sfast.txt: -------------------------------------------------------------------------------- 1 | xformers 2 | ninja==1.11.1.1 3 | triton>=2.1.0; platform_system == "Linux" 4 | git+https://github.com/chengzeyi/stable-fast.git@760170833143b975072eabc17bc9860ba1012000 5 | -------------------------------------------------------------------------------- /requirements/tests.txt: -------------------------------------------------------------------------------- 1 | httpx==0.25.1 2 | pytest==7.4.3 3 | pytest-optional-tests==0.1.1 4 | pytest-cov==4.1.0 -------------------------------------------------------------------------------- /scripts/start-windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | call git pull --recurse-submodules 4 | 5 | set VENVDIR=%CD%\venv 6 | set PYTHON=%VENVDIR%\Scripts\Python.exe 7 | set ACCELERATE=%VENVDIR%\Scripts\accelerate.exe 8 | 9 | set HUGGINGFACE_TOKEN= 10 | set DISCORD_BOT_TOKEN= 11 | set LOG_LEVEL=INFO 12 | 13 | call %VENVDIR%\Scripts\activate 14 | 15 | start http://localhost:5003/ 16 | 17 | if EXIST %ACCELERATE% ( 18 | %ACCELERATE% launch main.py 19 | ) ELSE ( 20 | %PYTHON% main.py 21 | ) 22 | 23 | pause 24 | exit /b -------------------------------------------------------------------------------- /scripts/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python3 main.py --log-level=${LOG_LEVEL} --host -------------------------------------------------------------------------------- /scripts/test-docker-gpu-availability.sh: -------------------------------------------------------------------------------- 1 | sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | venv/bin/python main.py -------------------------------------------------------------------------------- /static/volta-rounded.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/static/volta-rounded.ico -------------------------------------------------------------------------------- /static/volta-rounded.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/static/volta-rounded.webp -------------------------------------------------------------------------------- /static/volta.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VoltaML/voltaML-fast-stable-diffusion/1aea33bb7a37d251044cc4f04fc095be4d936be4/static/volta.webp -------------------------------------------------------------------------------- /tests/const.py: -------------------------------------------------------------------------------- 1 | KDIFF_SAMPLERS = [ 2 | "euler_a", 3 | "euler", 4 | "lms", 5 | "heun", 6 | "dpm_fast", 7 | "dpm_adaptive", 8 | "dpm2", 9 | "dpm2_a", 10 | "dpmpp_2s_a", 11 | "dpmpp_2m", 12 | "dpmpp_2m_sharp", 13 | "dpmpp_sde", 14 | "dpmpp_2m_sde", 15 | "dpmpp_3m_sde", 16 | "unipc_multistep", 17 | "restart", 18 | ] 19 | -------------------------------------------------------------------------------- /tests/functions.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import io 3 | 4 | import numpy as np 5 | from PIL import Image 6 | 7 | from core.utils import convert_image_to_base64 8 | 9 | 10 | def generate_random_image_base64(w: int = 512, h: int = 512) -> str: 11 | "Generate a random image and return it as a base64 encoded string" 12 | 13 | np_image = np.random.randint(0, 255, size=(w, h, 3), dtype=np.uint8) 14 | image = Image.fromarray(np_image) 15 | encoded_image = convert_image_to_base64(image, prefix_js=False) 16 | 17 | return encoded_image 18 | 19 | 20 | def generate_random_image(w: int = 512, h: int = 512) -> Image.Image: 21 | "Generate a random image and return it as PIL Image" 22 | 23 | np_image = np.random.randint(0, 255, size=(w, h, 3), dtype=np.uint8) 24 | image = Image.fromarray(np_image) 25 | 26 | return image 27 | 28 | 29 | def hash_image(image: Image.Image) -> str: 30 | "Return sha256 hash of image, computed partially so that it does not overflow memory" 31 | 32 | hash_ = hashlib.sha256() 33 | image_bytes = io.BytesIO() 34 | image.save(image_bytes, format="PNG") 35 | image_bytes.seek(0) 36 | while True: 37 | data = image_bytes.read(65536) 38 | if not data: 39 | break 40 | hash_.update(data) 41 | 42 | image_bytes.close() 43 | return hash_.hexdigest() 44 | -------------------------------------------------------------------------------- /tests/test_main.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | os.environ["TESTING"] = "1" 4 | 5 | from main import checks, main # noqa: E402 6 | 7 | 8 | def test_checks(): 9 | checks() 10 | 11 | 12 | def test_main(): 13 | main(exit_after_init=True) 14 | -------------------------------------------------------------------------------- /tests/test_utils.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from core.utils import convert_base64_to_bytes, get_grid_dimension, run_in_thread_async 4 | 5 | 6 | def test_convert_base64_to_bytes(): 7 | data = "aGVsbG8gd29ybGQ=" 8 | assert convert_base64_to_bytes(data).read() == b"hello world" 9 | 10 | 11 | def test_get_grid_dimension(): 12 | assert get_grid_dimension(1) == (1, 1) 13 | assert get_grid_dimension(2) == (2, 1) 14 | assert get_grid_dimension(3) == (2, 2) 15 | assert get_grid_dimension(4) == (2, 2) 16 | assert get_grid_dimension(12) == (4, 3) 17 | assert get_grid_dimension(50) == (8, 7) 18 | 19 | 20 | def test_run_in_thread_async(): 21 | # async def coroutine(): 22 | # return 1 23 | 24 | def func(): 25 | return 1 26 | 27 | assert asyncio.run(run_in_thread_async(func)) == 1 28 | # assert run_in_thread_async(coroutine) == 1 29 | --------------------------------------------------------------------------------