From f8740dacf36a2b01b8e5e2cce6340790952db797 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:25:00 +0300
Subject: [PATCH 1/9] Revert "[`Docs`] Update and make improvements (#5819)"
This reverts commit c697f524761abd2314c030221a3ad2f7791eab4e.
---
README.md | 10 ++++++----
docs/source/en/optimization/memory.md | 6 +++---
docs/source/en/tutorials/basic_training.md | 4 ++--
docs/source/en/using-diffusers/write_own_pipeline.md | 4 ++--
docs/source/ko/optimization/fp16.md | 6 +++---
docs/source/ko/tutorials/basic_training.md | 4 ++--
docs/source/ko/using-diffusers/write_own_pipeline.md | 4 ++--
7 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 489e0d154af2..9655220a2491 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ limitations under the License.
## Installation
-We recommend installing ๐ค Diffusers in a virtual environment from PyPI or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/) and [Flax](https://flax.readthedocs.io/en/latest/#installation), please refer to their official documentation.
+We recommend installing ๐ค Diffusers in a virtual environment from PyPi or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/) and [Flax](https://flax.readthedocs.io/en/latest/#installation), please refer to their official documentation.
### PyTorch
@@ -77,7 +77,7 @@ Please refer to the [How to use Stable Diffusion in Apple Silicon](https://huggi
## Quickstart
-Generating outputs is super easy with ๐ค Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers&sort=downloads) for 15000+ checkpoints):
+Generating outputs is super easy with ๐ค Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers&sort=downloads) for 14000+ checkpoints):
```python
from diffusers import DiffusionPipeline
@@ -94,13 +94,14 @@ You can also dig into the models and schedulers toolbox to build your own diffus
from diffusers import DDPMScheduler, UNet2DModel
from PIL import Image
import torch
+import numpy as np
scheduler = DDPMScheduler.from_pretrained("google/ddpm-cat-256")
model = UNet2DModel.from_pretrained("google/ddpm-cat-256").to("cuda")
scheduler.set_timesteps(50)
sample_size = model.config.sample_size
-noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
+noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
input = noise
for t in scheduler.timesteps:
@@ -135,7 +136,8 @@ You can look out for [issues](https://github.com/huggingface/diffusers/issues) y
- See [New model/pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22) to contribute exciting new diffusion models / diffusion pipelines
- See [New scheduler](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22)
-Also, say ๐ in our public Discord channel
. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or just hang out โ.
+Also, say ๐ in our public Discord channel
. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or
+just hang out โ.
## Popular Tasks & Pipelines
diff --git a/docs/source/en/optimization/memory.md b/docs/source/en/optimization/memory.md
index 42a1bcea8fb5..281b65df8d8c 100644
--- a/docs/source/en/optimization/memory.md
+++ b/docs/source/en/optimization/memory.md
@@ -194,9 +194,9 @@ unet_runs_per_experiment = 50
# load inputs
def generate_inputs():
- sample = torch.randn((2, 4, 64, 64), device="cuda", dtype=torch.float16)
- timestep = torch.rand(1, device="cuda", dtype=torch.float16) * 999
- encoder_hidden_states = torch.randn((2, 77, 768), device="cuda", dtype=torch.float16)
+ sample = torch.randn(2, 4, 64, 64).half().cuda()
+ timestep = torch.rand(1).half().cuda() * 999
+ encoder_hidden_states = torch.randn(2, 77, 768).half().cuda()
return sample, timestep, encoder_hidden_states
diff --git a/docs/source/en/tutorials/basic_training.md b/docs/source/en/tutorials/basic_training.md
index c9ce315af41f..3b545cdf572e 100644
--- a/docs/source/en/tutorials/basic_training.md
+++ b/docs/source/en/tutorials/basic_training.md
@@ -321,13 +321,13 @@ Now you can wrap all these components together in a training loop with ๐ค Acce
... for step, batch in enumerate(train_dataloader):
... clean_images = batch["images"]
... # Sample noise to add to the images
-... noise = torch.randn(clean_images.shape, device=clean_images.device)
+... noise = torch.randn(clean_images.shape).to(clean_images.device)
... bs = clean_images.shape[0]
... # Sample a random timestep for each image
... timesteps = torch.randint(
... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device
-... )
+... ).long()
... # Add noise to the clean images according to the noise magnitude at each timestep
... # (this is the forward diffusion process)
diff --git a/docs/source/en/using-diffusers/write_own_pipeline.md b/docs/source/en/using-diffusers/write_own_pipeline.md
index 4ca3fe33223b..d3061e36fe63 100644
--- a/docs/source/en/using-diffusers/write_own_pipeline.md
+++ b/docs/source/en/using-diffusers/write_own_pipeline.md
@@ -71,7 +71,7 @@ tensor([980, 960, 940, 920, 900, 880, 860, 840, 820, 800, 780, 760, 740, 720,
>>> import torch
>>> sample_size = model.config.sample_size
->>> noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
+>>> noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
```
5. Now write a loop to iterate over the timesteps. At each timestep, the model does a [`UNet2DModel.forward`] pass and returns the noisy residual. The scheduler's [`~DDPMScheduler.step`] method takes the noisy residual, timestep, and input and it predicts the image at the previous timestep. This output becomes the next input to the model in the denoising loop, and it'll repeat until it reaches the end of the `timesteps` array.
@@ -216,8 +216,8 @@ Next, generate some initial random noise as a starting point for the diffusion p
>>> latents = torch.randn(
... (batch_size, unet.config.in_channels, height // 8, width // 8),
... generator=generator,
-... device=torch_device,
... )
+>>> latents = latents.to(torch_device)
```
### Denoise the image
diff --git a/docs/source/ko/optimization/fp16.md b/docs/source/ko/optimization/fp16.md
index 0f2c487a75ce..30197305540c 100644
--- a/docs/source/ko/optimization/fp16.md
+++ b/docs/source/ko/optimization/fp16.md
@@ -273,9 +273,9 @@ unet_runs_per_experiment = 50
# ์
๋ ฅ ๋ถ๋ฌ์ค๊ธฐ
def generate_inputs():
- sample = torch.randn((2, 4, 64, 64), device="cuda", dtype=torch.float16)
- timestep = torch.rand(1, device="cuda", dtype=torch.float16) * 999
- encoder_hidden_states = torch.randn((2, 77, 768), device="cuda", dtype=torch.float16)
+ sample = torch.randn(2, 4, 64, 64).half().cuda()
+ timestep = torch.rand(1).half().cuda() * 999
+ encoder_hidden_states = torch.randn(2, 77, 768).half().cuda()
return sample, timestep, encoder_hidden_states
diff --git a/docs/source/ko/tutorials/basic_training.md b/docs/source/ko/tutorials/basic_training.md
index df5e74c22ca8..a4e5e2a0c8bb 100644
--- a/docs/source/ko/tutorials/basic_training.md
+++ b/docs/source/ko/tutorials/basic_training.md
@@ -322,13 +322,13 @@ TensorBoard์ ๋ก๊น
, ๊ทธ๋๋์ธํธ ๋์ ๋ฐ ํผํฉ ์ ๋ฐ๋ ํ์ต์ ์ฝ
... for step, batch in enumerate(train_dataloader):
... clean_images = batch["images"]
... # ์ด๋ฏธ์ง์ ๋ํ ๋
ธ์ด์ฆ๋ฅผ ์ํ๋งํฉ๋๋ค.
-... noise = torch.randn(clean_images.shape, device=clean_images.device)
+... noise = torch.randn(clean_images.shape).to(clean_images.device)
... bs = clean_images.shape[0]
... # ๊ฐ ์ด๋ฏธ์ง๋ฅผ ์ํ ๋๋คํ ํ์์คํ
(timestep)์ ์ํ๋งํฉ๋๋ค.
... timesteps = torch.randint(
... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device
-... )
+... ).long()
... # ๊ฐ ํ์์คํ
์ ๋
ธ์ด์ฆ ํฌ๊ธฐ์ ๋ฐ๋ผ ๊นจ๋ํ ์ด๋ฏธ์ง์ ๋
ธ์ด์ฆ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
... # (์ด๋ foward diffusion ๊ณผ์ ์
๋๋ค.)
diff --git a/docs/source/ko/using-diffusers/write_own_pipeline.md b/docs/source/ko/using-diffusers/write_own_pipeline.md
index 787c8113bf0d..a6469644566c 100644
--- a/docs/source/ko/using-diffusers/write_own_pipeline.md
+++ b/docs/source/ko/using-diffusers/write_own_pipeline.md
@@ -71,7 +71,7 @@ specific language governing permissions and limitations under the License.
>>> import torch
>>> sample_size = model.config.sample_size
- >>> noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
+ >>> noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
```
5. ์ด์ timestep์ ๋ฐ๋ณตํ๋ ๋ฃจํ๋ฅผ ์์ฑํฉ๋๋ค. ๊ฐ timestep์์ ๋ชจ๋ธ์ [`UNet2DModel.forward`]๋ฅผ ํตํด noisy residual์ ๋ฐํํฉ๋๋ค. ์ค์ผ์ค๋ฌ์ [`~DDPMScheduler.step`] ๋ฉ์๋๋ noisy residual, timestep, ๊ทธ๋ฆฌ๊ณ ์
๋ ฅ์ ๋ฐ์ ์ด์ timestep์์ ์ด๋ฏธ์ง๋ฅผ ์์ธกํฉ๋๋ค. ์ด ์ถ๋ ฅ์ ๋
ธ์ด์ฆ ์ ๊ฑฐ ๋ฃจํ์ ๋ชจ๋ธ์ ๋ํ ๋ค์ ์
๋ ฅ์ด ๋๋ฉฐ, `timesteps` ๋ฐฐ์ด์ ๋์ ๋๋ฌํ ๋๊น์ง ๋ฐ๋ณต๋ฉ๋๋ค.
@@ -212,8 +212,8 @@ Stable Diffusion ์ text-to-image *latent diffusion* ๋ชจ๋ธ์
๋๋ค. latent di
>>> latents = torch.randn(
... (batch_size, unet.in_channels, height // 8, width // 8),
... generator=generator,
-... device=torch_device,
... )
+>>> latents = latents.to(torch_device)
```
### ์ด๋ฏธ์ง ๋
ธ์ด์ฆ ์ ๊ฑฐ
From b522cdd1c1e53211559f2dd951c370a96fc71dca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:31:04 +0300
Subject: [PATCH 2/9] Update README.md
---
README.md | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 9655220a2491..489e0d154af2 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ limitations under the License.
## Installation
-We recommend installing ๐ค Diffusers in a virtual environment from PyPi or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/) and [Flax](https://flax.readthedocs.io/en/latest/#installation), please refer to their official documentation.
+We recommend installing ๐ค Diffusers in a virtual environment from PyPI or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/) and [Flax](https://flax.readthedocs.io/en/latest/#installation), please refer to their official documentation.
### PyTorch
@@ -77,7 +77,7 @@ Please refer to the [How to use Stable Diffusion in Apple Silicon](https://huggi
## Quickstart
-Generating outputs is super easy with ๐ค Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers&sort=downloads) for 14000+ checkpoints):
+Generating outputs is super easy with ๐ค Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers&sort=downloads) for 15000+ checkpoints):
```python
from diffusers import DiffusionPipeline
@@ -94,14 +94,13 @@ You can also dig into the models and schedulers toolbox to build your own diffus
from diffusers import DDPMScheduler, UNet2DModel
from PIL import Image
import torch
-import numpy as np
scheduler = DDPMScheduler.from_pretrained("google/ddpm-cat-256")
model = UNet2DModel.from_pretrained("google/ddpm-cat-256").to("cuda")
scheduler.set_timesteps(50)
sample_size = model.config.sample_size
-noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
+noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
input = noise
for t in scheduler.timesteps:
@@ -136,8 +135,7 @@ You can look out for [issues](https://github.com/huggingface/diffusers/issues) y
- See [New model/pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22) to contribute exciting new diffusion models / diffusion pipelines
- See [New scheduler](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22)
-Also, say ๐ in our public Discord channel
. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or
-just hang out โ.
+Also, say ๐ in our public Discord channel
. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or just hang out โ.
## Popular Tasks & Pipelines
From 5c5bf6aba40a3ddbdbe78e5a37d1fe0eb774b421 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:32:06 +0300
Subject: [PATCH 3/9] Update memory.md
---
docs/source/en/optimization/memory.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/source/en/optimization/memory.md b/docs/source/en/optimization/memory.md
index 281b65df8d8c..42a1bcea8fb5 100644
--- a/docs/source/en/optimization/memory.md
+++ b/docs/source/en/optimization/memory.md
@@ -194,9 +194,9 @@ unet_runs_per_experiment = 50
# load inputs
def generate_inputs():
- sample = torch.randn(2, 4, 64, 64).half().cuda()
- timestep = torch.rand(1).half().cuda() * 999
- encoder_hidden_states = torch.randn(2, 77, 768).half().cuda()
+ sample = torch.randn((2, 4, 64, 64), device="cuda", dtype=torch.float16)
+ timestep = torch.rand(1, device="cuda", dtype=torch.float16) * 999
+ encoder_hidden_states = torch.randn((2, 77, 768), device="cuda", dtype=torch.float16)
return sample, timestep, encoder_hidden_states
From 6057f368b233a29a7a34acd6a19a769265da3da5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:34:04 +0300
Subject: [PATCH 4/9] Update basic_training.md
---
docs/source/en/tutorials/basic_training.md | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/docs/source/en/tutorials/basic_training.md b/docs/source/en/tutorials/basic_training.md
index 3b545cdf572e..ba7e0f01bf8d 100644
--- a/docs/source/en/tutorials/basic_training.md
+++ b/docs/source/en/tutorials/basic_training.md
@@ -321,13 +321,14 @@ Now you can wrap all these components together in a training loop with ๐ค Acce
... for step, batch in enumerate(train_dataloader):
... clean_images = batch["images"]
... # Sample noise to add to the images
-... noise = torch.randn(clean_images.shape).to(clean_images.device)
+... noise = torch.randn(clean_images.shape, device=clean_images.device)
... bs = clean_images.shape[0]
... # Sample a random timestep for each image
... timesteps = torch.randint(
-... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device
-... ).long()
+... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device,
+... dtype=torch.int64
+... )
... # Add noise to the clean images according to the noise magnitude at each timestep
... # (this is the forward diffusion process)
From fa2d8a4df5353167fecccb227a8b34862cba6993 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:35:30 +0300
Subject: [PATCH 5/9] Update write_own_pipeline.md
---
docs/source/en/using-diffusers/write_own_pipeline.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/source/en/using-diffusers/write_own_pipeline.md b/docs/source/en/using-diffusers/write_own_pipeline.md
index d3061e36fe63..4ca3fe33223b 100644
--- a/docs/source/en/using-diffusers/write_own_pipeline.md
+++ b/docs/source/en/using-diffusers/write_own_pipeline.md
@@ -71,7 +71,7 @@ tensor([980, 960, 940, 920, 900, 880, 860, 840, 820, 800, 780, 760, 740, 720,
>>> import torch
>>> sample_size = model.config.sample_size
->>> noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
+>>> noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
```
5. Now write a loop to iterate over the timesteps. At each timestep, the model does a [`UNet2DModel.forward`] pass and returns the noisy residual. The scheduler's [`~DDPMScheduler.step`] method takes the noisy residual, timestep, and input and it predicts the image at the previous timestep. This output becomes the next input to the model in the denoising loop, and it'll repeat until it reaches the end of the `timesteps` array.
@@ -216,8 +216,8 @@ Next, generate some initial random noise as a starting point for the diffusion p
>>> latents = torch.randn(
... (batch_size, unet.config.in_channels, height // 8, width // 8),
... generator=generator,
+... device=torch_device,
... )
->>> latents = latents.to(torch_device)
```
### Denoise the image
From 3b2b06ac57b6687019a6cce4cd67ca7a4eceba21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:37:05 +0300
Subject: [PATCH 6/9] Update fp16.md
---
docs/source/ko/optimization/fp16.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/source/ko/optimization/fp16.md b/docs/source/ko/optimization/fp16.md
index 30197305540c..0f2c487a75ce 100644
--- a/docs/source/ko/optimization/fp16.md
+++ b/docs/source/ko/optimization/fp16.md
@@ -273,9 +273,9 @@ unet_runs_per_experiment = 50
# ์
๋ ฅ ๋ถ๋ฌ์ค๊ธฐ
def generate_inputs():
- sample = torch.randn(2, 4, 64, 64).half().cuda()
- timestep = torch.rand(1).half().cuda() * 999
- encoder_hidden_states = torch.randn(2, 77, 768).half().cuda()
+ sample = torch.randn((2, 4, 64, 64), device="cuda", dtype=torch.float16)
+ timestep = torch.rand(1, device="cuda", dtype=torch.float16) * 999
+ encoder_hidden_states = torch.randn((2, 77, 768), device="cuda", dtype=torch.float16)
return sample, timestep, encoder_hidden_states
From 3dac1b5fb1385a6ec06112fef74cc383334ee1dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:38:16 +0300
Subject: [PATCH 7/9] Update basic_training.md
---
docs/source/ko/tutorials/basic_training.md | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/docs/source/ko/tutorials/basic_training.md b/docs/source/ko/tutorials/basic_training.md
index a4e5e2a0c8bb..1cc82d2b8ce6 100644
--- a/docs/source/ko/tutorials/basic_training.md
+++ b/docs/source/ko/tutorials/basic_training.md
@@ -322,13 +322,14 @@ TensorBoard์ ๋ก๊น
, ๊ทธ๋๋์ธํธ ๋์ ๋ฐ ํผํฉ ์ ๋ฐ๋ ํ์ต์ ์ฝ
... for step, batch in enumerate(train_dataloader):
... clean_images = batch["images"]
... # ์ด๋ฏธ์ง์ ๋ํ ๋
ธ์ด์ฆ๋ฅผ ์ํ๋งํฉ๋๋ค.
-... noise = torch.randn(clean_images.shape).to(clean_images.device)
+... noise = torch.randn(clean_images.shape, device=clean_images.device)
... bs = clean_images.shape[0]
... # ๊ฐ ์ด๋ฏธ์ง๋ฅผ ์ํ ๋๋คํ ํ์์คํ
(timestep)์ ์ํ๋งํฉ๋๋ค.
... timesteps = torch.randint(
-... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device
-... ).long()
+... 0, noise_scheduler.config.num_train_timesteps, (bs,), device=clean_images.device,
+... dtype=torch.int64
+... )
... # ๊ฐ ํ์์คํ
์ ๋
ธ์ด์ฆ ํฌ๊ธฐ์ ๋ฐ๋ผ ๊นจ๋ํ ์ด๋ฏธ์ง์ ๋
ธ์ด์ฆ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
... # (์ด๋ foward diffusion ๊ณผ์ ์
๋๋ค.)
From 66fa836f9d0fbfa2c2e147f4e8ba8a6246b02f53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:39:18 +0300
Subject: [PATCH 8/9] Update write_own_pipeline.md
---
docs/source/ko/using-diffusers/write_own_pipeline.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/source/ko/using-diffusers/write_own_pipeline.md b/docs/source/ko/using-diffusers/write_own_pipeline.md
index a6469644566c..4f356e08629a 100644
--- a/docs/source/ko/using-diffusers/write_own_pipeline.md
+++ b/docs/source/ko/using-diffusers/write_own_pipeline.md
@@ -71,7 +71,7 @@ specific language governing permissions and limitations under the License.
>>> import torch
>>> sample_size = model.config.sample_size
- >>> noise = torch.randn((1, 3, sample_size, sample_size)).to("cuda")
+ >>> noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
```
5. ์ด์ timestep์ ๋ฐ๋ณตํ๋ ๋ฃจํ๋ฅผ ์์ฑํฉ๋๋ค. ๊ฐ timestep์์ ๋ชจ๋ธ์ [`UNet2DModel.forward`]๋ฅผ ํตํด noisy residual์ ๋ฐํํฉ๋๋ค. ์ค์ผ์ค๋ฌ์ [`~DDPMScheduler.step`] ๋ฉ์๋๋ noisy residual, timestep, ๊ทธ๋ฆฌ๊ณ ์
๋ ฅ์ ๋ฐ์ ์ด์ timestep์์ ์ด๋ฏธ์ง๋ฅผ ์์ธกํฉ๋๋ค. ์ด ์ถ๋ ฅ์ ๋
ธ์ด์ฆ ์ ๊ฑฐ ๋ฃจํ์ ๋ชจ๋ธ์ ๋ํ ๋ค์ ์
๋ ฅ์ด ๋๋ฉฐ, `timesteps` ๋ฐฐ์ด์ ๋์ ๋๋ฌํ ๋๊น์ง ๋ฐ๋ณต๋ฉ๋๋ค.
@@ -212,6 +212,7 @@ Stable Diffusion ์ text-to-image *latent diffusion* ๋ชจ๋ธ์
๋๋ค. latent di
>>> latents = torch.randn(
... (batch_size, unet.in_channels, height // 8, width // 8),
... generator=generator,
+... device=torch_device,
... )
>>> latents = latents.to(torch_device)
```
From 004b19cfcb2ddafc5111f2933f49210e33189061 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Tolga=20Cang=C3=B6z?=
<46008593+standardAI@users.noreply.github.com>
Date: Sat, 18 Nov 2023 09:41:21 +0300
Subject: [PATCH 9/9] Update write_own_pipeline.md
---
docs/source/ko/using-diffusers/write_own_pipeline.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/docs/source/ko/using-diffusers/write_own_pipeline.md b/docs/source/ko/using-diffusers/write_own_pipeline.md
index 4f356e08629a..787c8113bf0d 100644
--- a/docs/source/ko/using-diffusers/write_own_pipeline.md
+++ b/docs/source/ko/using-diffusers/write_own_pipeline.md
@@ -214,7 +214,6 @@ Stable Diffusion ์ text-to-image *latent diffusion* ๋ชจ๋ธ์
๋๋ค. latent di
... generator=generator,
... device=torch_device,
... )
->>> latents = latents.to(torch_device)
```
### ์ด๋ฏธ์ง ๋
ธ์ด์ฆ ์ ๊ฑฐ