microsoft / DCVC

Deep Contextual Video Compression
MIT License
341 stars 54 forks source link

Nan value encountered while testing DCVC-FM code #45

Closed LHB116 closed 4 months ago

LHB116 commented 4 months ago

Hi, thank you for sharing the repository. When I test the DCVC-FM code with HEVC Class D dataset, pytorch=2.0.0, python=3.10.13, numpy=1.26.4, nan value encountered, how to solve the problem?

Traceback (most recent call last): File "DCVC-FM/src/models/image_model.py", line 166, in encode encoded = self.forward_one_frame(x, q_index) File "DCVC-FM/src/models/image_model.py", line 149, in forward_one_frame bits_y = self.get_y_gaussian_bits(y_for_bit, scales_hat) File "DCVC-FM/src/models/common_model.py", line 74, in get_y_gaussian_bits gaussian = torch.distributions.normal.Normal(mu, sigma) File "/home/anaconda3/envs/dcvc-fm/lib/python3.10/site-packages/torch/distributions/normal.py", line 56, in init super().init(batch_shape, validate_args=validate_args) File "/home/anaconda3/envs/dcvc-fm/lib/python3.10/site-packages/torch/distributions/distribution.py", line 62, in init raise ValueError( ValueError: Expected parameter scale (Tensor of shape (1, 256, 32, 48)) of distribution Normal(loc: torch.Size([1, 256, 32, 48]), scale: torch.Size([1, 256, 32, 48])) to satisfy the constraint GreaterThan(lower_bound=0.0), but found invalid values: tensor([[[[nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], ..., [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan]]]], device='cuda:0')