Skip to content

Instantly share code, notes, and snippets.

View seanbradley's full-sized avatar

Sean Bradley seanbradley

View GitHub Profile
@ChrisHayduk
ChrisHayduk / merge_qlora_with_quantized_model.py
Last active September 19, 2024 11:41
Merging QLoRA weights with quantized model
"""
The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github.
Thanks for the contributions guys!
"""
import torch
import peft
@Ayke
Ayke / cuda-wsl2-ubuntu.md
Last active September 6, 2024 17:29
Everything About CUDA in WSL2 Ubuntu

Prerequisites, i.e. the most important things

  1. Time of writing: Jan 18, 2023. The following assume you're trying to install CUDA on WSL2 Ubuntu.

  2. Check support matrix first before you install any version of CUDA, because chances are the latest CUDA does not have cuDNN support yet, then you'll have to re-install older version if you found out later.

    https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html#cudnn-cuda-hardware-versions

    At the time of writing, the latest cuDNN version is 8.7 and it supports CUDA 11.8.

  3. Windows 10 must be build 20145 or later.

PS1='\[\033]0;WSL2 Bash\W\007\]' # set window title
PS1="$PS1"'\n' # new line
PS1="$PS1"'\[\033[36m\]' # change to green
PS1="$PS1"'bash@bexgboost ' # user@host<space>
PS1="$PS1"'\[\033[31m\]' # change to brownish yellow
PS1="$PS1"'\W' # current working directory
source /usr/lib/git-core/git-sh-prompt
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u:\[\033[01;31m\]\w\[\033[33m\]\$(__git_ps1)\[\033[33m\]"
@yassineAlouini
yassineAlouini / compare_dfs.py
Created July 4, 2017 13:50
Compare two Pandas DataFrames
import pandas as pd
def compare_two_dfs(input_df_1, input_df_2):
df_1, df_2 = input_df_1.copy(), input_df_2.copy()
ne_stacked = (df_1 != df_2).stack()
changed = ne_stacked[ne_stacked]
changed.index.names = ['id', 'col']
difference_locations = np.where(df_1 != df_2)
changed_from = df_1.values[difference_locations]
@aviskase
aviskase / Postman.desktop
Last active November 21, 2023 20:56
Install Postman
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/home/USERNAME/Postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
{
"CoolProp": "https://pypi.python.org/packages/17/71/0bfbaed4d1eeb0fd339827e203e8abfbb1b29c82e65bd25a87473fa275a0/CoolProp-6.0.0-cp27-cp27mu-manylinux1_x86_64.whl",
"Cython": "https://pypi.python.org/packages/7d/f1/ef21dc8cfc1deb5efc6d5260bcfe5892d0482972ab851ec577ad40bba67c/Cython-0.24.1-cp27-cp27mu-manylinux1_x86_64.whl",
"Pillow": "https://pypi.python.org/packages/f5/cc/6ed6df9eb1cbe0153e0897a62b6e72560faef13fa4891c143a965374ac4a/Pillow-3.4.1-cp27-cp27mu-manylinux1_x86_64.whl",
"PyLBFGS": "https://pypi.python.org/packages/82/3a/1f6eacc68ad1125efbdcd5dca004cf6ef3bbd3cafc28bb98e2d6b68a2bb0/PyLBFGS-0.2.0.3-cp27-cp27mu-manylinux1_x86_64.whl",
"Pygame": "https://pypi.python.org/packages/4c/91/531fa68e07c4a94a657177494688ef40c5a371a46e5ecb40c2175832d7ff/pygame-1.9.2b8-cp27-cp27mu-manylinux1_x86_64.whl",
"RelStorage": "https://pypi.python.org/packages/3a/a2/a4741cf61a9b0f0eb0f7cf343822602afa13911a43934fee2838f2ee4309/RelStorage-2.0.0b8-cp27-cp27mu-manylinux1_x86_64.whl",
"Shapely": "https://pypi.py
@seanbradley
seanbradley / ec2-host-from-tag-to-env-vars.sh
Created May 26, 2016 06:07 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active September 11, 2024 17:10
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@mrtns
mrtns / gist:78d15e3263b2f6a231fe
Last active September 20, 2024 17:28
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@twolfson
twolfson / README.md
Created February 23, 2015 22:45
Python unittest `setUp` inheritance

In some cases for Python unit tests, we want to automatically perform setUp methods in as declared in a base class. However, we still want setUp to work as per normal in the subclass. The following code will proxy the new setUp function to run it's base class' and the new one.

# Define a common test base for starting servers
class MyBaseTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        """On inherited classes, run our `setUp` method"""
        # Inspired via http://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class/17696807#17696807
        if cls is not MyBaseTestCase and cls.setUp is not MyBaseTestCase.setUp: