This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import os | |
import sys | |
import openai | |
import tiktoken | |
from termcolor import colored | |
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINhqM2fhXk0Qgl+6R9kPjJ/48ZrNcXjc/7zTn8oi88nH daniel@Daniels-MacBook-Pro.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoRAConv1DWrapper(nn.Module): | |
"""SimpleWrapper class that implements LoRA: Low-Rank Adaptation of Large Language Models. | |
Arxiv link: https://arxiv.org/abs/2106.09685""" | |
def __init__(self, conv1dmodule: transformers.pytorch_utils.Conv1D, lora_rank: int): | |
super().__init__() | |
self.base_module = conv1dmodule | |
d1, d2 = self.base_module.weight.size() | |
self.A = nn.Parameter( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import multiprocessing as mp | |
from functools import partial | |
import numpy as np | |
from scipy.stats import norm | |
import matplotlib.pyplot as plt | |
STEPS = 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### CuDNN Installation Script ### | |
### Download CuDNN from: https://developer.nvidia.com/cudnn ### | |
### Reference 1: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html ### | |
### Reference 2: https://stackoverflow.com/questions/42013316/after-building-tensorflow-from-source-seeing-libcudart-so-and-libcudnn-errors/44147506#44147506 ### | |
## Create variables | |
### CHANGE THESE ### | |
export cudnn_version=cudnn-8.0-linux-x64-v7.1 | |
export version=7.1.1 | |
export cuda_dir=/usr/local/cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from visdom import Visdom | |
import numpy as np | |
from time import sleep | |
import logging | |
from threading import Event | |
try: | |
import psutil | |
except ImportError: | |
logging.error("You must \"pip install psutil\"") | |
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Resource 1: https://golang.org/doc/install#install | |
# Resource 2: https://alexatnet.com/install-go-on-raspberry-pi/ | |
version="1.12" | |
machine=`uname -m` | |
bold=$(tput bold) | |
yellow=$(tput setaf 3) | |
green=$(tput setaf 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tput setaf 6; echo '#### Downloading and installing CUDA ####'; tput sgr0; | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin | |
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda-repo-ubuntu2004-11-0-local_11.0.2-450.51.05-1_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu2004-11-0-local_11.0.2-450.51.05-1_amd64.deb | |
sudo apt-key add /var/cuda-repo-ubuntu2004-11-0-local/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get -y install cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Full Example: https://gist.github.com/danielhavir/407a6cfd592dfc2ad1e23a1ed3539e07 | |
import os | |
from typing import Callable, List, Tuple, Generator, Dict | |
import torch | |
import torch.utils.data | |
from PIL.Image import Image as ImageType | |
def list_items_local(path: str) -> List[str]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"os/exec" |
NewerOlder