Skip to content

Instantly share code, notes, and snippets.

View bveeramani's full-sized avatar

Balaji Veeramani bveeramani

  • Anyscale
  • Berkeley, California
  • X @B4110G
View GitHub Profile
import torch.nn as nn
from ray.air import session
from ray.air.config import ScalingConfig
from ray.train.torch import TorchCheckpoint, TorchTrainer
class Identity(nn.Module):
def forward(self, x):
return x
from typing import Dict
import pandas as pd
import pyarrow
import ray
import tensorflow as tf
from ray.data.block import Block
from ray.data.datasource.file_based_datasource import FileBasedDatasource
@bveeramani
bveeramani / download_imagenet.sh
Last active March 6, 2022 19:49
A shell script that downloads ImageNet
# Download raw dataset
pip install --upgrade kaggle
mkdir -p ~/.kaggle
echo '{"username":"...","key":"..."}' > ~/.kaggle/kaggle.json
kaggle competitions download -c imagenet-object-localization-challenge -f imagenet_object_localization_patched2019.tar.gz
# Extract images
mkdir -p ~/data
mv imagenet_object_localization_patched2019.tar.gz data
cd ~/data
@bveeramani
bveeramani / comment.py
Last active March 11, 2022 07:36
Script to comment on all open Ray pull requests.
import time
from github import Github
MESSAGE = """
## :bangbang: ACTION REQUIRED :bangbang:
We've switched our code formatter from YAPF to Black (see #21311).
To prevent issues with merging your code, here's what you'll need to do:
@bveeramani
bveeramani / format-changed.sh
Last active January 20, 2022 16:50
Run this script to format your changed Python files with Black.
#!/usr/bin/env bash
# Move to top-level directory.
cd $(git rev-parse --show-toplevel)
BLACK_VERSION_REQUIRED="21.12b0"
# Check if Black exists
if ! [ -x "$(command -v black)" ]; then
echo "Black is not installed."
"""Checks which pull requests contain merge conflicts with Blackened code."""
import os
import shlex
import subprocess
import tempfile
import github
import tqdm