Skip to content

Instantly share code, notes, and snippets.

Hunan Rostomyan hunan-rostomyan

Block or report user

Report or block hunan-rostomyan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hunan-rostomyan
hunan-rostomyan / download_model.py
Created May 24, 2019
GPT-2 345M download_model fork
View download_model.py
import os
import sys
import requests
from tqdm import tqdm
if len(sys.argv) != 3:
print('You must enter the model name as a parameter, e.g.: download_model.py 117M')
sys.exit(1)
model = sys.argv[1]
@hunan-rostomyan
hunan-rostomyan / config.json
Last active May 24, 2019
GPT-2 345M Config
View config.json
{
"initializer_range": 0.02,
"layer_norm_epsilon": 1e-05,
"n_ctx": 1024,
"n_embd": 1024,
"n_head": 16,
"n_layer": 24,
"n_positions": 1024,
"vocab_size": 50257
}
View Example of analyzing Annotations.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hunan-rostomyan
hunan-rostomyan / complex_using_matrices.js
Last active Aug 13, 2017
Complex multiplication using Matrix multiplication
View complex_using_matrices.js
/* In a comment to Problem 6 of Linear Algebra Problem Book,
Halmos notes that the multiplication of complex numbers is a
special case of matrix multiplication via the representation
of complex number a + bi as the 2-by-2 matrix {{a, b}, {-b, a}}.
This is pretty nice because if we have a matrix data type with
a multiplication defined on it, we can just embed the complex
number in a matrix, multiply by another such embedding and
then extract the resulting complex number out.
@hunan-rostomyan
hunan-rostomyan / config_perplexity.ipynb
Last active Jan 11, 2017
Configuration vs Perplexity
View config_perplexity.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hunan-rostomyan
hunan-rostomyan / label2mat.m
Created Dec 26, 2016
One Hot Encoder/Decoder in Octave/Matlab
View label2mat.m
function mat = label2mat(label, size)
if ~exist('size', 'var') || isempty(size)
size = 10;
end
if label > size
error('Label (%d) should be < size (%d).', label, size);
end
@hunan-rostomyan
hunan-rostomyan / statistics.js
Last active Dec 25, 2017
Statistics (mean, variance, standard deviation, ...)
View statistics.js
function sum(arr) {
return arr.reduce((acm, cur) => acm + cur, 0);
}
function mean(xs, correction) {
var correction = correction || 0;
var total = xs.length - correction;
return sum(xs) / total;
}
View edit_distance.py
def memo(f):
"""Basic memoizer for positional parameters."""
table = {}
def _f(*args):
if (args) not in table:
table[(args)] = f(*args)
return table[(args)]
return _f
View countingsort.py
from collections import Counter
def sort(lst):
return [i for i, n in Counter(lst).items() for _ in range(n)]
@hunan-rostomyan
hunan-rostomyan / scan.js
Created Jul 20, 2016
Scan (prefix sum, cumulative sum, inclusive scan) in JavaScript
View scan.js
// What does scan*(id, op, arr) do?
//
// Given an identity element `id`, a binary associative
// operator `op`, and a list `arr`, returns a list of the
// same size where each item in that list is the op-sum
// of all previous items.
//
// E.g. sum(0, +, [3, 4]) => [(0 + 3), (3 + 4)]
// E.g. sum(1, *, [2, 5]) => [(1 * 2), (2 * 5)]
You can’t perform that action at this time.