Fixed some missing operations to process batches
Browse files53 unmodified lines545556575859606162636465666753 unmodified linesbatch['pixel_values'].pop()# transform lists to tensorsbatch['input_ids'] = torch.cat(batch['input_ids'], dim=0)batch['attention_mask'] = torch.cat(batch['input_ids'], dim=0)batch['pixel_values'] = torch.cat(batch['input_ids'], dim=0)# Add to the batched_inputsbatched_inputs.append(batch)else:i += 1maurice_description = list()maurice_embeddings = list()53 unmodified lines545556575859606162636465666768697053 unmodified linesbatch['pixel_values'].pop()# transform lists to tensorsbatch['input_ids'] = torch.stack(batch['input_ids'], dim=0)batch['attention_mask'] = torch.stack(batch['attention_mask'], dim=0)batch['pixel_values'] = torch.stack(batch['pixel_values'], dim=0)# Add to the batched_inputsbatched_inputs.append(batch)batch = dict(input_ids=list(), attention_mask=list(), pixel_values=list())else:i += 1else:batched_inputs.append(inputs)maurice_description = list()maurice_embeddings = list()
app.py+6-3