Skip to content

Instantly share code, notes, and snippets.

View t27's full-sized avatar

Tarang Shah t27

View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active June 29, 2024 07:00
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@t27
t27 / aws_terminator.py
Created May 6, 2021 04:01
Regularly Terminate AWS instances that are idle(<5% CPU Utilization) for the past 10 minutes
import json
import subprocess
import pendulum # pip install pendulum
# Note: This is a hacky, quick solution prototyped in less than an hour, the ideal solution would involve using boto3 and other best practices auth
# ensure that your AWS CLI is configured and has the keys and default region set up. This script works in the default region
instance_cmd = """
aws ec2 describe-instances \
@chabala
chabala / using-google-takeout.md
Last active June 28, 2024 11:37
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
@deval-maker
deval-maker / gist:01a75a16ac57d4897d39259bcdff776e
Last active October 20, 2020 04:22
How to setup remote ssh config
Run everything on host
$~/.ssh/config
Host <HostName>
HostName <HostIP>
User <username>
$ ssh-keygen
$ ssh-copy-id <HostName>
@t27
t27 / create_jupyter_kernel.sh
Created September 12, 2020 05:42
Create a Jupyter kernel from inside a Python environment
# ensure you have activated the environment
python -m ipykernel install --user --name my_env --display-name "Python (my_env)"
# this will create a Jupyter kernel called my_env that will use the python binary and the packages from the current project
@t27
t27 / visualise_tfrecord.ipynb
Last active November 18, 2020 07:36
Visualize a TFRecord for Tensorflow Object Detection Library
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@WillKoehrsen
WillKoehrsen / visualize_decision_tree.py
Last active May 24, 2024 23:59
How to visualize a single decision tree in Python
from sklearn.datasets import load_iris
iris = load_iris()
# Model (can also use single decision tree)
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(n_estimators=10)
# Train
model.fit(iris.data, iris.target)
# Extract single tree
@hereismari
hereismari / msi-gtx1060-ubuntu-18.04-deeplearning.md
Last active December 3, 2023 17:14
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow
@jorgemf
jorgemf / Dockerfile_TFserving_1_6
Last active July 19, 2018 14:07
Dockerfile to compile TensorFlow Serving 1.6 using GPU
# docker build --pull -t tf/tensorflow-serving --label 1.6 -f Dockerfile .
# export TF_SERVING_PORT=9000
# export TF_SERVING_MODEL_PATH=/tf_models/mymodel
# export CONTAINER_NAME=tf_serving_1_6
# CUDA_VISIBLE_DEVICES=0 docker run --runtime=nvidia -it -p $TF_SERVING_PORT:$TF_SERVING_PORT -v $TF_SERVING_MODEL_PATH:/root/tf_model --name $CONTAINER_NAME tf/tensorflow-serving /usr/local/bin/tensorflow_model_server --port=$TF_SERVING_PORT --enable_batching=true --model_base_path=/root/tf_model/
# docker start -ai $CONTAINER_NAME
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04