Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set w/o restoration module #104

Open
lijain opened this issue Mar 13, 2024 · 1 comment
Open

set w/o restoration module #104

lijain opened this issue Mar 13, 2024 · 1 comment

Comments

@lijain
Copy link

lijain commented Mar 13, 2024

DIffbir How to set up w/o restoration module training

@0x3f3f3f3fun
Copy link
Collaborator

In our latest code, to train w/o restoration module, you just need to remove a few lines of code (as shown below):

DiffBIR/train_stage2.py

Lines 80 to 89 in e7974cb

swinir: SwinIR = instantiate_from_config(cfg.model.swinir)
sd = {
(k[len("module."):] if k.startswith("module.") else k): v
for k, v in torch.load(cfg.train.swinir_path, map_location="cpu").items()
}
swinir.load_state_dict(sd, strict=True)
for p in swinir.parameters():
p.requires_grad = False
if accelerator.is_local_main_process:
print(f"load SwinIR from {cfg.train.swinir_path}")

swinir.eval().to(device)

clean = swinir(lq)

and directly use lq as condition:

cond = pure_cldm.prepare_condition(clean, prompt) => cond = pure_cldm.prepare_condition(lq, prompt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants