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.nn as nn | |
import torch.nn.functional as F | |
import math | |
from typing import Optional, Tuple | |
class BertSelfAttention(nn.Module): | |
def __init__(self, config): | |
super().__init__() | |
if config.hidden_size % config.num_attention_heads != 0: |
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
puts 'Make sure to run this with sudo-rights!' unless Process::UID.eid == 0 | |
parser = begin | |
require 'chronic' | |
lambda{|s| Chronic.parse s} | |
rescue LoadError | |
STDERR.puts 'Warning: Gem "Chronic" not found. Using Time.parse instead!' | |
require 'time' | |
lambda{|s| Time.parse s} | |
end |
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
#!/bin/sh | |
# | |
# This Gist converts the Wall Street Journal part of the Penn Treebank | |
# (more specifically, sections 2–24) to CoNLL 2007 format using | |
# PennConverter. As suggested by the authors of PennConverter, the script | |
# first applies the NP bracketing patch by David Vadas. | |
# | |
# In order to make this script work, you will need the following files: | |
# | |
# * treebank-3.tar.gz, containing the standard distribution of the PTB |