Skip to content

Commit

Permalink
[Fix] Fix PPL bug (#1172)
Browse files Browse the repository at this point in the history
fix ppl bug
  • Loading branch information
plyfager authored Oct 9, 2022
1 parent 944d3a8 commit 5a080ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mmedit/evaluation/metrics/ppl.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def __next__(self):
if self.idx >= len(self.batch_sizes):
raise StopIteration
batch = self.batch_sizes[self.idx]
injected_noise = self.generator.make_injected_noise()
inputs = torch.randn([batch * 2, self.latent_dim],
device=self.device)
if self.sampling == 'full':
Expand Down Expand Up @@ -270,6 +271,7 @@ def __next__(self):
inputs=dict(
noise=latent_e,
sample_kwargs=dict(
injected_noise=injected_noise,
input_is_latent=(self.space == 'W'))))

ppl_sampler = PPLSampler(
Expand Down
4 changes: 2 additions & 2 deletions mmedit/utils/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

import click
import mmcv
import mmengine
import requests
import torch.distributed as dist
from mmengine.dist import get_dist_info
Expand Down Expand Up @@ -67,7 +67,7 @@ def download_from_url(url,
if rank == 0:
# mkdir
_dir = os.path.dirname(dest_path)
mmcv.mkdir_or_exist(_dir)
mmengine.mkdir_or_exist(_dir)

if hash_prefix is not None:
sha256 = hashlib.sha256()
Expand Down

0 comments on commit 5a080ff

Please sign in to comment.