This file contains hidden or 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
{ | |
"embeddings": [ | |
{ | |
"tensorName": "My tensor", | |
"tensorShape": [ | |
52420, | |
200 | |
], | |
"tensorPath": "https://entilzha-us-west-2.s3-us-west-2.amazonaws.com/shifeng/proto_tensors.tsv", | |
"metadataPath": "https://entilzha-us-west-2.s3-us-west-2.amazonaws.com/shifeng/proto_metadata.tsv", |
This file contains hidden or 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 | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
color_name = 'color{}' | |
define_color = '\definecolor{{{}}}{{HTML}}{{{}}}' | |
box = '\\mybox{{{}}}{{\strut{{{}}}}}' | |
cmap = plt.cm.get_cmap('RdBu') |
This file contains hidden or 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 | |
import matplotlib | |
import matplotlib.pyplot as plt | |
def colorize(words, color_array): | |
# words is a list of words | |
# color_array is an array of numbers between 0 and 1 of length equal to words | |
cmap = matplotlib.cm.get_cmap('RdBu') | |
template = '<span class="barcode"; style="color: black; background-color: {}">{}</span>' | |
colored_string = '' |
This file contains hidden or 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 random | |
import numpy as np | |
from collections import defaultdict | |
import torch | |
from torch.autograd import Variable | |
from vocab import PAD_ID | |
class Iterator(object): |