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
# Model dir to save logs, ckpts, etc. in "gs://model_dir" format. | |
MODEL_DIR="gs://bigscience/experiment_d/multilingual_t0/test-run/model" | |
# Data dir to save the processed dataset in "gs://data_dir" format. | |
TFDS_DATA_DIR="gs://bigscience/experiment_d/multilingual_t0/test-run/data" | |
T5X_DIR=${HOME}"/t5x" # directory where the T5X repo is cloned. | |
python3 ${T5X_DIR}/t5x/train.py \ | |
--gin_file=${T5X_DIR}"/t5x/examples/t5/t5_1_1/examples/t5_1_1_base_wmt_finetune.gin" \ | |
--gin.MODEL_DIR="'${MODEL_DIR}'" \ |
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
git clone --branch=main https://github.com/google-research/t5x | |
cd t5x | |
python3 -m pip install -e . |
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
# Run flax mnist example (optional) | |
pip install --user tensorflow-datasets==3.1.0 ml_collections clu | |
git clone https://github.com/google/flax.git | |
pip install --user -e flax | |
cd flax/examples/mnist | |
mkdir /tmp/mnist | |
python3 main.py --workdir=/tmp/mnist --config=configs/default.py --config.learning_rate=0.05 --config.num_epochs=5 |
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
sudo apt-add-repository -r ppa:graphics-drivers/ppa | |
sudo apt update | |
sudo apt remove nvidia* | |
sudo apt autoremove | |
sudo apt-get install ubuntu-drivers-common | |
sudo ubuntu-drivers autoinstall | |
# sudo apt -f install | |
sudo apt install aptitude | |
sudo aptitude install nvidia-440 |
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
# Instructions for installing GCC 4.9 on various platforms. | |
# The commands show instructions for GCC 4.9, but any higher version will also work! | |
# Ubuntu (https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu/581497#581497) | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install gcc-4.9 g++-4.9 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 |
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 torch | |
import torch.nn.functional as F | |
# Inspired from Understanding and Improving Convolutional Neural Networks via Concatenated Rectified Linear Units | |
# https://arxiv.org/pdf/1603.05201.pdf | |
class CReLU(nn.Module): | |
def __init__(self, inplace=False): | |
super(CReLU, self).__init__() |
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 json | |
import base64 | |
IMAGE_FILE = "example.png" | |
with open(IMAGE_FILE, "rb") as image_file: | |
encoded_string = base64.b64encode(image_file.read()) | |
base64_string = encoded_string.decode('utf-8') | |
json_data = dumps({'image': base64_string}, indent=2) |