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

@@ -467,7 +467,11 @@ class CLIP:
clip = sd1_clip.SD1ClipModel
tokenizer = sd1_clip.SD1Tokenizer
self.device = model_management.text_encoder_device()
params["device"] = self.device
self.cond_stage_model = clip(**(params))
self.cond_stage_model = self.cond_stage_model.to(self.device)
self.tokenizer = tokenizer(embedding_directory=embedding_directory)
self.patcher = ModelPatcher(self.cond_stage_model)
self.layer_idx = None