Skip to content

Commit 6a05b27

Browse files
authored
Fix Typos (huggingface#7325)
* Fix PyTorch's convention for inplace functions * Fix import structure in __init__.py and update config loading logic in test_config.py * Update configuration access * Fix typos * Trim trailing white spaces * Fix typo in logger name * Revert "Fix PyTorch's convention for inplace functions" This reverts commit f65dc4a. * Fix typo in step_index property description * Revert "Update configuration access" This reverts commit 8d44e87. * Revert "Fix import structure in __init__.py and update config loading logic in test_config.py" This reverts commit 2ad5e8b. * Fix typos * Fix typos * Fix typos * Fix a typo: tranform -> transform
1 parent 98d46a3 commit 6a05b27

47 files changed

Lines changed: 91 additions & 91 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/source/ko/optimization/fp16.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ specific language governing permissions and limitations under the License.
1212

1313
# 메모리와 속도
1414

15-
메모리 또는 속도에 대해 🤗 Diffusers *추론*을 최적화하기 위한 몇 가지 기술과 아이디어를 제시합니다.
15+
메모리 또는 속도에 대해 🤗 Diffusers *추론*을 최적화하기 위한 몇 가지 기술과 아이디어를 제시합니다.
1616
일반적으로, memory-efficient attention을 위해 [xFormers](https://github.com/facebookresearch/xformers) 사용을 추천하기 때문에, 추천하는 [설치 방법](xformers)을 보고 설치해 보세요.
1717

1818
다음 설정이 성능과 메모리에 미치는 영향에 대해 설명합니다.
@@ -27,7 +27,7 @@ specific language governing permissions and limitations under the License.
2727
| memory-efficient attention | 2.63s | x3.61 |
2828

2929
<em>
30-
NVIDIA TITAN RTX에서 50 DDIM 스텝의 "a photo of an astronaut riding a horse on mars" 프롬프트로 512x512 크기의 단일 이미지를 생성하였습니다.
30+
NVIDIA TITAN RTX에서 50 DDIM 스텝의 "a photo of an astronaut riding a horse on mars" 프롬프트로 512x512 크기의 단일 이미지를 생성하였습니다.
3131
</em>
3232

3333
## cuDNN auto-tuner 활성화하기
@@ -44,11 +44,11 @@ torch.backends.cudnn.benchmark = True
4444

4545
### fp32 대신 tf32 사용하기 (Ampere 및 이후 CUDA 장치들에서)
4646

47-
Ampere 및 이후 CUDA 장치에서 행렬곱 및 컨볼루션은 TensorFloat32(TF32) 모드를 사용하여 더 빠르지만 약간 덜 정확할 수 있습니다.
48-
기본적으로 PyTorch는 컨볼루션에 대해 TF32 모드를 활성화하지만 행렬 곱셈은 활성화하지 않습니다.
49-
네트워크에 완전한 float32 정밀도가 필요한 경우가 아니면 행렬 곱셈에 대해서도 이 설정을 활성화하는 것이 좋습니다.
50-
이는 일반적으로 무시할 수 있는 수치의 정확도 손실이 있지만, 계산 속도를 크게 높일 수 있습니다.
51-
그것에 대해 [여기](https://huggingface.co/docs/transformers/v4.18.0/en/performance#tf32)서 더 읽을 수 있습니다.
47+
Ampere 및 이후 CUDA 장치에서 행렬곱 및 컨볼루션은 TensorFloat32(TF32) 모드를 사용하여 더 빠르지만 약간 덜 정확할 수 있습니다.
48+
기본적으로 PyTorch는 컨볼루션에 대해 TF32 모드를 활성화하지만 행렬 곱셈은 활성화하지 않습니다.
49+
네트워크에 완전한 float32 정밀도가 필요한 경우가 아니면 행렬 곱셈에 대해서도 이 설정을 활성화하는 것이 좋습니다.
50+
이는 일반적으로 무시할 수 있는 수치의 정확도 손실이 있지만, 계산 속도를 크게 높일 수 있습니다.
51+
그것에 대해 [여기](https://huggingface.co/docs/transformers/v4.18.0/en/performance#tf32)서 더 읽을 수 있습니다.
5252
추론하기 전에 다음을 추가하기만 하면 됩니다:
5353

5454
```python
@@ -59,13 +59,13 @@ torch.backends.cuda.matmul.allow_tf32 = True
5959

6060
## 반정밀도 가중치
6161

62-
더 많은 GPU 메모리를 절약하고 더 빠른 속도를 얻기 위해 모델 가중치를 반정밀도(half precision)로 직접 불러오고 실행할 수 있습니다.
62+
더 많은 GPU 메모리를 절약하고 더 빠른 속도를 얻기 위해 모델 가중치를 반정밀도(half precision)로 직접 불러오고 실행할 수 있습니다.
6363
여기에는 `fp16`이라는 브랜치에 저장된 float16 버전의 가중치를 불러오고, 그 때 `float16` 유형을 사용하도록 PyTorch에 지시하는 작업이 포함됩니다.
6464

6565
```Python
6666
pipe = StableDiffusionPipeline.from_pretrained(
6767
"runwayml/stable-diffusion-v1-5",
68-
68+
6969
torch_dtype=torch.float16,
7070
)
7171
pipe = pipe.to("cuda")
@@ -75,7 +75,7 @@ image = pipe(prompt).images[0]
7575
```
7676

7777
<Tip warning={true}>
78-
어떤 파이프라인에서도 [`torch.autocast`](https://pytorch.org/docs/stable/amp.html#torch.autocast) 를 사용하는 것은 검은색 이미지를 생성할 수 있고, 순수한 float16 정밀도를 사용하는 것보다 항상 느리기 때문에 사용하지 않는 것이 좋습니다.
78+
어떤 파이프라인에서도 [`torch.autocast`](https://pytorch.org/docs/stable/amp.html#torch.autocast) 를 사용하는 것은 검은색 이미지를 생성할 수 있고, 순수한 float16 정밀도를 사용하는 것보다 항상 느리기 때문에 사용하지 않는 것이 좋습니다.
7979
</Tip>
8080

8181
## 추가 메모리 절약을 위한 슬라이스 어텐션
@@ -95,7 +95,7 @@ from diffusers import StableDiffusionPipeline
9595

9696
pipe = StableDiffusionPipeline.from_pretrained(
9797
"runwayml/stable-diffusion-v1-5",
98-
98+
9999
torch_dtype=torch.float16,
100100
)
101101
pipe = pipe.to("cuda")
@@ -122,7 +122,7 @@ from diffusers import StableDiffusionPipeline
122122

123123
pipe = StableDiffusionPipeline.from_pretrained(
124124
"runwayml/stable-diffusion-v1-5",
125-
125+
126126
torch_dtype=torch.float16,
127127
)
128128
pipe = pipe.to("cuda")
@@ -148,7 +148,7 @@ from diffusers import StableDiffusionPipeline
148148

149149
pipe = StableDiffusionPipeline.from_pretrained(
150150
"runwayml/stable-diffusion-v1-5",
151-
151+
152152
torch_dtype=torch.float16,
153153
)
154154

@@ -165,7 +165,7 @@ image = pipe(prompt).images[0]
165165
또 다른 최적화 방법인 <a href="#model_offloading">모델 오프로딩</a>을 사용하는 것을 고려하십시오. 이는 훨씬 빠르지만 메모리 절약이 크지는 않습니다.
166166
</Tip>
167167

168-
또한 ttention slicing과 연결해서 최소 메모리(< 2GB)로도 동작할 수 있습니다.
168+
또한 ttention slicing과 연결해서 최소 메모리(< 2GB)로도 동작할 수 있습니다.
169169

170170

171171
```Python
@@ -174,7 +174,7 @@ from diffusers import StableDiffusionPipeline
174174

175175
pipe = StableDiffusionPipeline.from_pretrained(
176176
"runwayml/stable-diffusion-v1-5",
177-
177+
178178
torch_dtype=torch.float16,
179179
)
180180

@@ -204,7 +204,7 @@ import torch
204204
from diffusers import StableDiffusionPipeline
205205

206206
pipe = StableDiffusionPipeline.from_pretrained(
207-
"runwayml/stable-diffusion-v1-5",
207+
"runwayml/stable-diffusion-v1-5",
208208
torch_dtype=torch.float16,
209209
)
210210

@@ -387,7 +387,7 @@ with torch.inference_mode():
387387
| A100-SXM4-40GB | 18.6it/s | 29.it/s |
388388
| A100-SXM-80GB | 18.7it/s | 29.5it/s |
389389

390-
이를 활용하려면 다음을 만족해야 합니다:
390+
이를 활용하려면 다음을 만족해야 합니다:
391391
- PyTorch > 1.12
392392
- Cuda 사용 가능
393393
- [xformers 라이브러리를 설치함](xformers)

docs/source/ko/using-diffusers/write_own_pipeline.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ specific language governing permissions and limitations under the License.
1414

1515
[[open-in-colab]]
1616

17-
🧨 Diffusers는 사용자 친화적이며 유연한 도구 상자로, 사용사례에 맞게 diffusion 시스템을 구축 할 수 있도록 설계되었습니다. 이 도구 상자의 핵심은 모델과 스케줄러입니다. [`DiffusionPipeline`]은 편의를 위해 이러한 구성 요소를 번들로 제공하지만, 파이프라인을 분리하고 모델과 스케줄러를 개별적으로 사용해 새로운 diffusion 시스템을 만들 수도 있습니다.
17+
🧨 Diffusers는 사용자 친화적이며 유연한 도구 상자로, 사용사례에 맞게 diffusion 시스템을 구축 할 수 있도록 설계되었습니다. 이 도구 상자의 핵심은 모델과 스케줄러입니다. [`DiffusionPipeline`]은 편의를 위해 이러한 구성 요소를 번들로 제공하지만, 파이프라인을 분리하고 모델과 스케줄러를 개별적으로 사용해 새로운 diffusion 시스템을 만들 수도 있습니다.
1818

1919
이 튜토리얼에서는 기본 파이프라인부터 시작해 Stable Diffusion 파이프라인까지 진행하며 모델과 스케줄러를 사용해 추론을 위한 diffusion 시스템을 조립하는 방법을 배웁니다.
2020

@@ -36,7 +36,7 @@ specific language governing permissions and limitations under the License.
3636

3737
정말 쉽습니다. 그런데 파이프라인은 어떻게 이렇게 할 수 있었을까요? 파이프라인을 세분화하여 내부에서 어떤 일이 일어나고 있는지 살펴보겠습니다.
3838

39-
위 예시에서 파이프라인에는 [`UNet2DModel`] 모델과 [`DDPMScheduler`]가 포함되어 있습니다. 파이프라인은 원하는 출력 크기의 랜덤 노이즈를 받아 모델을 여러번 통과시켜 이미지의 노이즈를 제거합니다. 각 timestep에서 모델은 *noise residual*을 예측하고 스케줄러는 이를 사용하여 노이즈가 적은 이미지를 예측합니다. 파이프라인은 지정된 추론 스텝수에 도달할 때까지 이 과정을 반복합니다.
39+
위 예시에서 파이프라인에는 [`UNet2DModel`] 모델과 [`DDPMScheduler`]가 포함되어 있습니다. 파이프라인은 원하는 출력 크기의 랜덤 노이즈를 받아 모델을 여러번 통과시켜 이미지의 노이즈를 제거합니다. 각 timestep에서 모델은 *noise residual*을 예측하고 스케줄러는 이를 사용하여 노이즈가 적은 이미지를 예측합니다. 파이프라인은 지정된 추론 스텝수에 도달할 때까지 이 과정을 반복합니다.
4040

4141
모델과 스케줄러를 별도로 사용하여 파이프라인을 다시 생성하기 위해 자체적인 노이즈 제거 프로세스를 작성해 보겠습니다.
4242

examples/community/latent_consistency_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def alpha_bar_fn(t):
440440
return math.exp(t * -12.0)
441441

442442
else:
443-
raise ValueError(f"Unsupported alpha_tranform_type: {alpha_transform_type}")
443+
raise ValueError(f"Unsupported alpha_transform_type: {alpha_transform_type}")
444444

445445
betas = []
446446
for i in range(num_diffusion_timesteps):

examples/community/latent_consistency_txt2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def alpha_bar_fn(t):
348348
return math.exp(t * -12.0)
349349

350350
else:
351-
raise ValueError(f"Unsupported alpha_tranform_type: {alpha_transform_type}")
351+
raise ValueError(f"Unsupported alpha_transform_type: {alpha_transform_type}")
352352

353353
betas = []
354354
for i in range(num_diffusion_timesteps):

examples/community/pipeline_stable_diffusion_xl_controlnet_adapter_inpaint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def prepare_mask_and_masked_image(image, mask, height, width, return_image: bool
206206
dimensions: ``batch x channels x height x width``.
207207
"""
208208

209-
# checkpoint. TOD(Yiyi) - need to clean this up later
209+
# checkpoint. #TODO(Yiyi) - need to clean this up later
210210
if image is None:
211211
raise ValueError("`image` input cannot be undefined.")
212212

@@ -277,7 +277,7 @@ def prepare_mask_and_masked_image(image, mask, height, width, return_image: bool
277277
# images are in latent space and thus can't
278278
# be masked set masked_image to None
279279
# we assume that the checkpoint is not an inpainting
280-
# checkpoint. TOD(Yiyi) - need to clean this up later
280+
# checkpoint. #TODO(Yiyi) - need to clean this up later
281281
masked_image = None
282282
else:
283283
masked_image = image * (mask < 0.5)

examples/community/scheduling_ufogen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def alpha_bar_fn(t):
8181
return math.exp(t * -12.0)
8282

8383
else:
84-
raise ValueError(f"Unsupported alpha_tranform_type: {alpha_transform_type}")
84+
raise ValueError(f"Unsupported alpha_transform_type: {alpha_transform_type}")
8585

8686
betas = []
8787
for i in range(num_diffusion_timesteps):

src/diffusers/models/attention_processor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def get_processor(self, return_deprecated_lora: bool = False) -> "AttentionProce
424424
# If doesn't apply LoRA do `add_k_proj` or `add_v_proj`
425425
is_lora_activated.pop("add_k_proj", None)
426426
is_lora_activated.pop("add_v_proj", None)
427-
# 2. else it is not posssible that only some layers have LoRA activated
427+
# 2. else it is not possible that only some layers have LoRA activated
428428
if not all(is_lora_activated.values()):
429429
raise ValueError(
430430
f"Make sure that either all layers or no layers have LoRA activated, but have {is_lora_activated}"
@@ -2098,7 +2098,7 @@ def __call__(self, attn: Attention, hidden_states: torch.FloatTensor, **kwargs)
20982098

20992099
class IPAdapterAttnProcessor(nn.Module):
21002100
r"""
2101-
Attention processor for Multiple IP-Adapater.
2101+
Attention processor for Multiple IP-Adapters.
21022102
21032103
Args:
21042104
hidden_size (`int`):
@@ -2152,8 +2152,8 @@ def __call__(
21522152
encoder_hidden_states, ip_hidden_states = encoder_hidden_states
21532153
else:
21542154
deprecation_message = (
2155-
"You have passed a tensor as `encoder_hidden_states`.This is deprecated and will be removed in a future release."
2156-
" Please make sure to update your script to pass `encoder_hidden_states` as a tuple to supress this warning."
2155+
"You have passed a tensor as `encoder_hidden_states`. This is deprecated and will be removed in a future release."
2156+
" Please make sure to update your script to pass `encoder_hidden_states` as a tuple to suppress this warning."
21572157
)
21582158
deprecate("encoder_hidden_states not a tuple", "1.0.0", deprecation_message, standard_warn=False)
21592159
end_pos = encoder_hidden_states.shape[1] - self.num_tokens[0]
@@ -2253,7 +2253,7 @@ def __call__(
22532253

22542254
class IPAdapterAttnProcessor2_0(torch.nn.Module):
22552255
r"""
2256-
Attention processor for IP-Adapater for PyTorch 2.0.
2256+
Attention processor for IP-Adapter for PyTorch 2.0.
22572257
22582258
Args:
22592259
hidden_size (`int`):
@@ -2312,8 +2312,8 @@ def __call__(
23122312
encoder_hidden_states, ip_hidden_states = encoder_hidden_states
23132313
else:
23142314
deprecation_message = (
2315-
"You have passed a tensor as `encoder_hidden_states`.This is deprecated and will be removed in a future release."
2316-
" Please make sure to update your script to pass `encoder_hidden_states` as a tuple to supress this warning."
2315+
"You have passed a tensor as `encoder_hidden_states`. This is deprecated and will be removed in a future release."
2316+
" Please make sure to update your script to pass `encoder_hidden_states` as a tuple to suppress this warning."
23172317
)
23182318
deprecate("encoder_hidden_states not a tuple", "1.0.0", deprecation_message, standard_warn=False)
23192319
end_pos = encoder_hidden_states.shape[1] - self.num_tokens[0]

src/diffusers/models/controlnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def __init__(
281281
elif encoder_hid_dim_type == "text_image_proj":
282282
# image_embed_dim DOESN'T have to be `cross_attention_dim`. To not clutter the __init__ too much
283283
# they are set to `cross_attention_dim` here as this is exactly the required dimension for the currently only use
284-
# case when `addition_embed_type == "text_image_proj"` (Kadinsky 2.1)`
284+
# case when `addition_embed_type == "text_image_proj"` (Kandinsky 2.1)`
285285
self.encoder_hid_proj = TextImageProjection(
286286
text_embed_dim=encoder_hid_dim,
287287
image_embed_dim=cross_attention_dim,
@@ -330,7 +330,7 @@ def __init__(
330330
elif addition_embed_type == "text_image":
331331
# text_embed_dim and image_embed_dim DON'T have to be `cross_attention_dim`. To not clutter the __init__ too much
332332
# they are set to `cross_attention_dim` here as this is exactly the required dimension for the currently only use
333-
# case when `addition_embed_type == "text_image"` (Kadinsky 2.1)`
333+
# case when `addition_embed_type == "text_image"` (Kandinsky 2.1)`
334334
self.add_embedding = TextImageTimeEmbedding(
335335
text_embed_dim=cross_attention_dim, image_embed_dim=cross_attention_dim, time_embed_dim=time_embed_dim
336336
)

src/diffusers/models/transformer_temporal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121

2222
class TransformerTemporalModelOutput(TransformerTemporalModelOutput):
23-
deprecation_message = "Importing `TransformerTemporalModelOutput` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.tranformer_temporal import TransformerTemporalModelOutput`, instead."
23+
deprecation_message = "Importing `TransformerTemporalModelOutput` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.transformer_temporal import TransformerTemporalModelOutput`, instead."
2424
deprecate("TransformerTemporalModelOutput", "0.29", deprecation_message)
2525

2626

2727
class TransformerTemporalModel(TransformerTemporalModel):
28-
deprecation_message = "Importing `TransformerTemporalModel` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.tranformer_temporal import TransformerTemporalModel`, instead."
28+
deprecation_message = "Importing `TransformerTemporalModel` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.transformer_temporal import TransformerTemporalModel`, instead."
2929
deprecate("TransformerTemporalModel", "0.29", deprecation_message)
3030

3131

3232
class TransformerSpatioTemporalModel(TransformerSpatioTemporalModel):
33-
deprecation_message = "Importing `TransformerSpatioTemporalModel` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.tranformer_temporal import TransformerSpatioTemporalModel`, instead."
33+
deprecation_message = "Importing `TransformerSpatioTemporalModel` from `diffusers.models.transformer_temporal` is deprecated and this will be removed in a future version. Please use `from diffusers.models.transformers.transformer_temporal import TransformerSpatioTemporalModel`, instead."
3434
deprecate("TransformerTemporalModelOutput", "0.29", deprecation_message)

src/diffusers/models/transformers/transformer_2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(
129129
if norm_type == "layer_norm" and num_embeds_ada_norm is not None:
130130
deprecation_message = (
131131
f"The configuration file of this model: {self.__class__} is outdated. `norm_type` is either not set or"
132-
" incorrectly set to `'layer_norm'`.Make sure to set `norm_type` to `'ada_norm'` in the config."
132+
" incorrectly set to `'layer_norm'`. Make sure to set `norm_type` to `'ada_norm'` in the config."
133133
" Please make sure to update the config accordingly as leaving `norm_type` might led to incorrect"
134134
" results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it"
135135
" would be very nice if you could open a Pull request for the `transformer/config.json` file"

0 commit comments

Comments
 (0)