A clean installation of Ubuntu 18.04.02 LTS was used.
This gist is an extension to the official docs, adding missing parts and instructions.
follow the pre-installation actions on:
fairseq-train qa_en_small-bin \ | |
--log-interval=10 \ | |
--log-format=json \ | |
--tensorboard-logdir=/users/tom/ed/sp/pretrain/tests/fairseq/bart_en_small/logs \ | |
--seed=1 \ | |
--cpu \ | |
--min-loss-scale=0.0001 \ | |
--model-parallel-size=1 \ | |
--criterion=cross_entropy \ |
A clean installation of Ubuntu 18.04.02 LTS was used.
This gist is an extension to the official docs, adding missing parts and instructions.
follow the pre-installation actions on:
from torch.optim import Optimizer | |
class AdamW(Optimizer): | |
""" | |
Implements Adam algorithm with weight decay fix in PyTorch | |
Paper: Fixing Weight Decay Regularization in Adam by Ilya Loshchilov, Frank Hutter | |
https://arxiv.org/abs/1711.05101 | |
""" | |
def __init__(self, params, lr, b1=0.9, b2=0.999, e=1e-8, l2=0, | |
vector_l2=False, max_grad_norm=-1, **kwargs): |
# MIT License | |
# | |
# Copyright (c) 2018 Yuze Huang (hi@yuzeh.com) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
import nrrd # pip install pynrrd | |
import nibabel as nib # pip install nibabel | |
import numpy as np | |
# load nrrd | |
_nrrd = nrrd.read('/path/to/nrrd.nrrd') | |
data = _nrrd[0] | |
header = _nrrd[1] | |
print data.shape, header |
def _sequence_mask(sequence_length, max_len=None): | |
if max_len is None: | |
max_len = sequence_length.data.max() | |
batch_size = sequence_length.size(0) | |
seq_range = torch.range(0, max_len - 1).long() | |
seq_range_expand = seq_range.unsqueeze(0).expand(batch_size, max_len) | |
seq_range_expand = Variable(seq_range_expand) | |
if sequence_length.is_cuda: | |
seq_range_expand = seq_range_expand.cuda() | |
seq_length_expand = (sequence_length.unsqueeze(1) |
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
def qlearning(env, policy, num_iter1, alpha, gamma): | |
actions = policy.actions | |
for i in xrange(len(policy.theta)): | |
policy.theta[i] = 0.1 | |
for iter1 in xrange(num_iter1): | |
s_f = env.reset() | |
a = policy.epsilon_greedy(s_f) | |
count = 0 | |
t = False |
# In[] | |
import gym | |
import numpy as np | |
import theano | |
import theano.tensor as T | |
import lasagne | |
import sklearn.preprocessing | |
np.set_printoptions(precision=2) |
#! /usr/bin/env python3 | |
"""Fixing bluetooth stereo headphone/headset problem in debian distros. | |
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197 | |
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone. | |
This will be only fixes the bluez5 problem mentioned above . | |
Licence: Freeware |