(self, sample)
| 252 | |
| 253 | |
| 254 | def decode_small_video(self, sample): |
| 255 | B, C, T, H, W = sample.shape |
| 256 | computation_device = self.conv_in.weight.device |
| 257 | computation_dtype = self.conv_in.weight.dtype |
| 258 | value = [] |
| 259 | for i in range(T//2): |
| 260 | tl = i*2 + T%2 - (T%2 and i==0) |
| 261 | tr = i*2 + 2 + T%2 |
| 262 | model_input = sample[:, :, tl: tr, :, :].to(dtype=computation_dtype, device=computation_device) |
| 263 | model_output = self.forward(model_input).to(dtype=sample.dtype, device=sample.device) |
| 264 | value.append(model_output) |
| 265 | value = torch.concat(value, dim=2) |
| 266 | for name, module in self.named_modules(): |
| 267 | if isinstance(module, CachedConv3d): |
| 268 | module.clear_cache() |
| 269 | return value |
| 270 | |
| 271 | |
| 272 | @staticmethod |
no test coverage detected