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 ( | |
"log" | |
"math/rand" | |
"os" | |
"os/signal" | |
"sync" | |
"time" | |
) |
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
.highlight > pre > span, | |
.highlight > tbody > tr > td, | |
.highlight > table > tbody > tr > td, | |
.highlight > table > tbody > tr > td > span, | |
.jp-InputPrompt, .jp-OutputPrompt, | |
.CodeMirror-linenumber, | |
.preview > span, | |
.preview > span > span, | |
.line-number, |
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
[Unit] | |
Description=Keeps the ssh tunnel to %i open | |
After=network.target | |
[Service] | |
User=nizhib | |
Environment="AUTOSSH_PORT=0" | |
Environment="AUTOSSH_LOGFILE=/tmp/tunnel.%i.log" | |
Environment="AUTOSSH_PIDFILE=/tmp/tunnel.%i.pid" | |
Environment="SSH_OPTIONS=-o 'ServerAliveInterval=60' -o 'ServerAliveCountMax=3'" |
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 DataPrefetcher: | |
def __init__(self, loader, num_images=1, num_labels=1): | |
self.loader = iter(loader) | |
self.num_images = num_images | |
self.num_labels = num_labels | |
self.num_others = 1 | |
self.stream = torch.cuda.Stream() | |
self.mean = ( | |
torch.tensor([0.485 * 255, 0.456 * 255, 0.406 * 255]) |
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
*, a { | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-weight: 400; | |
} | |
h1, h2, h3, h4, h5, h6, | |
.blog .main-content-wrapper h4 a { | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-weight: 700; | |
} |
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 threading | |
import torch | |
from torch.nn.modules import Module | |
from torch.nn.parallel.scatter_gather import scatter_kwargs, gather | |
from torch.nn.parallel.replicate import replicate | |
from torch.nn.parallel.parallel_apply import parallel_apply | |
__all__ = ['DataParallelModel', 'DataParallelCriterion'] |
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__ = "nizhib" | |
import torch | |
from torch import nn | |
from torch.autograd import Variable | |
def conv3x3(in_channels, out_channels, dilation=1): | |
return nn.Conv2d(in_channels, out_channels, 3, padding=dilation, dilation=dilation) |
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 multiprocessing | |
import os | |
class MultiprocessPipeline(object): | |
""" | |
pipeline = MultiprocessPipeline(foo) | |
pipeline.start() | |
for a, b, c in something: | |
pipeline.put((a, b, c)) |