-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌐 [i18n-KO] Translated fast_tokenizers.mdx
to Korean
#22956
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
187d640
docs: ko: fast_tokenizer.mdx
kihoon71 b23f060
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 f70cf01
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 2f5b2d6
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 7e9a6db
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 7cbe230
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 a153ff8
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 a23063a
Update docs/source/ko/fast_tokenizers.mdx
kihoon71 e2bfdb0
Update fast_tokenizers.mdx
kihoon71 2e35d38
Update fast_tokenizers.mdx
kihoon71 047aef8
Update fast_tokenizers.mdx
kihoon71 8ecb7d8
Update fast_tokenizers.mdx
kihoon71 94d3139
Merge branch 'main' into ko_fast_tokenizer_new
kihoon71 736a47d
Update _toctree.yml
kihoon71 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!--Copyright 2020 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. | ||
--> | ||
|
||
# 🤗 Tokenizers 라이브러리의 토크나이저 사용하기 | ||
|
||
[PreTrainedTokenizerFast]는 🤗 Tokenizers 라이브러리에 기반합니다. 🤗 Tokenizers 라이브러리의 토크나이저는 | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
🤗 Transformers로 매우 간단하게 불러올 수 있습니다. | ||
|
||
구체적인 내용에 들어가기 전에, 몇 줄의 코드로 더미 토크나이저를 만들어 보겠습니다: | ||
|
||
```python | ||
>>> from tokenizers import Tokenizer | ||
>>> from tokenizers.models import BPE | ||
>>> from tokenizers.trainers import BpeTrainer | ||
>>> from tokenizers.pre_tokenizers import Whitespace | ||
|
||
>>> tokenizer = Tokenizer(BPE(unk_token="[UNK]")) | ||
>>> trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"]) | ||
|
||
>>> tokenizer.pre_tokenizer = Whitespace() | ||
>>> files = [...] | ||
>>> tokenizer.train(files, trainer) | ||
``` | ||
|
||
우리가 정의한 파일을 통해 학습 된 토크나이저를 이제 갖게 되었습니다. 이 런타임에서 계속 사용하거나 JSON 파일로 저장하여 나중에 사용할 수 있습니다. | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 토크자이저 객체로부터 직접 불러오기 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 토크자이저 |
||
|
||
🤗 Transformers 라이브러리에서 이 토크나이저 객체를 활용하는 방법을 살펴보겠습니다. | ||
[PreTrainedTokenizerFast] 클래스는 인스턴스화된 토크나이저 객체를 인수로 받아 쉽게 인스턴스화할 수 있습니다: | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```python | ||
>>> from transformers import PreTrainedTokenizerFast | ||
|
||
>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer) | ||
``` | ||
|
||
이제 fast_tokenizer 객체는 🤗 Transformers 토크나이저에서 공유하는 모든 메소드와 함께 사용할 수 있습니다! 자세한 내용은 토크나이저 페이지를 참조하세요. | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## JSON 파일에서 불러오기 | ||
|
||
<!--In order to load a tokenizer from a JSON file, let's first start by saving our tokenizer:--> | ||
|
||
JSON 파일에서 토크나이저를 불러오기 위해, 먼저 토크나이저를 저장해 보겠습니다: | ||
|
||
```python | ||
>>> tokenizer.save("tokenizer.json") | ||
``` | ||
|
||
JSON 파일을 저장한 경로는 tokenizer_file 매개변수를 사용하여 [PreTrainedTokenizerFast] 초기화 메소드에 전달할 수 있습니다: | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```python | ||
>>> from transformers import PreTrainedTokenizerFast | ||
|
||
>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json") | ||
``` | ||
|
||
이제 fast_tokenizer 객체는 🤗 Transformers 토크나이저에서 공유하는 모든 메소드와 함께 사용할 수 있습니다! 자세한 내용은 토크나이저 페이지를 참조하세요. | ||
kihoon71 marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제목에 영어문서와 동일한 anchor를 [[ ]] 부호 사이에 넣어야 우측의 TOC가 동작합니다.
대부분 영어 제목과 동일한 소문자인데 공백을 - 로 표현하는 형태입니다. :-)
다른 분들 문서를 보시면 이해되실꺼예요.