Files
blepping-comfyui_jankdiffus…/py/utils.py
T
blepping 648a8beccf Add support for internal schedule generation and schedule overrides
Workaround for ComfyUI add_noise bug
Allow disabling upscale model usage even when connected
Add option for performing GC/clearing CUDA cache
Documentation improvements
Internal refactoring/cleanups
2024-10-19 11:14:33 -06:00

21 lines
563 B
Python

from __future__ import annotations
import math
from comfy import model_management
def ensure_model(model):
mp = model.inner_model.model_patcher
if model_management.LoadedModel(mp) in model_management.current_loaded_models:
return
model_management.load_models_gpu((mp,))
def fallback(val, default, *, exclude=None, default_is_fun=False):
return val if val is not exclude else (default() if default_is_fun else default)
def scale_dim(n, factor=1.0, *, increment=64) -> int:
return math.ceil((n * factor) / increment) * increment