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