File size: 2,660 Bytes
17c6d62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!--Copyright 2022 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.

⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.

-->

# 생성 [[generation]]

각 ν”„λ ˆμž„μ›Œν¬μ—λŠ” ν•΄λ‹Ήν•˜λŠ” `GenerationMixin` ν΄λž˜μŠ€μ—μ„œ κ΅¬ν˜„λœ ν…μŠ€νŠΈ 생성을 μœ„ν•œ generate λ©”μ†Œλ“œκ°€ μžˆμŠ΅λ‹ˆλ‹€:

- PyTorchμ—μ„œλŠ” [`~generation.GenerationMixin.generate`]κ°€ [`~generation.GenerationMixin`]에 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
- TensorFlowμ—μ„œλŠ” [`~generation.TFGenerationMixin.generate`]κ°€ [`~generation.TFGenerationMixin`]에 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
- Flax/JAXμ—μ„œλŠ” [`~generation.FlaxGenerationMixin.generate`]κ°€ [`~generation.FlaxGenerationMixin`]에 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

μ‚¬μš©ν•˜λŠ” ν”„λ ˆμž„μ›Œν¬μ— 상관없이, generate λ©”μ†Œλ“œλŠ” [`~generation.GenerationConfig`] 클래슀 μΈμŠ€ν„΄μŠ€λ‘œ λ§€κ°œλ³€μˆ˜ν™” ν•  수 μžˆμŠ΅λ‹ˆλ‹€. generate λ©”μ†Œλ“œμ˜ λ™μž‘μ„ μ œμ–΄ν•˜λŠ” λͺ¨λ“  생성 λ§€κ°œλ³€μˆ˜ λͺ©λ‘μ„ ν™•μΈν•˜λ €λ©΄ 이 클래슀λ₯Ό μ°Έμ‘°ν•˜μ„Έμš”. 

λͺ¨λΈμ˜ 생성 섀정을 μ–΄λ–»κ²Œ ν™•μΈν•˜κ³ , 기본값이 무엇인지, λ§€κ°œλ³€μˆ˜λ₯Ό μ–΄λ–»κ²Œ μž„μ‹œλ‘œ λ³€κ²½ν•˜λŠ”μ§€, 그리고 μ‚¬μš©μž μ§€μ • 생성 섀정을 λ§Œλ“€κ³  μ €μž₯ν•˜λŠ” 방법을 배우렀면 [ν…μŠ€νŠΈ 생성 μ „λž΅ κ°€μ΄λ“œ](../generation_strategies)λ₯Ό μ°Έμ‘°ν•˜μ„Έμš”. 이 κ°€μ΄λ“œλŠ” 토큰 슀트리밍과 같은 κ΄€λ ¨ κΈ°λŠ₯을 μ‚¬μš©ν•˜λŠ” 방법도 μ„€λͺ…ν•©λ‹ˆλ‹€.

## GenerationConfig [[transformers.GenerationConfig]]

[[autodoc]] generation.GenerationConfig
	- from_pretrained
	- from_model_config
	- save_pretrained
	- update
	- validate
	- get_generation_mode

[[autodoc]] generation.WatermarkingConfig

## GenerationMixin [[transformers.GenerationMixin]]

[[autodoc]] generation.GenerationMixin
	- generate
	- compute_transition_scores

## TFGenerationMixin [[transformers.TFGenerationMixin]]

[[autodoc]] generation.TFGenerationMixin
	- generate
	- compute_transition_scores

## FlaxGenerationMixin [[transformers.FlaxGenerationMixin]]

[[autodoc]] generation.FlaxGenerationMixin
	- generate