본문 바로가기

AI/NLP

(13)
[논문리뷰+구현] R-BERT: Enriching Pre-trained Language Model with Entity Information for Relation Classification + R-RoBERTa Pytorch Lightning Enriching Pre-trained Language Model with Entity Information for Relation Classification Abstract Realation Classification을 수행하기 위해서는 문장에 대한 정보와 두 엔티티에 대한 정보가 필요하다. 문장에 대한 정보는 BERT의 last hidden states의 출력값 [CLS]토큰에 담겨있다. 이 논문에서 두 엔티티에 대한 정보는, 1) 타겟 엔티티들을 찾고, 2) 해당 정보를 사전학습된 언어 모델에 전달하고, 3) 두 엔티티의 해당 인코딩을 통합한다. SOTA 모델의 성능을 개선한다 Introduction Relation Classification이란, 주어진 시퀀스 s가 있고, 명사쌍 e1과 e2가 있..
Relation Extraction Pytorch Lightning Refactoring Pytorch Lightning > Docs > LightningModule LightningModule — PyTorch Lightning 1.9.0dev documentation LightningModule A LightningModule organizes your PyTorch code into 6 sections: Computations (init). Train Loop (training_step) Validation Loop (validation_step) Test Loop (test_step) Prediction Loop (predict_step) Optimizers and LR Schedulers (configure_op pytorch-lightning.readthedocs.io model...
[자연어처리 모델 정리] BERT, RoBERTa, ALBERT, XLNet, ELECTRA BERT - BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding (arXiv, 2018) - Transformer Encoder를 여러개 stack - Token: WordPiece 기반 Embedding, Segment: 문장 구분 Embedding, Position: token의 위치 정보 Embedding - Pre-training: Masked Languaged Model(MLM), Next Sentence Prediction(NSP) task - Stacic masking: 전처리 과정에서 masking - 90% input sequence length 128, 나머지 10% 512 RoBERTa - R..
[논문리뷰] Attention Is All You Need, Transformer Attention Is All You Need Abstract The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recur..
[BERT] IMDB Movie Dataset 감성분석 텍스트분류 영어 Fine-Tuning 라이브러리 설치 # A dependency of the preprocessing for BERT inputs !pip install -q -U tensorflow-text !pip install -q tf-models-official 라이브러리 import import os import shutil import tensorflow as tf import tensorflow_hub as hub import tensorflow_text as text from official.nlp import optimization # to create AdamW optimizer import matplotlib.pyplot as plt tf.get_logger().setLevel('ERROR') 데이터셋 다운로드 및 불러..