try fix lora vram (#357)

* try fix lora vram

* try fix lora vram
This commit is contained in:
lllyasviel
2023-09-13 02:29:43 -07:00
committed by GitHub
parent eccf32b78c
commit a9b7219604
4 changed files with 12 additions and 8 deletions
+1 -7
View File
@@ -8,14 +8,13 @@ import comfy.model_management
import comfy.utils
from comfy.sd import load_checkpoint_guess_config
from nodes import VAEDecode, EmptyLatentImage, CLIPTextEncode
from nodes import VAEDecode, EmptyLatentImage
from comfy.sample import prepare_mask, broadcast_cond, load_additional_models, cleanup_additional_models
from modules.samplers_advanced import KSampler, KSamplerWithRefiner
from modules.patch import patch_all
patch_all()
opCLIPTextEncode = CLIPTextEncode()
opEmptyLatentImage = EmptyLatentImage()
opVAEDecode = VAEDecode()
@@ -52,11 +51,6 @@ def load_lora(model, lora_filename, strength_model=1.0, strength_clip=1.0):
return StableDiffusionModel(unet=unet, clip=clip, vae=model.vae, clip_vision=model.clip_vision)
@torch.no_grad()
def encode_prompt_condition(clip, prompt):
return opCLIPTextEncode.encode(clip=clip, text=prompt)[0]
@torch.no_grad()
def generate_empty_latent(width=1024, height=1024, batch_size=1):
return opEmptyLatentImage.generate(width=width, height=height, batch_size=batch_size)[0]