Skip to content

Instantly share code, notes, and snippets.

View sujee's full-sized avatar

Sujee Maniyam sujee

View GitHub Profile
#!/bin/bash
## usage:
## cluster-cmd.sh <-h hosts_file> [-u user] cmd
## cluster-cmd.sh -h hosts ls -la
function usage()
{
echo "usage : $0 -h <hosts file> [-u user] [-i ssh_key_file] cmd"
exit 1
#!/bin/bash
if [ -z "$1" ] ; then
echo "Usage: $0 <image name> [optional args for docker image]"
echo "Missing Docker image id. exiting"
exit 1
fi
#image_id="$1"
#shift
@sujee
sujee / run-reveal-in-docker.sh
Last active December 3, 2019 21:04
run-reveal-in-docker.sh
#!/bin/bash
## invoke with '-d' for dev mode
## this will mount utils directory from host for live debugging
port=2000
while getopts 'dp:' OPTION; do
case "$OPTION" in
d)
@sujee
sujee / cnn-mnist-1-train-gpu-minimal.py
Last active April 2, 2023 13:20
CNN model for mnist prediciton -- tweaked for Tensorflow2 GPU edition
#!/usr/bin/env python
## This CNN network to identify MNIST dataset
import time
import random
import numpy as np
from pprint import pprint
import os, sys
@sujee
sujee / cnn-mnist-1-train.ipynb
Created May 21, 2020 07:13
CNN for Mnist, tweaked for Tensorflow v2 GPU
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sujee
sujee / output
Created December 25, 2020 23:42
qa-allen-nlp.py
Loading models...
Loaded model 'transformer-qa' in 31,693.4 milli seconds
Loaded model 'bidaf-model' in 1,633.8 milli seconds
/Users/sujee/opt/anaconda3/envs/teachbot-nlp/lib/python3.7/site-packages/torch/nn/modules/container.py:435: UserWarning: Setting attributes on ParameterList is not supported.
warnings.warn("Setting attributes on ParameterList is not supported.")
Loaded model 'bidaf-elmo-model' in 13,811.0 milli seconds
quesion: Who stars in The Matrix?
model transformer-qa predicted in 794.4 milli seconds
answer: Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano
@sujee
sujee / spark-one-hot.py
Last active February 1, 2021 19:16
Spark one hot encoding sample
## Step 3 : encode the indexes into a vector
from pyspark.ml.feature import OneHotEncoder
encoder = OneHotEncoder(inputCols=["statusIndex"], outputCols=["statusVector"], dropLast=False)
encoded = encoder.fit(indexed).transform(indexed)
encoded.show()
# View dense vectors in pandas
encoded_pd = encoded.toPandas()
print(encoded_pd)