- Introduces fastText, a simple and highly efficient approach for text classification.
- At par with deep learning models in terms of accuracy though an order of magnitude faster in performance.
- Link to the paper
- Link to code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GROUP_MEMBERS = { | |
'ZH': ['cmn', 'cn', 'yue', 'ze_zh', 'zh_cn', 'zh_CN', 'zh_HK', 'zh_tw', 'zh_TW', 'zh_yue', 'zhs', 'zht', 'zh'], | |
'ROMANCE': ['fr', 'fr_BE', 'fr_CA', 'fr_FR', 'wa', 'frp', 'oc', 'ca', 'rm', 'lld', 'fur', 'lij', 'lmo', | |
'es', 'es_AR', 'es_CL', 'es_CO', 'es_CR', 'es_DO', 'es_EC', 'es_ES', 'es_GT', 'es_HN', 'es_MX', 'es_NI', 'es_PA', 'es_PE', 'es_PR', 'es_SV', 'es_UY', 'es_VE', | |
'pt', 'pt_br', 'pt_BR', 'pt_PT', 'gl', 'lad', 'an', 'mwl', 'it', 'it_IT', 'co', 'nap', 'scn', 'vec', 'sc', 'ro', 'la'], | |
'NORTH_EU': ['de', 'nl', 'fy', 'af', 'da', 'fo', 'is', 'no', 'nb', 'nn', 'sv'], | |
'SCANDINAVIA': ['da', 'fo', 'is', 'no', 'nb', 'nn', 'sv'], | |
'SAMI': ['se', 'sma', 'smj', 'smn', 'sms'], | |
'NORWAY': ['nb_NO', 'nb', 'nn_NO', 'nn', 'nog', 'no_nb', 'no'], | |
'CELTIC': ['ga', 'cy', 'br', 'gd', 'kw', 'gv'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import BertForQuestionAnswering | |
import torch | |
bert_name = "bert-large-uncased-whole-word-masking-finetuned-squad" | |
model = BertForQuestionAnswering.from_pretrained(bert_name, torchscript=True) | |
model.eval() | |
inputs = [torch.ones(1, 2, dtype=torch.int64), | |
torch.ones(1, 2, dtype=torch.int64), |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.optim import Optimizer | |
KD_loss = nn.KLDivLoss(reduction='batchmean') | |
def kd_step(teacher: nn.Module, | |
student: nn.Module, | |
temperature: float, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
# @author cpuhrsch https://github.com/cpuhrsch | |
# @author Loreto Parisi loreto@musixmatch.com | |
import argparse | |
import numpy as np | |
from sklearn.metrics import confusion_matrix | |
def parse_labels(path): | |
with open(path, 'r') as f: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
from keras.preprocessing import image | |
from keras.applications.inception_v3 import preprocess_input, decode_predictions | |
import numpy as np | |
import tensorflow as tf | |
model = keras.applications.inception_v3.InceptionV3(include_top=True, weights='imagenet', input_tensor=None, input_shape=None) | |
graph = tf.get_default_graph() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Sequential | |
from keras.layers.core import Activation, Dense | |
training_data = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
target_data = np.array([[0],[1],[1],[0]], "float32") | |
model = Sequential() | |
model.add(Dense(32, input_dim=2, activation='relu')) | |
model.add(Dense(1, activation='sigmoid')) |
NewerOlder