Skip to content

Instantly share code, notes, and snippets.

View IamAdiSri's full-sized avatar
🎯
Focusing

Aditya Srivastava IamAdiSri

🎯
Focusing
View GitHub Profile
@IamAdiSri
IamAdiSri / average_checkpoints.py
Created April 11, 2022 09:54 — forked from ArtVanderlay/average_checkpoints.py
checkpoint averaging script for huggingface models in pytorch
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Slightly tweaked version of https://github.com/pytorch/fairseq/blob/master/scripts/average_checkpoints.py
# To work with Huggingface wav2vec2
import argparse
@IamAdiSri
IamAdiSri / Microsoft.PowerShell_profile.ps1
Created June 3, 2019 09:57
Windows PowerShell Profile Snippets
# Loads the Visual Studio Developer Command Prompt environment into Powershell
$installationPath = "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
set-content env:\"$name" $value
}
}
echo "> Visual Studio Developer Command Prompt loaded onto environment."
@IamAdiSri
IamAdiSri / jp.sh
Last active April 5, 2019 07:04
Remote Jupyter Notebook - Server to Client Reverse Tunneling Script
#!/bin/bash
if [ $# -lt 2 ] ; then
echo "jp.sh <port on server> <port n local>"
echo "example: sh jp.sh 8686 8989"
echo "jp.sh <port on server> <port on local> <local ip> <user name>"
echo "example: sh jp.sh 8686 8989 10.x.x.x username"
exit 1
fi
@IamAdiSri
IamAdiSri / Windows SSH Setup.md
Created January 3, 2019 09:50
Setup Windows to accept SSH connections and Tunneling

Windows SSH Setup

The steps to enable both SSH and tunneling/port forwarding are as follows:

  1. Open Settings > Update and Security > For Developers.
  2. Click on the radio button for Developer mode; this will open up your system's port 22 and allow the SSH broker to start listening for incoming connections.
  3. If you just switched to Developer mode, restart your computer, and then follow step 1 again.
  4. Under Device discovery turn on the option labeled Make your device visible to USB connections and your local network.
  5. Under Device discovery turn on the option labeled User OpenSSH (Beta) server for remote deployment.
@IamAdiSri
IamAdiSri / pickler.py
Last active July 15, 2020 01:56
Pickling objects in Python3
class Pickler():
"""
Conveniently pickle Python objects and load pickled objects.
"""
def save(self, obj, loc):
"""
INPUT:
obj = Python object to be pickled.
loc = Location where pickled object will be saved.
OUTPUT:
@IamAdiSri
IamAdiSri / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Last active May 9, 2022 22:08 — forked from evansneath/Python3 Virtualenv Setup
Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py