This TPU VM cheatsheet uses and was tested with the following library versions:
Library | Version |
---|---|
JAX | 0.3.25 |
FLAX | 0.6.4 |
Datasets | 2.10.1 |
Transformers | 4.27.1 |
# This is a new feature, so make sure to update to the latest version of transformers! | |
# You will also need to pip install tensorflow_text | |
import tensorflow as tf | |
from transformers import TFAutoModel, TFBertTokenizer | |
class EndToEndModel(tf.keras.Model): | |
def __init__(self, checkpoint): | |
super().__init__() |
This TPU VM cheatsheet uses and was tested with the following library versions:
Library | Version |
---|---|
JAX | 0.3.25 |
FLAX | 0.6.4 |
Datasets | 2.10.1 |
Transformers | 4.27.1 |
# adapted from https://web.archive.org/web/20200514221628/https://randomwalk.in/python/2019/10/27/Install-Python-copy.html | |
wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz | |
tar zxfv Python-3.6.10.tgz | |
rm Python-3.6.10.tgz | |
find ./Python-3.6.10/Python -type d | xargs chmod 0755 | |
cd Python-3.6.10 | |
./configure --prefix=$PWD/Python-3.6.10/Python | |
make | |
make install | |
export PATH=$CWD:$PATH # adds python3.6 to PATH |
This is a companion piece to my instructions on building TensorFlow from source. In particular, the aim is to install the following pieces of software
on an Ubuntu Linux system, in particular Ubuntu 20.04.
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import csv | |
import errno | |
import os | |
import re |
#!/bin/bash | |
# install CUDA Toolkit v8.0 | |
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
sudo dpkg -i ${CUDA_REPO_PKG} | |
sudo apt-get update | |
sudo apt-get -y install cuda |
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) |
Install Atom on your computer (https://atom.io)
Launch Atom, go in Preferences, then chose Install, search for "remote-atom", and install it
On the distant machine:
cd ~
wget https://raw.githubusercontent.com/aurora/rmate/master/rmate
chmod +x rmate