Add a --gpu-only argument to keep and run everything on the GPU.

Make the CLIP model work on the GPU.
This commit is contained in:
comfyanonymous
2023-06-15 15:21:37 -04:00
parent 7bf89ba923
commit f7edcfd927
4 changed files with 14 additions and 2 deletions

View File

@@ -151,7 +151,7 @@ if args.lowvram:
lowvram_available = True
elif args.novram:
set_vram_to = VRAMState.NO_VRAM
elif args.highvram:
elif args.highvram or args.gpu_only:
vram_state = VRAMState.HIGH_VRAM
FORCE_FP32 = False
@@ -307,6 +307,12 @@ def unload_if_low_vram(model):
return model.cpu()
return model
def text_encoder_device():
if args.gpu_only:
return get_torch_device()
else:
return torch.device("cpu")
def get_autocast_device(dev):
if hasattr(dev, 'type'):
return dev.type