--- license: mit language: - ko metrics: - accuracy --- # Model Card for KorSciDeBERTa KorSciDeBERTa는 Microsoft DeBERTa 모델의 아키텍쳐를 기반으로, 논문, 연구 보고서, 특허, 뉴스, 한국어 위키 말뭉치 총 146GB를 사전학습한 모델입니다. 마스킹된 언어 모델링 또는 다음 문장 예측에 사전학습 모델을 사용할 수 있고, 추가로 문장 분류, 단어 토큰 분류 또는 질의응답과 같은 다운스트림 작업에서 미세 조정을 통해 사용될 수 있습니다. ## Model Details ### Model Description - **Developed by:** KISTI - **Model type:** deberta-v2 - **Language(s) (NLP):** 한글(ko) ### Model Sources - **Repository 1:** https://huggingface.co/kisti/korscideberta - **Repository 2:** https://aida.kisti.re.kr/ ## Uses ### Downstream Use ### Load Huggingface model directly 1. 형태소 분석기(Mecab) 등 설치 필수 - KorSciDeBERTa 환경설치+파인튜닝.pdf - Mecab 설치 참고: 다음 링크에서 '사용방법'. https://aida.kisti.re.kr/model/9bbabd2d-6ce8-44cc-b2a3-69578d23970a - Colab 사용하는 경우 Mecab 설치(위의 사용자 사전 추가 설치하지 않을 시 베이스라인 정확도 0.786으로 감소함):

!git clone https://github.com/SOMJANG/Mecab-ko-for-Google-Colab.git
%cd Mecab-ko-for-Google-Colab/
!bash install_mecab-ko_on_colab_light_220429.sh

- ImportError: accelerate>=0.20.1 에러 발생시 해결법 !pip install -U accelerate; pip install -U transformers; pip install pydantic==1.8 (설치 후 런타임 재시작) - 토크나이저 로드 에러 발생시 해결법 git-lfs 설치 확인 및 spm.model 정상 다운로드 & 용량(2.74mb) 확인 (apt-get install git git-lfs) Make sure you have git-lfs installed (git lfs install) 2. apt-get install git-lfs; git clone https://huggingface.co/kisti/korscideberta; cd korscideberta - **korscideberta-abstractcls.ipynb**

!pip install transformers==4.36.0
from tokenization_korscideberta_v2 import DebertaV2Tokenizer
from transformers import AutoModelForSequenceClassification


tokenizer = DebertaV2Tokenizer.from_pretrained("kisti/korscideberta")
model = AutoModelForSequenceClassification.from_pretrained("kisti/korscideberta", num_labels=7, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
#model = AutoModelForMaskedLM.from_pretrained("kisti/korscideberta")
''''''
train_metrics = trainer.train().metrics
trainer.save_metrics("train", train_metrics)
trainer.push_to_hub()
  
### KorSciDeBERTa native code KorSciDeBERTa 환경설치+파인튜닝.pdf 참조 - 파인튜닝(원본 DeBERTa 참고): https://github.com/microsoft/DeBERTa/tree/master#run-deberta-experiments-from-command-line - **korscideberta.zip**

apt-get install git git-lfs
git clone https://huggingface.co/kisti/korscideberta; cd korscideberta; unzip korscideberta.zip -d korscideberta
''''''
cd korscideberta/experiments/glue; chmod 777 *.sh;
./mnli.sh

### Out-of-Scope Use 이 모델은 의도적으로 사람들에게 적대적이나 소외된 환경을 조성하는데 사용되어서는 안 됩니다. 이 모델은 '고위험 설정'에서 사용될 수 없습니다. 이 모델은 사람이나 사물에 대한 중요한 결정을 내릴 수 있게 설계되지 않았습니다. 모델의 출력물은 사실이 아닐 수 있습니다. '고위험 설정'은 다음과 같은 사항을 포함합니다: 의료/정치/법률/금융 분야에서의 사용, 고용/교육/신용 분야에서의 인물 평가, 자동으로 중요한 것을 결정하기, (가짜)사실을 생성하기, 신뢰도 높은 요약문 생성, 항상 옳아야만 하는 예측 생성 등. ## Bias, Risks, and Limitations 연구목적으로 저작권 문제가 없는 말뭉치 데이터만을 사용하였습니다. 이 모델의 사용자는 아래의 위험 요인들을 인식해야 합니다. 사용된 말뭉치는 대부분 중립적인 성격을 가지고 있는데도 불구하고, 언어 모델의 특성상 아래와 같은 윤리 관련 요소를 일부 포함할 수 있습니다: 특정 관점에 대한 과대/과소 표현, 고정 관념, 개인 정보, 증오/모욕 또는 폭력적인 언어, 차별적이거나 편견적인 언어, 관련이 없거나 반복적인 출력 생성 등. ## Training Details ### Training Data 논문, 연구 보고서, 특허, 뉴스, 한국어 위키 말뭉치 총 146GB ### Training Procedure KISTI HPC NVIDIA A100 80G GPU 24EA에서 2.5개월동안 1,600,000 스텝 학습 #### Preprocessing - 과학기술분야 토크나이저 (KorSci Tokenizer) - 본 사전학습 모델에서 사용된 코퍼스를 기반으로 명사 및 복합명사 약 600만개의 사용자사전이 추가된 [Mecab-ko Tokenizer](https://bitbucket.org/eunjeon/mecab-ko/src/master/)와 기존 SentencePiece-BPE가 병합되어진 토크나이저를 사용하여 말뭉치를 전처리하였습니다. - Total 128,100 words - Included special tokens ( < unk >, < cls >, < s >, < mask > ) - File name : spm.model, vocab.txt #### Training Hyperparameters - **model_type:** deberta-v2 - **model_size:** base - **parameters:** 180M - **hidden_size:** 768 - **num_hidden_layers:** 12 - **num_attention_heads:** 12 - **num_train_steps:** 1,600,000 - **train_batch_size:** 4,096 * 4 accumulative update = 16,384 - **learning_rate:** 1e-4 - **max_seq_length:** 512 - **vocab_size:** 128,100 - **Training regime:** fp16 mixed precision ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data 본 언어모델의 성능평가는 논문 연구분야 분류 데이터에 파인튜닝하여 평가하는 방식을 사용하였으며, 그 결과는 아래와 같습니다. - 논문 연구분야 분류 데이터셋(doi.org/10.23057/50), 논문 3만 건, 분류 카테고리 수 - 대분류: 33개, 중분류: 372개, 소분류: 2898개 #### Metrics F1-micro/macro: 정답 Top3 중 최소 1개 예측시 성공 기준 F1-strict: 정답 Top3 중 예측한 수 만큼 성공 기준 ### Results F1-micro: 0.85, F1-macro: 0.52, F1-strict: 0.71 ## Technical Specifications ### Model Objective MLM is a technique in which you take your tokenized sample and replace some of the tokens with the < mask > token and train your model with it. The model then tries to predict what should come in the place of that < mask > token and gradually starts learning about the data. MLM teaches the model about the relationship between words. Eg. Suppose you have a sentence - 'Deep Learning is so cool! I love neural networks.', now replace few words with the < mask > token. Masked Sentence - 'Deep Learning is so < mask >! I love < mask > networks.' ### Compute Infrastructure KISTI 국가슈퍼컴퓨팅센터 NEURON 시스템. HPE ClusterStor E1000, HP Apollo 6500 Gen10 Plus, Lustre, Slurm, CentOS 7.9 #### Hardware NVIDIA A100 80G GPU 24EA #### Software Python 3.8, Cuda 10.2, PyTorch 1.10 ## Citation 한국과학기술정보연구원 (2023) : 한국어 과학기술분야 DeBERTa 사전학습 모델 (KorSciDeBERTa). Version 1.0. 한국과학기술정보연구원. ## Model Card Authors 김성찬, 김경민, 김은희, 이민호, 이승우. 한국과학기술정보연구원 인공지능데이터연구단 ## Model Card Contact 김성찬, sckim kisti.re.kr 김경민, kkmkorea kisti.re.kr