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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
class SubspaceLinear(nn.Linear): | |
def forward(self, x: torch.Tensor) -> torch.Tensor: | |
""" | |
Forward pass for the BaseSubspaceLinear layer. Calls `subspace_weights` to sample from the subspace | |
and uses the corresponding weight and bias. |
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
learning_rate = 4e-4 | |
warmup_steps = 2000 | |
log_step_interval = 1 | |
eval_iters = 100 | |
save_step_interval = 1000 | |
eval_step_interval = 1000 | |
weight_decay = 1e-1 | |
beta1 = 0.9 | |
beta2 = 0.95 |
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 torch | |
from torchdiffeq import odeint | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from PIL import Image | |
import tqdm | |
import imageio | |
import os | |
# Load target image and preprocess it |
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
# Author Adam Hibble @algomancer | |
import torch | |
import torch.nn.functional as F | |
import torch.nn as nn | |
import tqdm | |
def get_padding(padding_type, kernel_size): | |
assert padding_type in ['SAME', 'VALID'] | |
if padding_type == 'SAME': | |
return tuple((k - 1) // 2 for k in kernel_size) |
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
# Install useful stuff | |
! apt install --yes ssh screen nano htop ranger git > /dev/null | |
# SSH setting | |
! echo "root:carbonara" | chpasswd | |
! echo "PasswordAuthentication yes" > /etc/ssh/sshd_config | |
! echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config | |
! echo "PermitRootLogin yes" >> /etc/ssh/sshd_config | |
! service ssh restart > /dev/null | |
# Download ngrok | |
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#define N 16 /* buffer size */ | |
int main(void) { | |
char name[N]; /* buffer */ | |
/* prompt user for name */ | |
printf("What's your name? "); |
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 torch.autograd import Variable | |
from torch.nn import functional as F | |
class SELU(nn.Module): | |
def __init__(self): |
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 logging | |
from logging.handlers import RotatingFileHandler | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def foo(): | |
app.logger.warning('A warning occurred (%d apples)', 42) |
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 IPython.display import Image, display, HTML | |
def strip_consts(graph_def, max_const_size=32): | |
"""Strip large constant values from graph_def.""" | |
strip_def = tf.GraphDef() | |
for n0 in graph_def.node: | |
n = strip_def.node.add() | |
n.MergeFrom(n0) | |
if n.op == 'Const': |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject" | |
], | |
"Resource": [ | |
"arn:aws:s3:::YOUR_S3_BUCKET_NAME/*" |
NewerOlder