Skip to content

Instantly share code, notes, and snippets.

View mrdrozdov's full-sized avatar

Andrew Drozdov mrdrozdov

View GitHub Profile
@mrdrozdov
mrdrozdov / ontonotes-ner.txt
Created November 20, 2018 17:25
ontonotes-ner.txt
2018-11-20 12:25:06,998 [INFO] Accuracy=0.926402290907022
2018-11-20 12:25:07,011 [INFO] Confusion Matrix:
t/p CARDINAL DATE EVENT FAC GPE LANGUAGE LAW LOC MONEY NORP ORDINAL ORG PERCENT PERSON PRODUCT QUANTITY TIME WORK_OF_ART
CARDINAL 477.0 4.0 0.0 0.0 1.0 0.0 0.0 0.0 18.0 0.0 1.0 1.0 0.0 1.0 0.0 3.0 1.0 0.0
DATE 6.0 795.0 3.0 0.0 2.0 0.0 0.0 0.0 1.0 0.0 2.0 0.0 0.0 1.0 0.0 1.0 5.0 0.0
EVENT 0.0 2.0 31.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 2.0 1.0 0.0 0.0
@mrdrozdov
mrdrozdov / profiling-diora.txt
Created November 15, 2018 02:27
profiling-diora.txt
--- PROFILING ---
--- INSIDE ---
_unsafe_view 19 127.431us 108.259us
t 19 158.285us 160.697us
split 19 272.784us 276.931us
exp 19 276.274us 283.493us
th_sub 19 282.381us 296.449us
div 19 280.799us 299.139us
max 19 332.444us 343.678us
bmm 19 307.893us 362.781us
@mrdrozdov
mrdrozdov / profile.py
Created November 8, 2018 17:27
spoiler-alert.txt
import torch
import argparse
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument('--flip', action='store_true')
options = parser.parse_args()
@mrdrozdov
mrdrozdov / punct.txt
Created November 6, 2018 04:54
punct.txt
punctuation_words = set(['.', ',', ':', '-LRB-', '-RRB-', '\'\'', '``', '--', ';', '-', '?', '!', '...', '-LCB-', '-RCB-'])
currency_tags_words = set(['#', '$', 'C$', 'A$'])
ellipsis = set(['*', '*?*', '0', '*T*', '*ICH*', '*U*', '*RNR*', '*EXP*', '*PPA*', '*NOT*'])
other = set(['HK$', '&', '**'])
@mrdrozdov
mrdrozdov / dp.py
Created October 30, 2018 00:57
dp.py
import argparse
import json
import numpy as np
from tqdm import tqdm
class Node(object):
def __init__(self, id, parent, label, depth=None):
@mrdrozdov
mrdrozdov / trees.py
Last active October 26, 2018 16:16
useful tree methods
"""
A tree is a nested tuple representation.
tree = ('A', ('B', 'C'))
It can also be represented as a set of spans.
tree_spans = get_spans(tree) # {(0, 3), (1, 3)}
Sometimes you need to convert a string into a tree.
tree_str = '( A ( B C ) )'
tokens, transitions = convert_binary_bracketing(tree_str)
@mrdrozdov
mrdrozdov / mysql-notes.md
Created October 23, 2018 01:44
mysql-notes
@mrdrozdov
mrdrozdov / profile.txt
Created October 12, 2018 05:25
profile.txt
tensor 1 13.868us 12.288us
_unsafe_view 9 68.084us 61.634us
t 9 88.332us 88.192us
split 9 141.167us 142.527us
exp 9 143.811us 146.658us
th_sub 9 151.269us 172.068us
div 9 151.436us 172.991us
bmm 9 171.693us 195.647us
max 9 198.883us 202.752us
chunk 9 240.174us 238.307us
@mrdrozdov
mrdrozdov / demo_embeddings.py
Last active October 1, 2018 15:00
check pin/multi-gpu with embeddings
import argparse
import json
import torch
import torch.nn as nn
from tqdm import tqdm
class Model(nn.Module):
@mrdrozdov
mrdrozdov / argparse.py
Created September 30, 2018 01:07
argparse snippet
import argparse
def run(options):
print(json.dumps(options.__dict__, sort_keys=True, indent=4))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--log', default=None, type=str)