Skip to content

Instantly share code, notes, and snippets.

View vgel's full-sized avatar

Theia Vogel vgel

View GitHub Profile
@LevanKvirkvelia
LevanKvirkvelia / nanoBERT.py
Last active February 14, 2024 23:25
nanoBERT, inspired by @karpathy's nanoGPT
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:
@pachacamac
pachacamac / rtcalarm.rb
Last active January 22, 2016 03:39
Turns Your Laptop into an Alarm Clock While Putting It into Suspend
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
@khlmnn
khlmnn / wsj2conll.sh
Created July 3, 2014 12:42
Convert the Wall Street Journal section of the Penn Treebank to CoNLL format
#!/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