Skip to content

Instantly share code, notes, and snippets.

View aroraakshit's full-sized avatar
:octocat:

Akshit Arora aroraakshit

:octocat:
View GitHub Profile
@nikhilweee
nikhilweee / dummy_gpu.py
Created April 24, 2022 20:28
Run dummy GPU job whenever usage drops below 5%
import torch
import subprocess
import time
import logging
# Takes about 8GB
ndim = 25_000
logging.basicConfig(format='[%(asctime)s] %(filename)s [%(levelname).1s] %(message)s', level=logging.DEBUG)
def get_gpu_usage():
@mcarilli
mcarilli / nsight.sh
Last active April 9, 2024 08:28
Favorite nsight systems profiling commands for Pytorch scripts
# This isn't supposed to run as a bash script, i named it with ".sh" for syntax highlighting.
# https://developer.nvidia.com/nsight-systems
# https://docs.nvidia.com/nsight-systems/profiling/index.html
# My preferred nsys (command line executable used to create profiles) commands
#
# In your script, write
# torch.cuda.nvtx.range_push("region name")
# ...
@VibhuJawa
VibhuJawa / xgboost_working_example.ipynb
Last active February 14, 2020 00:19
xgboost_working_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukmanr
lukmanr / inference_tfserving.py
Created October 17, 2018 19:09
TF Model Optimization 5
def inference_tfserving(eval_data, batch=BATCH_SIZE,
repeat=1000, signature='predict'):
url = 'http://localhost:8501/v1/models/mnist_classifier:predict'
instances = [[float(i) for i in list(eval_data[img])] for img in range(batch)]
request_data = {'signature_name': signature,
'instances': instances}
time_start = datetime.utcnow()
for i in range(repeat):
@Hasil-Sharma
Hasil-Sharma / softmax.py
Last active March 30, 2019 21:13
Vectorized softmax calculation using numpy
import numpy as np
def softmax(x):
""" Compute the softmax for each row of the input x
Arguments:
x -- A N dimensional veector or M X N dimensional numpy matrix.
Return:
x -- modified x in-place
"""
@danisfermi
danisfermi / setupdb.md
Created December 15, 2017 23:00
Setup gdb on Mac OS Sierra/High Sierra

Here are the steps to installing and setting up GDB on Mac OS Sierra/High Sierra. Run brew install gdb. On starting gdb, you will get the following error:

Unable to find Mach task port for process-id 2133: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

To fix this error, follow the following steps:

@omoindrot
omoindrot / tensorflow_finetune.py
Last active February 25, 2024 15:00
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@karpathy
karpathy / min-char-rnn.py
Last active April 16, 2024 18:25
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@developius
developius / README.md
Last active February 29, 2024 20:24
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key: