인공지능 공부

    (NLP 연구) The Long-Document Transformer 03.31 (LSH)

    import glob import os import io import string import re import random import spacy import torchtext from torchtext.vocab import Vectors import re import numpy as np import itertools from random import shuffle def create_hash_func(size: int): hash_ex = list(range(1, len(vocab)+1)) shuffle(hash_ex) return hash_ex def build_minhash_func(vocab_size: int, nbits: int): hashes = [] for _ in range(nbits..

    (NLP 연구) The Long-Document Transformer 03.28

    LSH hashing 구현 def shingle(text: str, k:int): shingle_set = [] for i in range(len(text) - k + 1): shingle_set.append(text[i:i+k]) return set(shingle_set) k = 2 a = shingle(a,k) b = shingle(b,k) c = shingle(c,2) vocab = list(a.union(b).union(c)) a_1hot = [1 if x in a else 0 for x in vocab] b_1hot = [1 if x in b else 0 for x in vocab] c_1hot = [1 if x in c else 0 for x in vocab] hash_ex = list(ran..

    (NLP 연구) The Long-Document Transformer 03.24

    To address this issue, numerous methods are proposed recently, such as the sparse attention matrix (Zaheer et al., 2020; Beltagy et al., 2020; Tay et al., 2020a; Kitaev et al., 2019; Child et al., 2019),lowrank representations (Wang et al., 2020) or kernel-based methods (Peng et al., 2020; Choromanski et al., 2020; Katharopoulos et al., 2020), among many others. These methods achieve reduced com..

    (NLP 연구) The Long-Document Transformer 03.18

    Full attention 테스트 데이터 25000개의 정답률:0.8719 다시 Window attention 실험 (epoch 20) 실험 (window) window_size 4 : 테스트 데이터 25000개의 정답률:0.8461 window_size 8 : 테스트 데이터 25000개의 정답률:0.8544 (영어문장 단어의평균수) window_size 16 : 테스트 데이터 25000개의 정답률:0.8454(영어문장 단어의평균수) window_size 32 : 테스트 데이터 25000개의 정답률:0.8299 실험 (window16 + global) window16 + global 16 : 테스트 데이터 25000개의 정답률:0.8643 epoch 100번 기준 (20정도 적당)

    (NLP 연구) The Long-Document Transformer 03.17

    성능 확인 Full attention 테스트 데이터 25000개의 정답률:0.8719 Sparse_attention (only window) window 16 → 테스트 데이터 25000개의 정답률:0.8591 window 32 → 테스트 데이터 25000개의 정답률:0.8609 window 64 → 테스트 데이터 25000개의 정답률:0.8154 window 128 → 테스트 데이터 25000개의 정답률:0.8591 Sparse_attention ( window + global) window32 + global 1 : 테스트 데이터 25000개의 정답률:0.8561 window32 + global 32 : 테스트 데이터 25000개의 정답률:0.8633 num_epochs = 10 window 32 →..

    (NLP 연구) The Long-Document Transformer 03.16

    Global attention attention word length : 5 → epoch 10 → acc 0.86474

    (NLP 연구) The Long-Document Transformer 03.15

    LSH hashing 기법 공부 LSH 알고리즘 Shingling 비슷한 문서일수록 더욱 많은 shingles를 공유한다 문서 에 있는 단락들의 순서를 바꿔도 shingles에는 영향을 주지 않는다 k의 값은 실제 응용에서 8~10개정도 사용 너무 작은 k는 대부분의 문서에서 반복적으로 등장 ex) gist = {gi, is, st} shingle 집합으로 쪼개진다. Jaccard Index shingle형태로 표현되었으면 유사성을 측정하는 측정치가 필요하다. 두 문서의 교집합의 개수에서 합집합의 개수를 나누어주면 된다. The Jaccard similarity of two sets is the size of their intersection divided by the size of their union.

    (NLP 연구) The Long-Document Transformer 03.14

    - attention layer 별 코딩 Local - > wide - attention을 Layer 별로 시각화 함수구현 - attention map 코딩 좁게 보다가 넓게 보는 것을 확인 기타공부 nn.Linear에 대하여 들어오는 float32형 input 데이터에 대해 y=wx+b 형태의 선형 변환을 수행하는 메소드

    (NLP 연구) Paper 정리

    Atomic Sparse Attention https://github.com/vene/sparse-structured-attention Compound Sparse Attention (위의 Atomic 이 모여 구성) Star Transformer (NAACL, 2019, 123회 인용) https://arxiv.org/abs/1902.09113 https://github.com/fastnlp/fastNLP Longformer: The Long-Document Transformer ****(2020, 708회 인용 / AllenAI) https://arxiv.org/pdf/2004.05150.pdf https://github.com/allenai/longformer ETC: Encoding Long an..

    (NLP 연구) The Long-Document Transformer 03.10

    Efficient Transformers: A Survey 읽어보자 https://arxiv.org/pdf/2009.06732.pdf Introduction on-device applications, models are supposed to be able to operate with a limited computational budget In this paper, we propose a taxonomy of efficient Transformer models, characterizing them by the technical innovation and primary use case The efficiency might also refer to computational costs, e.g. number of FL..

    (NLP 연구) The Long-Document Transformer 03.08

    To do 좋은 Attention이란? 공부하기