View scroll.pub
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 |
View lora.py
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( |
View k_armed_bandit.py
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 |
View scaleai2.py
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]: |
View .vimrc
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
au BufNewFile,BufRead *.py set tabstop=4 | |
au BufNewFile,BufRead *.py set softtabstop=4 | |
au BufNewFile,BufRead *.py set shiftwidth=4 | |
au BufNewFile,BufRead *.py set textwidth=79 | |
au BufNewFile,BufRead *.py set expandtab | |
au BufNewFile,BufRead *.py set autoindent | |
au BufNewFile,BufRead *.py set fileformat=unix | |
highlight BadWhitespace ctermbg=red guibg=red | |
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ |
View cpu_monitor.py
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 |
View style_loss.py
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
def style_loss(style_features, generated_features, J): | |
loss_style = 0. | |
for j in J: | |
gram_style = gram_matrix(style_features[j]) | |
gram_gen = gram_matrix(generated_features[j]) | |
loss_style += F.mse_loss(gram_gen, gram_style) | |
return loss_style |
View content_loss.py
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
def content_loss(content_features, generated_features, j): | |
loss_content = F.mse_loss(generated_features[j], content_features[j]) | |
return loss_content |
View gram_matrix.py
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
def gram_matrix(feature_map): | |
C, H, W = feature_map.size() | |
reshaped_map = feature_map.view(C, H*W) | |
G = reshaped_map.mm(reshaped_map.t()) / (C * H * W) | |
return G |
View query.go
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