Skip to content

Instantly share code, notes, and snippets.

View iiSeymour's full-sized avatar
🧬

Chris Seymour iiSeymour

🧬
  • Oxford Nanopore Technologies
  • Oxford
  • X @iiSeymour
View GitHub Profile
>>> import numpy as np
>>> read = np.array([
[0., 97., 0., 0.,],
[0., 4., 4., 87.,],
[71., 10., 2., 6.,],
[8., 5., 65., 9.,],
[7., 62., 11., 6.,],
[4., 19., 7., 55.,],
[51., 9., 6., 17.,],
[15., 4., 49., 12.,],
@iiSeymour
iiSeymour / LSTM.py
Created March 8, 2023 13:55
LSTM.py
import torch
import time
torch.backends.cudnn.benchmark = True
BATCH_SIZE = 64
LAYER_SIZE = 384
TIME_SERIES_LEN = 1600
NUM_LAYERS = 5
WARMUP_ROUNDS = 5
BENCHMARK_ROUNDS = 10
@iiSeymour
iiSeymour / benchmark_separable_convs.py
Last active March 3, 2023 02:29
Compare 1D Separable Convolutions in PyTorch and Tensorflow
#!/usr/bin/env python
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
import torch
import numpy as np
import tensorflow as tf
from time import perf_counter
@iiSeymour
iiSeymour / model.py
Created June 27, 2019 14:04
Symbolic patching for exporting torch.{min,max} with onnx
import torch
import torch.onnx.symbolic
def sym_patch(func, op1, op2):
def replace(g, node, dim_or_y=None, keepdim=None):
ops = func(g, node, dim_or_y, keepdim)
if type(ops) == tuple:
if ops[0].node().kind() == "onnx::ATen":
dim = torch.onnx.symbolic._get_const(dim_or_y, 'i', 'dim')
#!/usr/bin/env python
#
# Short Python example of why `ls | wc -l` works by @iiSeymour
#
# try:
# python isatty.py
# and:
# python isatty.py | cat
#
# Explanation http://www.ginac.de/~kreckel/fileno/
@iiSeymour
iiSeymour / keybase.md
Created August 27, 2014 13:20
I am me.

Keybase proof

I hereby claim:

  • I am iiSeymour on github.
  • I am iiseymour (https://keybase.io/iiseymour) on keybase.
  • I have a public key whose fingerprint is 3589 AD45 A74E 7520 AD32 55FE ADB7 73F1 3207 A97E

To claim this, I am signing this object:

@iiSeymour
iiSeymour / boxplot.py
Last active August 29, 2015 14:05
Geckoboard Highchart Boxplot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
__URL__ = "http://push.geckoboard.com/v1/send/"
def push(chart, widgit_id, api_key):
@iiSeymour
iiSeymour / step.ipynb
Created June 4, 2014 16:46
mpld3 step
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iiSeymour
iiSeymour / NBA MVP 13-14
Created April 23, 2014 14:28
IPython Notebook looking at player statistics for the 2013/2014 season: http://nbviewer.ipython.org/gist/anonymous/11217426
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@iiSeymour
iiSeymour / logstash_trac.conf
Created October 19, 2013 23:57
Logstash configuration for filtering trac logs
filter {
grok {
type => "trac"
match => [ "message", "%{DATE-US} %{TIME},%{INT} Trac.%{WORD}. %{WORD:level}: %{GREEDYDATA:text}" ]
}
multiline {
type => "trac"
pattern => "%{DATE-US} %{TIME},%{INT} Trac.%{WORD}. ERROR: %{GREEDYDATA:text}"