try fix strange apple problem
parent
9b82ff1abf
commit
3978346ea5
|
|
@ -653,10 +653,17 @@ class Script(scripts.Script):
|
||||||
detected_map = HWC3(detected_map)
|
detected_map = HWC3(detected_map)
|
||||||
|
|
||||||
def get_pytorch_control(x):
|
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 = torch.from_numpy(y)
|
||||||
y = y.float() / 255.0
|
y = y.float() / 255.0
|
||||||
y = rearrange(y, 'h w c -> c h w')
|
y = rearrange(y, 'h w c -> c h w')
|
||||||
|
y = y.clone()
|
||||||
y = y.to(devices.get_device_for("controlnet"))
|
y = y.to(devices.get_device_for("controlnet"))
|
||||||
y = y.clone()
|
y = y.clone()
|
||||||
return y
|
return y
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue