Skip to content

Commit

Permalink
Fix model loading (#915)
Browse files Browse the repository at this point in the history
* Fix model loading

* remove logging
  • Loading branch information
joeyballentine committed Sep 7, 2022
1 parent fed3a2f commit df1e1a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/src/nodes/utils/pytorch_model_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ def load_state_dict(state_dict) -> PyTorchModel:

if "params_ema" in state_dict_keys:
state_dict = state_dict["params_ema"]
if "params-ema" in state_dict_keys:
elif "params-ema" in state_dict_keys:
state_dict = state_dict["params-ema"]
if "params" in state_dict_keys:
elif "params" in state_dict_keys:
state_dict = state_dict["params"]

state_dict_keys = list(state_dict.keys())

# SRVGGNet Real-ESRGAN (v2)
if "body.0.weight" in state_dict_keys and "body.1.weight" in state_dict_keys:
model = RealESRGANv2(state_dict)
Expand Down

0 comments on commit df1e1a9

Please sign in to comment.