Skip to content

Instantly share code, notes, and snippets.

View .gitignore_global
.DS_store
### Jekyll ###
_site/
.sass-cache
.jekyll-metadata
Gemfile.lock
.jekyll-cache/
View sync_to_remote.sh
#!/usr/bin/env bash
# check color support
colors=$(tput colors)
if (($colors >= 8)); then
red='\033[0;31m'
nocolor='\033[00m'
else
red=
nocolor=
View getArticleText
function getArticleText() {
function textNodesUnder(node){
var all = [];
for (node=node.firstChild;node;node=node.nextSibling){
if (node.nodeType==3) all.push(node);
else all = all.concat(textNodesUnder(node));
}
return all;
}
let textNodes = textNodesUnder(document);
@christinakim
christinakim / pretty_print_parameters.py
Last active Nov 6, 2020
print trainable parameters by layer
View pretty_print_parameters.py
from prettytable import PrettyTable
def count_parameters(model):
table = PrettyTable(["Modules", "Parameters"])
total_params = 0
for name, parameter in model.named_parameters():
if not parameter.requires_grad: continue
param = parameter.numel()
table.add_row([name, param])
total_params+=param
View regex_to_mdfa.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.