File size: 1,936 Bytes
87d40d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!--Copyright 2024 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# xFormers μ„€μΉ˜ν•˜κΈ°

μΆ”λ‘ κ³Ό ν•™μŠ΅ λͺ¨λ‘μ— [xFormers](https://github.com/facebookresearch/xformers)λ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
자체 ν…ŒμŠ€νŠΈλ‘œ μ–΄ν…μ…˜ λΈ”λ‘μ—μ„œ μˆ˜ν–‰λœ μ΅œμ ν™”κ°€ 더 λΉ λ₯Έ 속도와 적은 λ©”λͺ¨λ¦¬ μ†ŒλΉ„λ₯Ό ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.

2023λ…„ 1월에 μΆœμ‹œλœ xFormers 버전 '0.0.16'λΆ€ν„° 사전 λΉŒλ“œλœ pip wheel을 μ‚¬μš©ν•˜μ—¬ μ‰½κ²Œ μ„€μΉ˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

```bash
pip install xformers
```

<Tip>

xFormers PIP νŒ¨ν‚€μ§€μ—λŠ” μ΅œμ‹  λ²„μ „μ˜ PyTorch(xFormers 0.0.16에 1.13.1)κ°€ ν•„μš”ν•©λ‹ˆλ‹€. 이전 λ²„μ „μ˜ PyTorchλ₯Ό μ‚¬μš©ν•΄μ•Ό ν•˜λŠ” 경우 [ν”„λ‘œμ νŠΈ 지침](https://github.com/facebookresearch/xformers#installing-xformers)의 μ†ŒμŠ€λ₯Ό μ‚¬μš©ν•΄ xFormersλ₯Ό μ„€μΉ˜ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

</Tip>

xFormersλ₯Ό μ„€μΉ˜ν•˜λ©΄, [μ—¬κΈ°](fp16#memory-efficient-attention)μ„œ μ„€λͺ…ν•œ κ²ƒμ²˜λŸΌ 'enable_xformers_memory_efficient_attention()'을 μ‚¬μš©ν•˜μ—¬ μΆ”λ‘  속도λ₯Ό 높이고 λ©”λͺ¨λ¦¬ μ†ŒλΉ„λ₯Ό 쀄일 수 μžˆμŠ΅λ‹ˆλ‹€.

<Tip warning={true}>

[이 이슈](https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212)에 λ”°λ₯΄λ©΄ xFormers `v0.0.16`μ—μ„œ GPUλ₯Ό μ‚¬μš©ν•œ ν•™μŠ΅(파인 νŠœλ‹ λ˜λŠ” Dreambooth)을 ν•  수 μ—†μŠ΅λ‹ˆλ‹€. ν•΄λ‹Ή λ¬Έμ œκ°€ 발견되면. ν•΄λ‹Ή μ½”λ©˜νŠΈλ₯Ό μ°Έκ³ ν•΄ development 버전을 μ„€μΉ˜ν•˜μ„Έμš”.

</Tip>