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 csv | |
import sys | |
from dynamo_access import put_words, get_words | |
def get_frequent_words(dataset , numOfWords): | |
pairs = [] | |
with open(dataset, 'rb') as csvfile: | |
reader = csv.reader(csvfile, delimiter=',') | |
next(reader, None) | |
for row in reader: |
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 | |
from torch.autograd import Variable | |
import torch.nn as nn | |
import torch.nn.functional as F | |
words_dim = 300 | |
input_channel = 1 | |
output_channel = 100 | |
dropout_rate = 0.5 |
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 boto3 | |
import json | |
from datetime import datetime | |
from pytz import timezone | |
lambda_client = boto3.client('lambda') | |
print('invoking') |
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 os | |
import boto3 | |
import json | |
import base64 | |
from datetime import datetime | |
from pytz import timezone | |
import sys | |
lambda_client = boto3.client('lambda') |
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 boto3 | |
import torch | |
from torch.autograd import Variable | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import numpy as np | |
import json | |
# change this to use other models | |
from SimpleModel import SimpleModel |
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
sudo yum -y update | |
sudo yum install -y gcc zlib zlib-devel openssl openssl-devel git make automake gcc-c++ kernel-devel | |
# cmake 3.6.2 | |
cd | |
wget https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz | |
tar -zxvf cmake-3.6.2.tar.gz | |
cd cmake-3.6.2 | |
sudo ./bootstrap --prefix=/usr/local | |
sudo make |
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 boto3 | |
import numpy | |
import pickle | |
import spacy | |
table_name = 'wordvec' # table name on DynamoDB | |
# batch size specified by DynamoDB. See DynamoDB's doc for more details | |
write_batch_size = 25 | |
read_batch_size = 100 |
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 numpy | |
import pickle | |
# change this to your own files' name | |
dataset_file = 'word2vec.sst-1.pt' # file to load from | |
wordindex_file = 'wordindex.pkl' # file to save to | |
indexvec_file = 'indexvec.npy' # file to save to | |