mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-04-28 21:39:06 +02:00
Tweak Memory Usage setting text; Fix a bug with the memory usage setting comparison
This commit is contained in:
parent
7982a9ae25
commit
25639cc3f8
@ -97,8 +97,8 @@ var PARAMETERS = [
|
|||||||
id: "vram_usage_level",
|
id: "vram_usage_level",
|
||||||
type: ParameterType.select,
|
type: ParameterType.select,
|
||||||
label: "GPU Memory Usage",
|
label: "GPU Memory Usage",
|
||||||
note: "Faster performance requires more GPU memory<br/><br/>" +
|
note: "Faster performance requires more GPU memory (VRAM)<br/><br/>" +
|
||||||
"<b>Balanced:</b> almost as fast as High, significantly lower GPU memory usage<br/>" +
|
"<b>Balanced:</b> nearly as fast as High, much lower VRAM usage<br/>" +
|
||||||
"<b>High:</b> fastest, maximum GPU memory usage</br>" +
|
"<b>High:</b> fastest, maximum GPU memory usage</br>" +
|
||||||
"<b>Low:</b> slowest, force-used for GPUs with 4 GB (or less) memory",
|
"<b>Low:</b> slowest, force-used for GPUs with 4 GB (or less) memory",
|
||||||
icon: "fa-forward",
|
icon: "fa-forward",
|
||||||
|
@ -125,19 +125,13 @@ def resolve_model_paths(task_data: TaskData):
|
|||||||
if task_data.use_upscale: task_data.use_upscale = resolve_model_to_use(task_data.use_upscale, 'gfpgan')
|
if task_data.use_upscale: task_data.use_upscale = resolve_model_to_use(task_data.use_upscale, 'gfpgan')
|
||||||
|
|
||||||
def set_vram_optimizations(context: Context):
|
def set_vram_optimizations(context: Context):
|
||||||
def is_greater(a, b): # is a > b?
|
|
||||||
if a == "low": # b will be "low", "balanced" or "high"
|
|
||||||
return False
|
|
||||||
elif a == "balanced" and b != "low": # b will be "balanced" or "high"
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
config = app.getConfig()
|
config = app.getConfig()
|
||||||
|
|
||||||
max_usage_level = device_manager.get_max_vram_usage_level(context.device)
|
max_usage_level = device_manager.get_max_vram_usage_level(context.device)
|
||||||
vram_usage_level = config.get('vram_usage_level', 'balanced')
|
vram_usage_level = config.get('vram_usage_level', 'balanced')
|
||||||
|
|
||||||
if is_greater(vram_usage_level, max_usage_level):
|
v = {'low': 0, 'balanced': 1, 'high': 2}
|
||||||
|
if v[vram_usage_level] > v[max_usage_level]:
|
||||||
log.error(f'Requested GPU Memory Usage level ({vram_usage_level}) is higher than what is ' + \
|
log.error(f'Requested GPU Memory Usage level ({vram_usage_level}) is higher than what is ' + \
|
||||||
f'possible ({max_usage_level}) on this device ({context.device}). Using "{max_usage_level}" instead')
|
f'possible ({max_usage_level}) on this device ({context.device}). Using "{max_usage_level}" instead')
|
||||||
vram_usage_level = max_usage_level
|
vram_usage_level = max_usage_level
|
||||||
|
Loading…
Reference in New Issue
Block a user