Skip to content

Instantly share code, notes, and snippets.

🐺
∞ ☕

Jon Perl jperl

View GitHub Profile
View gist:6ce671ecb36cce99d41f6dc8964acf41
FLAGS = flags.FLAGS
if FLAGS.log_dir:
if not os.path.exists(FLAGS.log_dir):
os.makedirs(FLAGS.log_dir)
logging.get_absl_handler().use_absl_log_file()
@jperl
jperl / residual_network.py
Created Jan 12, 2019 — forked from mjdietzx/residual_network.py
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
View residual_network.py
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@jperl
jperl / bashrc
Last active Jan 4, 2019
ubuntu ml environment notes
View bashrc
# cuda
export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# python
alias env='source ./env/bin/activate'
@jperl
jperl / TroubleshootCUDA.md
Last active Aug 12, 2018
Troubleshooting Ubuntu 18.04 CUDA Install
View TroubleshootCUDA.md

"nvidia-smi has failed because it couldn't communicate with the NVIDIA driver"

@jperl
jperl / ray_tune_reporter_hook.py
Created Jul 7, 2018 — forked from sseveran/ray_tune_reporter_hook.py
A Tensorflow hook for reporting state to ray-tune
View ray_tune_reporter_hook.py
import six
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.training import training_util
from tensorflow.python.training.session_run_hook import SessionRunArgs
class RayTuneReportingHook(tf.train.SessionRunHook):
def __init__(self, params, reporter):
self.reporter = reporter
@jperl
jperl / sequence_fixed_len_numeric_column.py
Last active Jul 2, 2018
Sequence Fixed Length Numeric Column
View sequence_fixed_len_numeric_column.py
def sequence_fixed_len_numeric_column(key,
shape=(1, ),
default_value=0.,
dtype=dtypes.float32,
normalizer_fn=None):
shape = fc._check_shape(shape=shape, key=key)
if not (dtype.is_integer or dtype.is_floating):
raise ValueError('dtype must be convertible to float. ' 'dtype: {}, key: {}'.format(dtype, key))
if normalizer_fn is not None and not callable(normalizer_fn):
raise TypeError('normalizer_fn must be a callable. Given: {}'.format(normalizer_fn))
@jperl
jperl / stack.py
Last active Feb 7, 2018
stack past tensor slices
View stack.py
import numpy as np
import tensorflow as tf
def _stack_past(x, steps):
"""Stack the past data for each step.
Ex. x = [0, ..., 60]. steps = [10, 20]
Result [x, x[:-10], x[:-20]] normalized to the same shape
"""
# Sort the steps in ascending order [10, 20]
@jperl
jperl / mnist_estimator.py
Created Jan 6, 2018 — forked from peterroelants/mnist_estimator.py
Example using TensorFlow Estimator, Experiment & Dataset on MNIST data.
View mnist_estimator.py
"""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
@jperl
jperl / import-rds-certs.sh
Created Dec 28, 2017 — forked from shareefhiasat/import-rds-certs.sh
import RDS certificates to java keystore on alpine / osx
View import-rds-certs.sh
#!/usr/bin/env sh
#i tried it and working like charm just have to note make the file .sh chmod +x and you may need sudo to run with permission but be carefull with sudo
#be sure the $JAVA_HOME is configure correctly or make it static as commentedline 7 below
OLDDIR="$PWD"
if [ -z "$CACERTS_FILE" ]; then
# you should have java home configure to point for example /usr/lib/jvm/default-java/jre/lib/security/cacerts
CACERTS_FILE=$JAVA_HOME/jre/lib/security/cacerts
fi
@jperl
jperl / import-rds-certs.sh
Created Dec 28, 2017 — forked from shareefhiasat/import-rds-certs.sh
import RDS certificates to java keystore on alpine / osx
View import-rds-certs.sh
#!/usr/bin/env sh
#i tried it and working like charm just have to note make the file .sh chmod +x and you may need sudo to run with permission but be carefull with sudo
#be sure the $JAVA_HOME is configure correctly or make it static as commentedline 7 below
OLDDIR="$PWD"
if [ -z "$CACERTS_FILE" ]; then
# you should have java home configure to point for example /usr/lib/jvm/default-java/jre/lib/security/cacerts
CACERTS_FILE=$JAVA_HOME/jre/lib/security/cacerts
fi
You can’t perform that action at this time.