Skip to content

Instantly share code, notes, and snippets.

View cemoody's full-sized avatar
👋

Christopher Erick Moody cemoody

👋
View GitHub Profile
def check_line_by_line(fn_result, fn_truth):
logger.info(f"Checking line by line in {fn_result} and {fn_truth}")
with open(fn_result, 'r') as results:
res = results.readlines()
with open(fn_truth, 'r') as truth:
tru = truth.readlines()
for i, (line_t, line_r) in enumerate(zip(tru, res)):
features = line_t.split('\x01')
@cemoody
cemoody / typecast.py
Last active September 22, 2022 18:33
from typing import get_type_hints
def cast(argname, value, hints):
""" Only cast arguments if type hints are available for them.
"""
if argname in hints:
expected_type = hints[argname]
if not issubclass(type(value), expected_type):
# Will throw type error if argument cannot be cast
from torch_trainer.trainer import Trainer
from torch_trainer.callbacks import rms_callback
from torch import nn
from torch.optim import Adam
import torch.nn.functional as F
import numpy as np
import pandas as pd
https://github.com/tensorboy/pytorch_Realtime_Multi-Person_Pose_Estimation
https://github.com/tensorboy/3d-pose-baseline
http://www.tvmlang.org/2017/10/06/nnvm-compiler-announcement.html
<!DOCTYPE html>
<html>
<head>
<title> Login to See Leaderboard </title>
</head>
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
@cemoody
cemoody / init.vim
Last active March 17, 2017 15:34
Neovim personal profile
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/Users/moody/.vim/bundles/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/Users/moody/.vim/bundles')
embeddings_mu = nn.Embedding(n_words, n_dim)
embeddings_lv = nn.Embedding(n_words, n_dim)
...
vector_mu = embeddings_mu(c_index)
vector_lv = embeddings_lv(c_index)
def normal(mu, lv):
random = torch.FloatTensor(std.size()).normal_()
return mu + random * torch.exp(0.5 * lv)
@cemoody
cemoody / model_wrapper.py
Created January 11, 2017 21:09
Chainer Model Wrapper
import chainer
from chainer import cuda
from chainer import training
from chainer.training import extensions
from chainer.datasets import TupleDataset
from chainer.iterators import SerialIterator
class Wrapper(object):
def __init__(self, model, batchsize=512, n_epochs=100, device=None,
'housing social issues, affordability, rent',
'computer hardware and monitors',
'math, language, meditation and education',
'cars and entertainment',
'bing, google, facebook, search engines',
'transportation and military',
'technology in the media and society',
'finance and bitcoin',
'higher education, business and grad schools',
'sleep, stimulants, and excercise',