* fix )

* fix ipadapter
pull/349/head
Chengsong Zhang 2023-11-20 23:27:03 -06:00 committed by GitHub
parent 151139f149
commit 794875cadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -245,8 +245,10 @@ class AnimateDiffControl:
else:
model_net = cn_script.load_control_model(p, unet, unit.model)
model_net.reset()
if model_net is not None and getattr(devices, "fp8", False):
model_net.to(torch.float8_e4m3fn)
if model_net is not None and getattr(devices, "fp8", False) and not isinstance(model_net, PlugableIPAdapter):
for _module in model_net.modules():
if isinstance(_module, (torch.nn.Conv2d, torch.nn.Linear)):
_module.to(torch.float8_e4m3fn)
if getattr(model_net, 'is_control_lora', False):
control_lora = model_net.control_model

View File

@ -49,7 +49,7 @@ class AnimateDiffMM:
self.mm.half()
if getattr(devices, "fp8", False):
for module in self.mm.modules():
if isinstance(module, (torch.nn.Conv2d, torch.nn.Linear))):
if isinstance(module, (torch.nn.Conv2d, torch.nn.Linear)):
module.to(torch.float8_e4m3fn)