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
| # mini_gpt2_torch.py | |
| # A minimal GPT-2–style decoder-only Transformer in PyTorch with explicit ops, | |
| # but autograd handles gradients and optimization. | |
| import math, time, random | |
| import torch |
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
| # ngram_lm.py | |
| # A pure-Python n-gram language model with interpolated Kneser–Ney smoothing. | |
| # No external libraries. Intended to make complexity explicit. | |
| from collections import Counter, defaultdict | |
| from functools import lru_cache |
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 pandas as pd | |
| import seaborn as sns | |
| import numpy as np | |
| from numpy.linalg import norm | |
| import matplotlib.pyplot as plt | |
| data_df = pd.read_csv('data/embedded_1k_reviews.csv') | |
| queries_df = pd.read_csv('data/queries.csv') | |
| data_df['ada_embedding'] = data_df.ada_embedding.apply(eval).apply(np.array) |
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
| #!/usr/bin/python | |
| import openai | |
| import json | |
| import os | |
| from datetime import datetime | |
| from PIL import Image | |
| import time | |
| import pandas as pd |
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
| #!/bin/bash | |
| PGPASSWORD="YOURPGPASSWORDHERE" | |
| MASTODON_SYSTEM_DIR=/opt/mastodon/public/system | |
| BACKUPS_DIR=/mnt/sda1/backups | |
| POSTGRES_DUMP_FILENAME=pg_dump_mastodon_backup.sqlc | |
| POSTGRES_DUMP_PATH=/bitnami/postgresql/${POSTGRES_DUMP_FILENAME} | |
| microk8s kubectl exec -it -n mastodon mastodon-postgresql-0 -- env PGPASSWORD="${PGPASSWORD}" pg_dump -U mastodon -d mastodon_production --format=c --file=${POSTGRES_DUM> | |
| microk8s kubectl cp -n mastodon mastodon-postgresql-0:${POSTGRES_DUMP_PATH} ${BACKUPS_DIR}/${POSTGRES_DUMP_FILENAME} | |
| PODNAME=$(microk8s kubectl get pod -n mastodon -l app.kubernetes.io/component=web -o name) |
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
| def mu_law(x, mu): | |
| return np.sign(x) * np.log(1 + mu * np.abs(x)) / np.log(1 + mu) | |
| # value shape is [batches, width, D] | |
| # filters shape is [width, D, C] | |
| def causal_atrous_conv1d(value, filters, rate, padding): | |
| # Using height in 2-D as the 1-D. | |
| value_2d = tf.expand_dims(value, 2) | |
| filters_2d = tf.expand_dims(filters, 1) | |
| # Note that for filters using 'SAME' padding, padding zeros are added to the end of the input. |
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
| tero@Curie:~$ cat /proc/cpuinfo | |
| processor : 0 | |
| vendor_id : GenuineIntel | |
| cpu family : 6 | |
| model : 60 | |
| model name : Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz | |
| stepping : 3 | |
| microcode : 0x19 | |
| cpu MHz : 898.515 | |
| cache size : 6144 KB |