Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

KoBERT

> 数据库
Open source

Korean BERT pre-trained cased (KoBERT)

1.4K stars0 likes0 views
WebsiteGitHub

About

Korean BERT pre-trained cased (KoBERT)

KoBERT

  • KoBERT
    • Korean BERT pre-trained cased (KoBERT)
      • Why'?'
      • Training Environment
      • Requirements
      • How to install
    • How to use
      • Using with PyTorch
      • Using with ONNX
      • Using with MXNet-Gluon
      • Tokenizer
    • Subtasks
      • Naver Sentiment Analysis
      • KoBERT와 CRF로 만든 한국어 객체명인식기
      • Korean Sentence BERT
    • Release
    • Contacts
    • License

Korean BERT pre-trained cased (KoBERT)

Why'?'

  • 구글 BERT base multilingual cased의 한국어 성능 한계

Training Environment

  • Architecture
predefined_args = {
        'attention_cell': 'multi_head',
        'num_layers': 12,
        'units': 768,
        'hidden_size': 3072,
        'max_length': 512,
        'num_heads': 12,
        'scaled': True,
        'dropout': 0.1,
        'use_residual': True,
        'embed_size': 768,
        'embed_dropout': 0.1,
        'token_type_vocab_size': 2,
        'word_embed': None,
    }
  • 학습셋
데이터 문장 단어 한국어 위키 5M 54M
  • 학습 환경

    • V100 GPU x 32, Horovod(with InfiniBand)
  • 사전(Vocabulary)

    • 크기 : 8,002
    • 한글 위키 기반으로 학습한 토크나이저(SentencePiece)
    • Less number of parameters(92M < 110M )

Requirements

  • see requirements.txt

How to install

  • Install KoBERT as a python package

    pip install git+https://[email protected]/SKTBrain/KoBERT.git@master
    
  • If you want to modify source codes, please clone this repository

    git clone https://github.com/SKTBrain/KoBERT.git
    cd KoBERT
    pip install -r requirements.txt
    

How to use

PyTorch

Huggingface transformers API가 편하신 분은 여기를 참고하세요.

…

model은 디폴트로 eval()모드로 리턴됨, 따라서 학습 용도로 사용시 model.train()명령을 통해 학습 모드로 변경할 필요가 있다.

  • Naver Sentiment Analysis Fine-Tuning with pytorch
    • Colab에서 [런타임] - [런타임 유형 변경] - 하드웨어 가속기(GPU) 사용을 권장합니다.

ONNX

…

ONNX 컨버팅은 soeque1께서 도움을 주셨습니다.

MXNet-Gluon

…
  • Naver Sentiment Analysis Fine-Tuning with MXNet

Tokenizer

  • Pretrained Sentencepiece tokenizer
>>> from gluonnlp.data import SentencepieceTokenizer
>>> from kobert import get_tokenizer_path
>>> tok_path = get_tokenizer_path()
>>> sp  = SentencepieceTokenizer(tok_path)
>>> sp('한국어 모델을 공유합니다.')
['▁한국', '어', '▁모델', '을', '▁공유', '합니다', '.']

Task Fine-tuning

Naver Sentiment Analysis

  • Dataset : https://github.com/e9t/nsmc
Model Accuracy BERT base multilingual cased 0.875 KoBERT 0.901 KoGPT2 0.899

KoBERT와 CRF로 만든 한국어 객체명인식기

  • https://github.com/eagle705/pytorch-bert-crf-ner
…

Korean Sentence BERT

  • https://github.com/BM-K/KoSentenceBERT-SKT
Model Cosine Pearson Cosine Spearman Euclidean Pearson Euclidean Spearman Manhattan Pearson Manhattan Spearman Dot Pearson Dot Spearman NLl 65.05 68.48 68.81 68.18 68.90 68.20 65.22 66.81 STS 80.42 79.64 77.93 77.43 77.92 77.44 76.56 75.83 STS + NLI 78.81 78.47 77.68 77.78 77.71 77.83 75.75 75.22

Release

  • v0.2.4
    • 대용량 파일을 Hugging Face Hub에서 받도록 변경
  • v0.2.3
    • onnx 1.8.0 지원
  • v0.2.2
    • 에러 수정: No module named 'kobert.utils'
  • v0.2.1
    • import 구문 수정
  • v0.2
    • 대용량 파일을 aws s3에서 받도록 변경
    • 함수명 변경
  • v0.1.2
    • transformers 라이브러리 호환성 수정
    • pad token의 index 수정
  • v0.1.1
    • 사전(vocabulary)과 토크나이저 통합
  • v0.1
    • 초기 모델 릴리즈

Contacts

KoBERT 관련 이슈는 이곳에 등록해 주시기 바랍니다.

License

KoBERT는 Apache-2.0 라이선스 하에 공개되어 있습니다. 모델 및 코드를 사용할 경우 라이선스 내용을 준수해주세요. 라이선스 전문은 LICENSE 파일에서 확인하실 수 있습니다.

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •Korean BERT pre-trained cased (KoBERT)
  • •Training Environment
  • •Requirements
  • •How to install
  • •How to use
  • •Using with PyTorch
  • •Using with ONNX
  • •Using with MXNet-Gluon
  • •Tokenizer
  • •Subtasks

> Tags

Pythonbertkorean-nlplanguage-modelnlp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库