mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-02-08 17:09:59 +00:00
elegant patcher
This commit is contained in:
@@ -62,9 +62,8 @@ class PreprocessorMarigold(Preprocessor):
|
||||
)
|
||||
|
||||
with torch.no_grad():
|
||||
img = numpy_to_pytorch(input_image).movedim(-1, 1).to(
|
||||
device=self.diffusers_patcher.patcher.current_device,
|
||||
dtype=self.diffusers_patcher.dtype)
|
||||
img = numpy_to_pytorch(input_image).movedim(-1, 1)
|
||||
img = self.diffusers_patcher.move_tensor_to_current_device(img)
|
||||
|
||||
img = img * 2.0 - 1.0
|
||||
depth = self.diffusers_patcher.pipeline(img, num_inference_steps=20, show_pbar=False)
|
||||
|
||||
@@ -46,3 +46,6 @@ class DiffusersModelPatcher:
|
||||
models=[self.patcher],
|
||||
memory_required=inference_memory
|
||||
)
|
||||
|
||||
def move_tensor_to_current_device(self, x):
|
||||
return x.to(device=self.patcher.current_device, dtype=self.dtype)
|
||||
|
||||
Reference in New Issue
Block a user