This is a guide on how to install Caffe for Ubuntu 16.04 and above, without GPU support (No CUDA required).
sudo apt-get install libopencv-dev python-opencv
| def pytorch_count_params(model): | |
| "count number trainable parameters in a pytorch model" | |
| total_params = sum(reduce( lambda a, b: a*b, x.size()) for x in model.parameters()) | |
| return total_params |
| import tensorflow as tf | |
| import numpy as np | |
| corpus_raw = 'He is the king . The king is royal . She is the royal queen ' | |
| # convert to lower case | |
| corpus_raw = corpus_raw.lower() | |
| words = [] | |
| for word in corpus_raw.split(): |
| #deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted | |
| # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
| # newer versions of the distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
| # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
| ## Major bug fix updates produced after the final release of the | |
| ## distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted |
| /* | |
| ##Device = Desktops | |
| ##Screen = 1281px to higher resolution desktops | |
| */ | |
| @media (min-width: 1281px) { | |
| /* CSS */ | |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
| In this case, in AWS Linux: | |
| yum-config-manager --enable epel | |
| yum install -y p7ip | |
| cp /usr/bin/7za /usr/bin/7z | |
| 7z |
| #!/bin/sh | |
| # | |
| # Setup a work space called `work` with two windows | |
| # first window has 3 panes. | |
| # The first pane set at 65%, split horizontally, set to api root and running vim | |
| # pane 2 is split at 25% and running redis-server | |
| # pane 3 is set to api root and bash prompt. | |
| # note: `api` aliased to `cd ~/path/to/work` | |
| # | |
| session="work" |
| #!/bin/bash | |
| # Script for installing tmux on systems where you don't have root access. | |
| # tmux will be installed in $HOME/local/bin. | |
| # It's assumed that wget and a C/C++ compiler are installed. | |
| # exit on error | |
| set -e | |
| TMUX_VERSION=1.8 |
| import time | |
| def highlight(element): | |
| """Highlights (blinks) a Selenium Webdriver element""" | |
| driver = element._parent | |
| def apply_style(s): | |
| driver.execute_script("arguments[0].setAttribute('style', arguments[1]);", | |
| element, s) | |
| original_style = element.get_attribute('style') | |
| apply_style("background: yellow; border: 2px solid red;") |