Skip to content

Commit f101a9f

Browse files
committed
fix
1 parent d399d5e commit f101a9f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/source/en/using-diffusers/batched_inference.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ for i, image in enumerate(images):
8989

9090
Enable reproducible batch generation by passing a list of [Generator’s](https://pytorch.org/docs/stable/generated/torch.Generator.html) to the pipeline and tie each `Generator` to a seed to reuse it.
9191

92-
Use a list comprehension to iterate over the batch size specified in `range()` to create a unique `Generator` object for each image in the batch. Don't multiply the `Generator` by the batch size because that only creates one `Generator` object that is used sequentially for each image in the batch.
92+
Use a list comprehension to iterate over the batch size specified in `range()` to create a unique `Generator` object for each image in the batch.
9393

94-
Pass the `geneator` to the pipeline.
94+
Don't multiply the `Generator` by the batch size because that only creates one `Generator` object that is used sequentially for each image in the batch.
95+
96+
```py
97+
generator = [torch.Generator(device="cuda").manual_seed(0)] * 3
98+
```
99+
100+
Pass the `generator` to the pipeline.
95101

96102
```py
97103
import torch

0 commit comments

Comments
 (0)