#Non-mathematical Introductions
- http://gcn.com/articles/2014/01/09/topographical-data-analysis.aspx
- https://www.simonsfoundation.org/quanta/20131004-the-mathematical-shape-of-things-to-come/
#Videos
#Non-mathematical Introductions
#Videos
import json, re | |
import urllib2 | |
from urlparse import urlparse | |
from urllib import urlopen, urlencode | |
class UKParliamentReader(): | |
""" | |
Chat to the UK Parliament API | |
""" |
## Weight norm is now added to pytorch as a pre-hook, so use that instead :) | |
import torch | |
import torch.nn as nn | |
from torch.nn import Parameter | |
from functools import wraps | |
class WeightNorm(nn.Module): | |
append_g = '_g' | |
append_v = '_v' |
import logging | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow.contrib import layers | |
GO_TOKEN = 0 | |
END_TOKEN = 1 | |
UNK_TOKEN = 2 |
import torch | |
import torch.nn as nn | |
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence | |
seqs = ['gigantic_string','tiny_str','medium_str'] | |
# make <pad> idx 0 | |
vocab = ['<pad>'] + sorted(set(''.join(seqs))) | |
# make model |
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3""" | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data as mnist_data | |
from tensorflow.contrib import slim | |
from tensorflow.contrib.learn import ModeKeys | |
from tensorflow.contrib.learn import learn_runner | |
# Show debugging output |
If you are getting this in gdb on macOS while trying to run a program:
Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
gdbc
)### JHW 2018 | |
import numpy as np | |
import umap | |
# This code from the excellent module at: | |
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module | |
import random |
# So now you want to finetune that GPT-J-6B on a 3090/TITAN GPU ... okay | |
# More exploratory coding. It uses the Huggingface model port, deepspeed and reads all text/md files from a target directory | |
# It is a fragment of a larger system with remote editing, but that's another story | |
# This is the raw, training tester. Items to look out for: | |
# - uses DeepSpeed and has a DS config | |
# - to save space uses SGD instead of ADAM | |
# - uses gradient checkpointing | |
# - freezes 25% of the layers to fit | |
# Assumes you can already run https://gist.github.com/kinoc/2d636a68876cd3de7b6e9c9452b61089 |