File size: 11,527 Bytes
ee6e328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!--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.

-->

# ๋ชจ๋ธ ๊ณต์œ ํ•˜๊ธฐ[[share-a-model]]

์ง€๋‚œ ๋‘ ํŠœํ† ๋ฆฌ์–ผ์—์„œ ๋ถ„์‚ฐ ์„ค์ •์„ ์œ„ํ•ด PyTorch, Keras ๋ฐ ๐Ÿค— Accelerate๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์•˜์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ๋‹จ๊ณ„๋Š” ๋ชจ๋ธ์„ ์ปค๋ฎค๋‹ˆํ‹ฐ์™€ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค! Hugging Face๋Š” ์ธ๊ณต์ง€๋Šฅ์˜ ๋ฏผ์ฃผํ™”๋ฅผ ์œ„ํ•ด ๋ชจ๋‘์—๊ฒŒ ์ง€์‹๊ณผ ์ž์›์„ ๊ณต๊ฐœ์ ์œผ๋กœ ๊ณต์œ ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ๋ฏฟ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์ด ์‹œ๊ฐ„๊ณผ ์ž์›์„ ์ ˆ์•ฝํ•  ์ˆ˜ ์žˆ๋„๋ก ์ปค๋ฎค๋‹ˆํ‹ฐ์— ๋ชจ๋ธ์„ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”.

์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ [Model Hub](https://huggingface.co/models)์—์„œ ํ›ˆ๋ จ๋˜๊ฑฐ๋‚˜ ๋ฏธ์„ธ ์กฐ์ • ๋ชจ๋ธ์„ ๊ณต์œ ํ•˜๋Š” ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ด…์‹œ๋‹ค:

- API๋ฅผ ํ†ตํ•ด ํŒŒ์ผ์„ Hub์— ํ‘ธ์‹œํ•ฉ๋‹ˆ๋‹ค.
- ์›น์‚ฌ์ดํŠธ๋ฅผ ํ†ตํ•ด ํŒŒ์ผ์„ Hub๋กœ ๋Œ์–ด๋‹ค ๋†“์Šต๋‹ˆ๋‹ค.

<iframe width="560" height="315" src="https://www.youtube.com/embed/XvSGPZFEjDY" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
picture-in-picture" allowfullscreen></iframe>

<Tip>

์ปค๋ฎค๋‹ˆํ‹ฐ์— ๋ชจ๋ธ์„ ๊ณต์œ ํ•˜๋ ค๋ฉด, [huggingface.co](https://huggingface.co/join)์— ๊ณ„์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด ์กฐ์ง์— ๊ฐ€์ž…ํ•˜๊ฑฐ๋‚˜ ์ƒˆ๋กœ ๋งŒ๋“ค ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

</Tip>

## ์ €์žฅ์†Œ ํŠน์ง•[[repository-features]]

๋ชจ๋ธ ํ—ˆ๋ธŒ์˜ ๊ฐ ์ €์žฅ์†Œ๋Š” ์ผ๋ฐ˜์ ์ธ GitHub ์ €์žฅ์†Œ์ฒ˜๋Ÿผ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. ์ €์žฅ์†Œ๋Š” ๋ฒ„์ „ ๊ด€๋ฆฌ, ์ปค๋ฐ‹ ๊ธฐ๋ก, ์ฐจ์ด์  ์‹œ๊ฐํ™” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๋ชจ๋ธ ํ—ˆ๋ธŒ์— ๋‚ด์žฅ๋œ ๋ฒ„์ „ ๊ด€๋ฆฌ๋Š” git ๋ฐ [git-lfs](https://git-lfs.github.com/)๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, ํ•˜๋‚˜์˜ ๋ชจ๋ธ์„ ํ•˜๋‚˜์˜ ์ €์žฅ์†Œ๋กœ ์ทจ๊ธ‰ํ•˜์—ฌ ์ ‘๊ทผ ์ œ์–ด ๋ฐ ํ™•์žฅ์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค. ๋ฒ„์ „ ์ œ์–ด๋Š” ์ปค๋ฐ‹ ํ•ด์‹œ, ํƒœ๊ทธ ๋˜๋Š” ๋ธŒ๋žœ์น˜๋กœ ๋ชจ๋ธ์˜ ํŠน์ • ๋ฒ„์ „์„ ๊ณ ์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์ธ *revision*์„ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ `revision` ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠน์ • ๋ชจ๋ธ ๋ฒ„์ „์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> model = AutoModel.from_pretrained(
...     "julien-c/EsperBERTo-small", revision="v2.0.1"  # tag name, or branch name, or commit hash
... )
```

๋˜ํ•œ ์ €์žฅ์†Œ์—์„œ ํŒŒ์ผ์„ ์‰ฝ๊ฒŒ ํŽธ์ง‘ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ปค๋ฐ‹ ๊ธฐ๋ก๊ณผ ์ฐจ์ด๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

![vis_diff](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/vis_diff.png)

## ์„ค์ •[[setup]]

๋ชจ๋ธ์„ ํ—ˆ๋ธŒ์— ๊ณต์œ ํ•˜๊ธฐ ์ „์— Hugging Face ์ž๊ฒฉ ์ฆ๋ช…์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ํ„ฐ๋ฏธ๋„์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ, ๐Ÿค— Transformers๊ฐ€ ์„ค์น˜๋œ ๊ฐ€์ƒ ํ™˜๊ฒฝ์—์„œ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด Hugging Face ์บ์‹œ ํด๋”(๊ธฐ๋ณธ์ ์œผ๋กœ `~/.cache/`)์— ์•ก์„ธ์Šค ํ† ํฐ์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค:

```bash
huggingface-cli login
```

Jupyter ๋˜๋Š” Colaboratory์™€ ๊ฐ™์€ ๋…ธํŠธ๋ถ์„ ์‚ฌ์šฉ ์ค‘์ธ ๊ฒฝ์šฐ, [`huggingface_hub`](https://huggingface.co/docs/hub/adding-a-library) ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์„ค์น˜๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”. ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด API๋กœ ํ—ˆ๋ธŒ์™€ ์ƒํ˜ธ ์ž‘์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

```bash
pip install huggingface_hub
```

๊ทธ๋Ÿฐ ๋‹ค์Œ `notebook_login`๋กœ ํ—ˆ๋ธŒ์— ๋กœ๊ทธ์ธํ•˜๊ณ , [์—ฌ๊ธฐ](https://huggingface.co/settings/token) ๋งํฌ์—์„œ ๋กœ๊ทธ์ธํ•  ํ† ํฐ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:

```py
>>> from huggingface_hub import notebook_login

>>> notebook_login()
```

## ํ”„๋ ˆ์ž„์›Œํฌ ๊ฐ„ ๋ชจ๋ธ ๋ณ€ํ™˜ํ•˜๊ธฐ[[convert-a-model-for-all-frameworks]]

๋‹ค๋ฅธ ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ์ž‘์—…ํ•˜๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ ค๋ฉด, PyTorch ๋ฐ TensorFlow ์ฒดํฌํฌ์ธํŠธ๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์„ ๋ณ€ํ™˜ํ•˜๊ณ  ์—…๋กœ๋“œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์ด ๋‹จ๊ณ„๋ฅผ ๊ฑด๋„ˆ๋›ฐ์–ด๋„ ์‚ฌ์šฉ์ž๋Š” ๋‹ค๋ฅธ ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ๋ชจ๋ธ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์ง€๋งŒ, ๐Ÿค— Transformers๊ฐ€ ์ฒดํฌํฌ์ธํŠธ๋ฅผ ์ฆ‰์„์—์„œ ๋ณ€ํ™˜ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์†๋„๊ฐ€ ๋Š๋ ค์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ฒดํฌํฌ์ธํŠธ๋ฅผ ๋‹ค๋ฅธ ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ฒƒ์€ ์‰ฝ์Šต๋‹ˆ๋‹ค. PyTorch ๋ฐ TensorFlow๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•œ ๋‹ค์Œ(์„ค์น˜ ์ง€์นจ์€ [์—ฌ๊ธฐ](installation) ์ฐธ์กฐ) ๋‹ค๋ฅธ ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ์ž‘์—…์— ๋Œ€ํ•œ ํŠน์ • ๋ชจ๋ธ์„ ์ฐพ์Šต๋‹ˆ๋‹ค.

<frameworkcontent>
<pt>
์ฒดํฌํฌ์ธํŠธ๋ฅผ TensorFlow์—์„œ PyTorch๋กœ ๋ณ€ํ™˜ํ•˜๋ ค๋ฉด `from_tf=True`๋ฅผ ์ง€์ •ํ•˜์„ธ์š”:

```py
>>> pt_model = DistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_tf=True)
>>> pt_model.save_pretrained("path/to/awesome-name-you-picked")
```
</pt>
<tf>
์ฒดํฌํฌ์ธํŠธ๋ฅผ PyTorch์—์„œ TensorFlow๋กœ ๋ณ€ํ™˜ํ•˜๋ ค๋ฉด `from_pt=True`๋ฅผ ์ง€์ •ํ•˜์„ธ์š”:

```py
>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_pt=True)
```

๊ทธ๋Ÿฐ ๋‹ค์Œ ์ƒˆ๋กœ์šด ์ฒดํฌํฌ์ธํŠธ์™€ ํ•จ๊ป˜ ์ƒˆ๋กœ์šด TensorFlow ๋ชจ๋ธ์„ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> tf_model.save_pretrained("path/to/awesome-name-you-picked")
```
</tf>
<jax>
Flax์—์„œ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ, PyTorch์—์„œ Flax๋กœ ์ฒดํฌํฌ์ธํŠธ๋ฅผ ๋ณ€ํ™˜ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
...     "path/to/awesome-name-you-picked", from_pt=True
... )
```
</jax>
</frameworkcontent>

## ํ›ˆ๋ จ ์ค‘ ๋ชจ๋ธ ํ‘ธ์‹œํ•˜๊ธฐ[[push-a-model-during-training]]

<frameworkcontent>
<pt>
<Youtube id="Z1-XMy-GNLQ"/>

๋ชจ๋ธ์„ ํ—ˆ๋ธŒ์— ๊ณต์œ ํ•˜๋Š” ๊ฒƒ์€ ์ถ”๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋‚˜ ์ฝœ๋ฐฑ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ๋งŒํผ ๊ฐ„๋‹จํ•ฉ๋‹ˆ๋‹ค. [๋ฏธ์„ธ ์กฐ์ • ํŠœํ† ๋ฆฌ์–ผ](training)์—์„œ [`TrainingArguments`] ํด๋ž˜์Šค๋Š” ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ์™€ ์ถ”๊ฐ€ ํ›ˆ๋ จ ์˜ต์…˜์„ ์ง€์ •ํ•˜๋Š” ๊ณณ์ด๋ผ๋Š” ๊ฒƒ์„ ๊ธฐ์–ตํ•˜์„ธ์š”. ์ด๋Ÿฌํ•œ ํ›ˆ๋ จ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋Š” ๋ชจ๋ธ์„ ํ—ˆ๋ธŒ๋กœ ์ง์ ‘ ํ‘ธ์‹œํ•˜๋Š” ๊ธฐ๋Šฅ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. [`TrainingArguments`]์—์„œ `push_to_hub=True`๋ฅผ ์„ค์ •ํ•˜์„ธ์š”:

```py
>>> training_args = TrainingArguments(output_dir="my-awesome-model", push_to_hub=True)
```

ํ‰์†Œ์™€ ๊ฐ™์ด ํ›ˆ๋ จ ์ธ์ˆ˜๋ฅผ [`Trainer`]์— ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค:

```py
>>> trainer = Trainer(
...     model=model,
...     args=training_args,
...     train_dataset=small_train_dataset,
...     eval_dataset=small_eval_dataset,
...     compute_metrics=compute_metrics,
... )
```

๋ชจ๋ธ์„ ๋ฏธ์„ธ ์กฐ์ •ํ•œ ํ›„, [`Trainer`]์—์„œ [`~transformers.Trainer.push_to_hub`]๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ํ›ˆ๋ จ๋œ ๋ชจ๋ธ์„ ํ—ˆ๋ธŒ๋กœ ํ‘ธ์‹œํ•˜์„ธ์š”. ๐Ÿค— Transformers๋Š” ํ›ˆ๋ จ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ, ํ›ˆ๋ จ ๊ฒฐ๊ณผ ๋ฐ ํ”„๋ ˆ์ž„์›Œํฌ ๋ฒ„์ „์„ ๋ชจ๋ธ ์นด๋“œ์— ์ž๋™์œผ๋กœ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค!

```py
>>> trainer.push_to_hub()
```
</pt>
<tf>
[`PushToHubCallback`]์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์„ ํ—ˆ๋ธŒ์— ๊ณต์œ ํ•˜๋ ค๋ฉด, [`PushToHubCallback`]์— ๋‹ค์Œ ์ธ์ˆ˜๋ฅผ ์ •์˜ํ•˜์„ธ์š”:

- ์ถœ๋ ฅ๋œ ๋ชจ๋ธ์˜ ํŒŒ์ผ ๊ฒฝ๋กœ
- ํ† ํฌ๋‚˜์ด์ €
- `{Hub ์‚ฌ์šฉ์ž ์ด๋ฆ„}/{๋ชจ๋ธ ์ด๋ฆ„}` ํ˜•์‹์˜ `hub_model_id`

```py
>>> from transformers import PushToHubCallback

>>> push_to_hub_callback = PushToHubCallback(
...     output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model"
... )
```

[`fit`](https://keras.io/api/models/model_training_apis/)์— ์ฝœ๋ฐฑ์„ ์ถ”๊ฐ€ํ•˜๋ฉด, ๐Ÿค— Transformers๊ฐ€ ํ›ˆ๋ จ๋œ ๋ชจ๋ธ์„ ํ—ˆ๋ธŒ๋กœ ํ‘ธ์‹œํ•ฉ๋‹ˆ๋‹ค:

```py
>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)
```
</tf>
</frameworkcontent>

## `push_to_hub` ํ•จ์ˆ˜ ์‚ฌ์šฉํ•˜๊ธฐ[[use-the-pushtohub-function]]

๋ชจ๋ธ์—์„œ ์ง์ ‘ `push_to_hub`๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ํ—ˆ๋ธŒ์— ์—…๋กœ๋“œํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

`push_to_hub`์— ๋ชจ๋ธ ์ด๋ฆ„์„ ์ง€์ •ํ•˜์„ธ์š”:

```py
>>> pt_model.push_to_hub("my-awesome-model")
```

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์‚ฌ์šฉ์ž ์ด๋ฆ„ ์•„๋ž˜์— ๋ชจ๋ธ ์ด๋ฆ„ `my-awesome-model`๋กœ ์ €์žฅ์†Œ๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ด์ œ ์‚ฌ์šฉ์ž๋Š” `from_pretrained` ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> from transformers import AutoModel

>>> model = AutoModel.from_pretrained("your_username/my-awesome-model")
```

์กฐ์ง์— ์†ํ•˜๊ณ  ๋ชจ๋ธ์„ ์กฐ์ง ์ด๋ฆ„์œผ๋กœ ๋Œ€์‹  ํ‘ธ์‹œํ•˜๋ ค๋ฉด `repo_id`์— ์ถ”๊ฐ€ํ•˜์„ธ์š”:

```py
>>> pt_model.push_to_hub("my-awesome-org/my-awesome-model")
```

`push_to_hub` ํ•จ์ˆ˜๋Š” ๋ชจ๋ธ ์ €์žฅ์†Œ์— ๋‹ค๋ฅธ ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐ์—๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ๋ชจ๋ธ ์ €์žฅ์†Œ์— ํ† ํฌ๋‚˜์ด์ €๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> tokenizer.push_to_hub("my-awesome-model")
```

๋˜๋Š” ๋ฏธ์„ธ ์กฐ์ •๋œ PyTorch ๋ชจ๋ธ์˜ TensorFlow ๋ฒ„์ „์„ ์ถ”๊ฐ€ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค:

```py
>>> tf_model.push_to_hub("my-awesome-model")
```

์ด์ œ Hugging Face ํ”„๋กœํ•„๋กœ ์ด๋™ํ•˜๋ฉด, ์ƒˆ๋กœ ์ƒ์„ฑํ•œ ๋ชจ๋ธ ์ €์žฅ์†Œ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. **Files** ํƒญ์„ ํด๋ฆญํ•˜๋ฉด ์ €์žฅ์†Œ์— ์—…๋กœ๋“œํ•œ ๋ชจ๋“  ํŒŒ์ผ์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

์ €์žฅ์†Œ์— ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ  ์—…๋กœ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ—ˆ๋ธŒ ์„ค๋ช…์„œ [์—ฌ๊ธฐ](https://huggingface.co/docs/hub/how-to-upstream)๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

## ์›น ์ธํ„ฐํŽ˜์ด์Šค๋กœ ์—…๋กœ๋“œํ•˜๊ธฐ[[upload-with-the-web-interface]]

์ฝ”๋“œ ์—†๋Š” ์ ‘๊ทผ ๋ฐฉ์‹์„ ์„ ํ˜ธํ•˜๋Š” ์‚ฌ์šฉ์ž๋Š” ํ—ˆ๋ธŒ์˜ ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ๋ชจ๋ธ์„ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. [huggingface.co/new](https://huggingface.co/new)๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ ์ƒˆ๋กœ์šด ์ €์žฅ์†Œ๋ฅผ ์ƒ์„ฑํ•˜์„ธ์š”:

![new_model_repo](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/new_model_repo.png)

์—ฌ๊ธฐ์„œ ๋ชจ๋ธ์— ๋Œ€ํ•œ ๋ช‡ ๊ฐ€์ง€ ์ •๋ณด๋ฅผ ์ถ”๊ฐ€ํ•˜์„ธ์š”:

- ์ €์žฅ์†Œ์˜ **์†Œ์œ ์ž**๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์‚ฌ์šฉ์ž ๋˜๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์†ํ•œ ์กฐ์ง์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ์ €์žฅ์†Œ ์ด๋ฆ„์ด ๋  ๋ชจ๋ธ์˜ ์ด๋ฆ„์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
- ๋ชจ๋ธ์ด ๊ณต๊ฐœ์ธ์ง€ ๋น„๊ณต๊ฐœ์ธ์ง€ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
- ๋ชจ๋ธ์˜ ๋ผ์ด์„ผ์Šค ์‚ฌ์šฉ์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

์ด์ œ **Files** ํƒญ์„ ํด๋ฆญํ•˜๊ณ  **Add file** ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ์ƒˆ๋กœ์šด ํŒŒ์ผ์„ ์ €์žฅ์†Œ์— ์—…๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ ์—…๋กœ๋“œํ•  ํŒŒ์ผ์„ ๋Œ์–ด๋‹ค ๋†“๊ณ  ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋ฅผ ์ถ”๊ฐ€ํ•˜์„ธ์š”.

![upload_file](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/upload_file.png)

## ๋ชจ๋ธ ์นด๋“œ ์ถ”๊ฐ€ํ•˜๊ธฐ[[add-a-model-card]]

์‚ฌ์šฉ์ž๊ฐ€ ๋ชจ๋ธ์˜ ๊ธฐ๋Šฅ, ์ œํ•œ, ์ž ์žฌ์  ํŽธํ–ฅ ๋ฐ ์œค๋ฆฌ์  ๊ณ ๋ ค ์‚ฌํ•ญ์„ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋„๋ก ์ €์žฅ์†Œ์— ๋ชจ๋ธ ์นด๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์„ธ์š”. ๋ชจ๋ธ ์นด๋“œ๋Š” `README.md` ํŒŒ์ผ์— ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ชจ๋ธ ์นด๋“œ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

* `README.md` ํŒŒ์ผ์„ ์ˆ˜๋™์œผ๋กœ ์ƒ์„ฑํ•˜์—ฌ ์—…๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
* ๋ชจ๋ธ ์ €์žฅ์†Œ์—์„œ **Edit model card** ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

๋ชจ๋ธ ์นด๋“œ์— ํฌํ•จํ•  ์ •๋ณด ์œ ํ˜•์— ๋Œ€ํ•œ ์ข‹์€ ์˜ˆ๋Š” DistilBert [๋ชจ๋ธ ์นด๋“œ](https://huggingface.co/distilbert-base-uncased)๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ๋ชจ๋ธ์˜ ํƒ„์†Œ ๋ฐœ์ž๊ตญ์ด๋‚˜ ์œ„์ ฏ ์˜ˆ์‹œ ๋“ฑ `README.md` ํŒŒ์ผ์—์„œ ์ œ์–ดํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ์˜ต์…˜์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ [์—ฌ๊ธฐ](https://huggingface.co/docs/hub/models-cards) ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.