Skip to content

Instantly share code, notes, and snippets.

View DeNeutoy's full-sized avatar

Mark Neumann DeNeutoy

View GitHub Profile
@DeNeutoy
DeNeutoy / scalar_mixing_weights.py
Last active November 21, 2016 20:59
Parameter Bottlenecks
import tensorflow as tf
def mix_models_scalar(linear_outputs, rnn_outputs, lstm_outputs):
# Generate scalar valued weights to combine outputs of a
# Linear RNN, vanilla RNN and LSTM. Each of the inputs to
# this function is a list of outputs from the respective model.
context_window_size = 20
all_model_outputs = [linear_outputs, rnn_outputs, lstm_outputs]
from mpmath import mp
mp.dps = 100
import torch
# Take some list of values that shrink to be really small in log space:
torch_lps = torch.log_softmax(-torch.arange(20.0, dtype=torch.float64), dim=0)
mpmath_lps = -torch.arange(20.0, dtype=torch.float64)
Z = sum([mp.exp(mp.mpf(mpmath_lps[i].item())) for i in range(len(mpmath_lps))])
@DeNeutoy
DeNeutoy / main.yml
Last active September 26, 2019 04:31
Github Actions gist
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
@DeNeutoy
DeNeutoy / snli_20.jsonl
Created October 18, 2019 19:20
Idea for new Allennlp Dataset and Iterator API
{"annotator_labels": ["neutral", "entailment", "neutral", "neutral", "neutral"], "captionID": "4705552913.jpg#2", "gold_label": "neutral", "pairID": "4705552913.jpg#2r1n", "sentence1": "Two women are embracing while holding to go packages.", "sentence1_binary_parse": "( ( Two women ) ( ( are ( embracing ( while ( holding ( to ( go packages ) ) ) ) ) ) . ) )", "sentence1_parse": "(ROOT (S (NP (CD Two) (NNS women)) (VP (VBP are) (VP (VBG embracing) (SBAR (IN while) (S (NP (VBG holding)) (VP (TO to) (VP (VB go) (NP (NNS packages)))))))) (. .)))", "sentence2": "The sisters are hugging goodbye while holding to go packages after just eating lunch.", "sentence2_binary_parse": "( ( The sisters ) ( ( are ( ( hugging goodbye ) ( while ( holding ( to ( ( go packages ) ( after ( just ( eating lunch ) ) ) ) ) ) ) ) ) . ) )", "sentence2_parse": "(ROOT (S (NP (DT The) (NNS sisters)) (VP (VBP are) (VP (VBG hugging) (NP (UH goodbye)) (PP (IN while) (S (VP (VBG holding) (S (VP (TO to) (VP (VB go) (NP (NNS packages)) (PP (IN af
@DeNeutoy
DeNeutoy / app.py
Created February 17, 2020 17:41
scispacy demo
import streamlit as st
import spacy
from spacy import displacy
import pandas as pd
from scispacy.umls_linking import UmlsEntityLinker
from scispacy.abbreviation import AbbreviationDetector
SPACY_MODEL_NAMES = ["en_core_sci_sm", "en_core_sci_md", "en_core_sci_lg"]