Skip to content

Commit 23108fd

Browse files
committed
Replace FileNotFound with OS exception. Close file after reading.
1 parent 67f02ed commit 23108fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

denoising_diffusion_pytorch/fid_evaluation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def load_or_precalc_dataset_stats(self):
5353
ckpt = np.load(path + ".npz")
5454
self.m2, self.s2 = ckpt["m2"], ckpt["s2"]
5555
self.print_fn("Dataset stats loaded from disk.")
56-
except FileNotFoundError:
56+
ckpt.close()
57+
except OSError:
5758
num_batches = int(math.ceil(self.n_samples / self.batch_size))
5859
stacked_real_features = []
5960
self.print_fn(

0 commit comments

Comments
 (0)