Skip to content

Commit

Permalink
[brief] Few fixes.
Browse files Browse the repository at this point in the history
[detailed]
- When looking up a key in the registry, if the key is not found it
  should raise an exception even if the suffix is none.
- Fixes a typo in EMA.
  • Loading branch information
marovira committed Apr 10, 2024
1 parent 9cfd242 commit 847b4b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/pyro/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ def get(self, name: str, suffix: str | None = None) -> typing.Any:
raise KeyError(
f"No object called '{name}' found in the '{self._name}' registrar"
)
elif ret is None:
raise KeyError(
f"No object called '{name}' found in the '{self._name}' registrar"
)
return ret

def __contains__(self, name: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion src/pyro/model/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _update(self, net: nn.Module, update_fn: typing.Callable) -> None:
net.state_dict().values(),
strict=True,
):
if self.device:
if self._device:
net_v = net_v.to(device=self.device)
ema_v.copy_(update_fn(ema_v, net_v))

Expand Down

0 comments on commit 847b4b8

Please sign in to comment.