인공지능 공부/딥러닝 논문읽기
(챗봇) NLP Transformer Attention 시각화 구현하기
import math import numpy as np import random import torch import torch.nn as nn import torch.nn.functional as F import torchtext # Setup seeds torch.manual_seed(1234) np.random.seed(1234) random.seed(1234) #각 단어를 벡터로 변환 #Vocabulary 총단어수 * 분산표현의 차원수 class Embedder(nn.Module): def __init__(self, text_embedding_vectors): super(Embedder, self).__init__() self.embeddings = nn.Embedding.from_pretraine..
(챗봇) open domain question answering - Hugging Face
import unicodedata import numpy import sqlite3 import os import json import pickle from sqlalchemy import false DB_PATH = '/root/torch/dilbert/wikipedia/docs.db' ##========== the function and class below come from https://github.com/facebookresearch/DrQA (please check their license) def normalize(text): """Resolve different type of unicode encodings.""" return unicodedata.normalize('NFD', text) ..