from torchmetrics.image import FrechetInceptionDistance as FID
from torchmetrics.image import LearnedPerceptualImagePatchSimilarity as LPIPS
from torchmetrics.image.fid import FrechetInceptionDistance as FID
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity as LPIPS
if self.tedit_type == "TFA":
from .taskeditor import TaskEditorV1c as TaskEditor
if self.tedit_type == "TFA":
from .taskeditor import TaskFeatureAdapter as TaskEditor
# flops, macs, params = calculate_flops(model = self.ae,
# input_shape=input_shape,
# output_as_string=True,
# output_precision=4)
# print("UniRestore.AEs FLOPs:%s MACs:%s Params:%s \n" %(flops, macs, params))
# raise TypeError
# for name, param in self.ae.vae.decoder.named_parameters():
# param.register_hook(lambda grad, name=name: print(f"Gradient computed for: {name}"))
When you run inference like repo says:
python ./src/main.py validate --config ./configs/val.yaml --trainer.logger nullyou will face many errors.
This issue will guide how to solve these.
Reason: possibly related to torchmetrics version mismatch.
Fix: change the lines importing FID and LPIPS in UniRestore/src/core/base/eval_image_restoration.py and UniRestore/src/core/base/eval_multi_task.py
Reason: wrong class name.
Fix: change class name in UniRestore/src/modules/diffuie/autoencoder.py
Reason: calflops.calculate_flops cannot handle stable diffusion VAE forward naively
Fix: just comment out calculate_flops part in UniRestore/src/modules/diffuie/unifie.py
Hope it helps