from datasets import load_dataset
from tokenizers import ByteLevelBPETokenizer
tokenizer = ByteLevelBPETokenizer(unicode_normalizer="nfkc", trim_offsets=True)
ds = load_dataset("Bingsu/my-korean-training-corpus", use_auth_token=True)
# 공개된 데이터를 사용할 경우# ds = load_dataset("cc100", lang="ko") # 50GB# 이 데이터는 35GB이고, 데이터가 너무 많으면 컴퓨터가 터져서 일부만 사용했습니다.
ds_sample = ds["train"].train_test_split(0.35, seed=20220819)["test"]
defgen_text(batch_size: int = 5000):
for i inrange(0, len(ds_sample), batch_size):
yield ds_sample[i : i + batch_size]["text"]
tokenizer.train_from_iterator(
gen_text(),
vocab_size=50265, # roberta-base와 같은 크기
min_frequency=2,
special_tokens=[
"<s>",
"<pad>",
"</s>",
"<unk>",
"<mask>",
],
)
tokenizer.save("my_tokenizer.json")
약 7시간 소모 (i5-12600 non-k)
이후 토크나이저의 post-processor를 RobertaProcessing으로 교체합니다.
ko_BBPE_tokenizer_roberta huggingface.co is an AI model on huggingface.co that provides ko_BBPE_tokenizer_roberta's model effect (), which can be used instantly with this Bingsu ko_BBPE_tokenizer_roberta model. huggingface.co supports a free trial of the ko_BBPE_tokenizer_roberta model, and also provides paid use of the ko_BBPE_tokenizer_roberta. Support call ko_BBPE_tokenizer_roberta model through api, including Node.js, Python, http.
ko_BBPE_tokenizer_roberta huggingface.co is an online trial and call api platform, which integrates ko_BBPE_tokenizer_roberta's modeling effects, including api services, and provides a free online trial of ko_BBPE_tokenizer_roberta, you can try ko_BBPE_tokenizer_roberta online for free by clicking the link below.
Bingsu ko_BBPE_tokenizer_roberta online free url in huggingface.co:
ko_BBPE_tokenizer_roberta is an open source model from GitHub that offers a free installation service, and any user can find ko_BBPE_tokenizer_roberta on GitHub to install. At the same time, huggingface.co provides the effect of ko_BBPE_tokenizer_roberta install, users can directly use ko_BBPE_tokenizer_roberta installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
ko_BBPE_tokenizer_roberta install url in huggingface.co: