try fix strange apple problem

pull/945/head
lvmin 2023-04-21 00:27:30 -07:00
parent 9b82ff1abf
commit 3978346ea5
1 changed files with 8 additions and 1 deletions

View File

@ -653,10 +653,17 @@ class Script(scripts.Script):
detected_map = HWC3(detected_map)
def get_pytorch_control(x):
y = x.copy()
# A very safe method to make sure that Apple/Mac works
y = x
# below is very boring but do not change these. If you change these Apple or Mac may fail.
y = y.copy()
y = y.ascontiguousarray()
y = y.copy()
y = torch.from_numpy(y)
y = y.float() / 255.0
y = rearrange(y, 'h w c -> c h w')
y = y.clone()
y = y.to(devices.get_device_for("controlnet"))
y = y.clone()
return y