This file contains hidden or 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 numpy as np | |
from numpy import ndarray | |
from chalk import * | |
from jaxtyping import Float | |
from chalk.transform import Batched | |
import numpy.random | |
def create_t_shaped_data(num_points: int) -> Float[ndarray, "num_points 2"]: | |
"""Create random 2D data points shaped like a T.""" |
This file contains hidden or 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
""" Some language modeling code. | |
python lm.py --model LstmLm --devid 1 --lr 0.01 --clip 2 --optim Adam --nlayers 2 --nhid 512 --dropout 0.5 --epochs 50 --bsz 128 --bptt 32 --tieweights | |
Train: 42.90723478099889, Valid: 75.74921810452948, Test: 72.84913233987702 | |
python lm.py --model NnLm --devid 3 --lr 0.001 --clip 0 --optim Adam --nlayers 2 --nhid 512 --dropout 0.5 --epochs 20 --bsz 64 --bptt 64 | |
Train: 71.58999479091389, Valid: 158.07431086368382, Test: 146.13046578572258 | |
Tested on torch.__version__ == 0.3.1b0+2b47480 |
This file contains hidden or 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 | |
from torch.autograd import Variable | |
q = Variable(torch.Tensor(5), requires_grad=True) | |
leaves = [Variable(torch.zeros(5, 5), requires_grad=True) for _ in range(10)] | |
intermediates = [l for i, l in enumerate(leaves)] | |
loss = sum(q * v * i for i, v in enumerate(intermediates)).sum() | |
# define a helper for dividing intermediates into groups | |
def group(l, group_size): |
This file contains hidden or 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 | |
from torch.autograd import Variable | |
leaves = [Variable(torch.zeros(5, 5), requires_grad=True) for _ in range(10)] | |
intermediates = [l + i for i, l in enumerate(leaves)] | |
loss = sum(v * i for i, v in enumerate(intermediates)).sum() | |
# define a helper for dividing intermediates into groups | |
def group(l, group_size): | |
"""Groups l into chunks of size group_size. |
This file contains hidden or 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
--------------------------------------------------------------------------- | |
Reviewer's Scores | |
--------------------------------------------------------------------------- | |
Appropriateness: 5 | |
Clarity: 5 | |
Originality: 3 | |
Soundness / Correctness: 4 | |
Impact of Ideas / Results: 4 | |
Meaningful Comparison: 4 |