(self, sample, batch_size=8)
| 78 | return hidden_states |
| 79 | |
| 80 | def encode_video(self, sample, batch_size=8): |
| 81 | B = sample.shape[0] |
| 82 | hidden_states = [] |
| 83 | |
| 84 | for i in range(0, sample.shape[2], batch_size): |
| 85 | |
| 86 | j = min(i + batch_size, sample.shape[2]) |
| 87 | sample_batch = rearrange(sample[:,:,i:j], "B C T H W -> (B T) C H W") |
| 88 | |
| 89 | hidden_states_batch = self(sample_batch) |
| 90 | hidden_states_batch = rearrange(hidden_states_batch, "(B T) C H W -> B C T H W", B=B) |
| 91 | |
| 92 | hidden_states.append(hidden_states_batch) |
| 93 | |
| 94 | hidden_states = torch.concat(hidden_states, dim=2) |
| 95 | return hidden_states |
| 96 | |
| 97 | @staticmethod |
| 98 | def state_dict_converter(): |
nothing calls this directly
no outgoing calls
no test coverage detected