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
module MinContainer1 = struct | |
type 'a t = | |
{ cmp : 'a -> 'a -> int | |
; x : 'a option | |
} | |
let init cmp = { cmp; x = None } | |
let add { cmp; x } newx = | |
let x = |
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
/* Making matrix multiplication 10x faster by making it cache-aware. | |
$ gcc -O3 main.c && ./a.out | |
Slow: 4.142s | |
Fast: 0.482s | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
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
FROM tensorflow/tensorflow:1.13.2-py3 | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt update -y && apt upgrade -y && apt install git -y | |
RUN git clone https://github.com/openai/gpt-2 /gpt-2 | |
WORKDIR /gpt-2 | |
RUN python3 -m pip install --upgrade pip && python3 -m pip install -r requirements.txt | |
RUN python3 download_model.py 124M |
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
# usage: curl -s https://gist.githubusercontent.com/jaymody/762417819fa017d75ff0870aa9ff0f2b/raw/setup.sh | sudo bash | |
# update and upgrade | |
apt update -y && apt upgrade -y | |
# packages | |
apt install -y \ | |
ack \ | |
coreutils \ | |
curl \ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 json | |
import os | |
import cohere | |
import numpy as np | |
names = ["Vet", "Police", "Engineer"] | |
descriptions = [ | |
"Vets are like doctors but for animals.", | |
"Police protect and serve the community.", |
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
FROM nvcr.io/nvidia/pytorch:22.09-py3 | |
ENV DEBIAN_FRONTEND=noninteractive | |
# "essential" packages | |
RUN apt update -y && apt upgrade -y && apt install -y \ | |
apt-transport-https \ | |
build-essential \ | |
ca-certificates \ | |
coreutils \ |
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 jax | |
import jax.numpy as jnp | |
def forward_fn(params, X): | |
for W, b in params[:-1]: | |
X = jax.nn.relu(X @ W + b) | |
final_W, final_b = params[-1] | |
return X @ final_W + final_b |
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 math | |
def count_params( | |
N=6, | |
d_model=512, | |
d_ff=2048, | |
h=8, | |
d_k=64, | |
d_v=64, | |
vocab_size=37000, |
NewerOlder