Fantasy-Studio / Paint-by-Example

Paint by Example: Exemplar-based Image Editing with Diffusion Models
https://arxiv.org/abs/2211.13227
Other
1.08k stars 96 forks source link

Issue when running sh test.sh #38

Open lilyuam opened 1 year ago

lilyuam commented 1 year ago

This is my code segment in inference.py: model = torch.load("checkpoints/model.ckpt")

device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") model = model.to(device)

When I run sh test.sh I get this error: Global seed set to 321 Traceback (most recent call last): File "scripts/inference.py", line 410, in main() File "scripts/inference.py", line 279, in main model = model.to(device) AttributeError: 'dict' object has no attribute 'to' Global seed set to 5876 Traceback (most recent call last): File "scripts/inference.py", line 410, in main() File "scripts/inference.py", line 279, in main model = model.to(device) AttributeError: 'dict' object has no attribute 'to' Global seed set to 5065 Traceback (most recent call last): File "scripts/inference.py", line 410, in main() File "scripts/inference.py", line 279, in main model = model.to(device) AttributeError: 'dict' object has no attribute 'to'

fujistoo commented 1 year ago

You'd need model.load_state_dict() after loading the state dict.

state_dict = torch.load("checkpoints/model.ckpt")
model.load_state_dict(state_dict)