mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-06 09:56:49 +02:00
Use vram_usage_level while starting webui
This commit is contained in:
parent
5a5d37ba52
commit
c1193377b6
@ -268,11 +268,6 @@ def get_env():
|
|||||||
env_entries["GIT"] = [f"{dir}/bin/git"]
|
env_entries["GIT"] = [f"{dir}/bin/git"]
|
||||||
env_entries["venv_dir"] = ["-"]
|
env_entries["venv_dir"] = ["-"]
|
||||||
|
|
||||||
if config.get("render_devices", "auto") == "cpu" or (
|
|
||||||
OS_NAME in ("Windows", "Linux") and not has_discrete_graphics_card()
|
|
||||||
):
|
|
||||||
env_entries["COMMANDLINE_ARGS"][0] += " --always-cpu"
|
|
||||||
|
|
||||||
if OS_NAME == "Darwin":
|
if OS_NAME == "Darwin":
|
||||||
# based on https://github.com/lllyasviel/stable-diffusion-webui-forge/blob/e26abf87ecd1eefd9ab0a198eee56f9c643e4001/webui-macos-env.sh
|
# based on https://github.com/lllyasviel/stable-diffusion-webui-forge/blob/e26abf87ecd1eefd9ab0a198eee56f9c643e4001/webui-macos-env.sh
|
||||||
# hack - have to define these here, otherwise webui-macos-env.sh will overwrite COMMANDLINE_ARGS
|
# hack - have to define these here, otherwise webui-macos-env.sh will overwrite COMMANDLINE_ARGS
|
||||||
@ -284,6 +279,14 @@ def get_env():
|
|||||||
env_entries["TORCH_COMMAND"] = ["pip install torch==2.1.2 torchvision==0.16.2"]
|
env_entries["TORCH_COMMAND"] = ["pip install torch==2.1.2 torchvision==0.16.2"]
|
||||||
else:
|
else:
|
||||||
env_entries["TORCH_COMMAND"] = ["pip install torch==2.3.1 torchvision==0.18.1"]
|
env_entries["TORCH_COMMAND"] = ["pip install torch==2.3.1 torchvision==0.18.1"]
|
||||||
|
else:
|
||||||
|
vram_usage_level = config.get("vram_usage_level", "balanced")
|
||||||
|
if config.get("render_devices", "auto") == "cpu" or not has_discrete_graphics_card():
|
||||||
|
env_entries["COMMANDLINE_ARGS"][0] += " --always-cpu"
|
||||||
|
elif vram_usage_level == "low":
|
||||||
|
env_entries["COMMANDLINE_ARGS"][0] += " --always-low-vram"
|
||||||
|
elif vram_usage_level == "high":
|
||||||
|
env_entries["COMMANDLINE_ARGS"][0] += " --always-high-vram"
|
||||||
|
|
||||||
env = {}
|
env = {}
|
||||||
for key, paths in env_entries.items():
|
for key, paths in env_entries.items():
|
||||||
|
@ -71,6 +71,7 @@ class SetAppConfigRequest(BaseModel, extra=Extra.allow):
|
|||||||
use_v3_engine: bool = True
|
use_v3_engine: bool = True
|
||||||
backend: str = "ed_diffusers"
|
backend: str = "ed_diffusers"
|
||||||
models_dir: str = None
|
models_dir: str = None
|
||||||
|
vram_usage_level: str = "balanced"
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -188,6 +189,7 @@ def set_app_config_internal(req: SetAppConfigRequest):
|
|||||||
config["use_v3_engine"] = req.backend == "ed_diffusers"
|
config["use_v3_engine"] = req.backend == "ed_diffusers"
|
||||||
config["backend"] = req.backend
|
config["backend"] = req.backend
|
||||||
config["models_dir"] = req.models_dir
|
config["models_dir"] = req.models_dir
|
||||||
|
config["vram_usage_level"] = req.vram_usage_level
|
||||||
|
|
||||||
for property, property_value in req.dict().items():
|
for property, property_value in req.dict().items():
|
||||||
if property_value is not None and property not in req.__fields__ and property not in PROTECTED_CONFIG_KEYS:
|
if property_value is not None and property not in req.__fields__ and property not in PROTECTED_CONFIG_KEYS:
|
||||||
|
@ -161,6 +161,7 @@ var PARAMETERS = [
|
|||||||
"<b>Low:</b> slowest, recommended for GPUs with 3 to 4 GB memory",
|
"<b>Low:</b> slowest, recommended for GPUs with 3 to 4 GB memory",
|
||||||
icon: "fa-forward",
|
icon: "fa-forward",
|
||||||
default: "balanced",
|
default: "balanced",
|
||||||
|
saveInAppConfig: true,
|
||||||
options: [
|
options: [
|
||||||
{ value: "balanced", label: "Balanced" },
|
{ value: "balanced", label: "Balanced" },
|
||||||
{ value: "high", label: "High" },
|
{ value: "high", label: "High" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user