Skip to content

Instantly share code, notes, and snippets.

import random
print(random.rand(1))
@EnisBerk
EnisBerk / colab_ssh.py
Last active December 31, 2019 19:37
open ssh connection to colab notebook
import random, string, urllib.request, json, getpass
#Generate root password
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
Raw embeddings and merged by Average
Tag Songbird Water Bird Insect Running Water Rain Cable Wind Vehicle Aircraft
------------ ---------- ------------ -------- --------------- ------ ------- ------ --------- ----------
N. Neighbors 0.72 0.53 0.53 0.71 0.82 0.8 0.91 -1 0.5
Linear SVM 0.89 0.75 0.74 0.91 0.82 0.84 0.87 -1 0.059
RBF SVM 0.83 0.67 0.48 0.74 0.81 0.84 0.9 -1 0.87
Gaussian P. 0.87 0.65 0.72 0.94 0.8 0.91 0.91 -1 0.77
Decision T. 0.7 0.57 0.58 0.85 0.64 0.8 0.76 -1 0.5
Random F. 0.74 0.62 0.67 0.68 0.86 0.75 0.86 -1 0.34
NN 0.88 0.72 0.7 0.94 0.82 0.9
Average of 10 second, raw embeddings:
Tag N. Neighbors Linear SVM RBF SVM Gaussian P. Decision T. Random F. NN AdaBoost Naive B. QDA
------------- -------------- ------------ --------- ------------- ------------- ----------- ---- ---------- ---------- ------
Songbird 0.7 0.62 0.72 **0.74** 0.65 0.63 0.73 0.73 0.53 0.66
Water Bird 0.88 0.88 0.88 0.89 0.8 0.88**0.89** 0.87 0.4 0.88
Insect 0.81 0.84 0.89 0.87 0.8 0.85 0.87 0.88 0.44 0.84
Running Water 0.94 0.92 0.91 0.93 0.92 0.92 0.93 0.88 0.56 0.91
Rain 0.97 0.98 0.98 0.98 0.97 0.98 0.98 0.97 0.71 0.98
@EnisBerk
EnisBerk / tensor2tesnor.ipynb
Created August 17, 2019 01:58
tensor2tesnor tests
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
def init_bn(bn):
bn.weight.data.fill_(1.)
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
__weights_dict = dict()
def load_weights(weight_file):
if weight_file == None:
return
@EnisBerk
EnisBerk / test.py
Created November 29, 2018 01:09
Testing shared file-system initialization. I used container: paperspace/fastai:1.0-CUDA9.2-base
import os
import torch
import torch.distributed as dist
from torch.multiprocessing import Process
import argparse
import socket
import time
import requests
"""run.py:"""
#!/usr/bin/env python
import os
import torch
import torch.distributed as dist
from torch.multiprocessing import Process
def run(rank, size):
# tensor = torch.zeros(1)
#include<time.h>
#include <stdio.h>
cudaEvent_t start, stop;
float time2;
float total_time=0;
__global__
void saxpy(int n, float a, float *x, float *y)
{