Fixed some missing operations to process batches
Browse files
app.py
CHANGED
@@ -54,14 +54,17 @@ def text_to_image(image, prompt, duplications: float):
|
|
54 |
batch['pixel_values'].pop()
|
55 |
|
56 |
# transform lists to tensors
|
57 |
-
batch['input_ids'] = torch.
|
58 |
-
batch['attention_mask'] = torch.
|
59 |
-
batch['pixel_values'] = torch.
|
60 |
|
61 |
# Add to the batched_inputs
|
62 |
batched_inputs.append(batch)
|
|
|
63 |
else:
|
64 |
i += 1
|
|
|
|
|
65 |
|
66 |
maurice_description = list()
|
67 |
maurice_embeddings = list()
|
|
|
54 |
batch['pixel_values'].pop()
|
55 |
|
56 |
# transform lists to tensors
|
57 |
+
batch['input_ids'] = torch.stack(batch['input_ids'], dim=0)
|
58 |
+
batch['attention_mask'] = torch.stack(batch['attention_mask'], dim=0)
|
59 |
+
batch['pixel_values'] = torch.stack(batch['pixel_values'], dim=0)
|
60 |
|
61 |
# Add to the batched_inputs
|
62 |
batched_inputs.append(batch)
|
63 |
+
batch = dict(input_ids=list(), attention_mask=list(), pixel_values=list())
|
64 |
else:
|
65 |
i += 1
|
66 |
+
else:
|
67 |
+
batched_inputs.append(inputs)
|
68 |
|
69 |
maurice_description = list()
|
70 |
maurice_embeddings = list()
|