Skip to content

Instantly share code, notes, and snippets.

def binop(fun: int, x: int, y: int) -> int:
val = (x << 1) + y
return (fun >> val) & 1
possible = set()
# h(x, g(y, z))
for h in range(16):
for g in range(16):
outputs = 0
for n in range(8):
# define hashes
GIT_HASH=0a7a9d10
QUILT_HASH=3722a498
DOCKER_HASH=sha256:8a4f4123c92a7fe2e8ca4c404094ab95dc1fb868ad077d2e084ba4082a5a29c1
# pull image
DOCKER_IMAGE=quiltdata/pytorch-detectron2-demo@${DOCKER_HASH}
docker pull ${DOCKER_IMAGE}
# run image (interactively for illustration)
nvidia-docker run -it \
--ulimit memlock=-1 \
# define hashes
GIT_HASH=0a7a9d10
QUILT_HASH=3722a498
DOCKER_HASH=sha256:8a4f4123c92a7fe2e8ca4c404094ab95dc1fb868ad077d2e084ba4082a5a29c1
# pull image
DOCKER_IMAGE=quiltdata/pytorch-detectron2-demo@${DOCKER_HASH}
docker pull ${DOCKER_IMAGE}
# run image (interactively for illustration)
nvidia-docker run -it \
--ulimit memlock=-1 \
pip install quilt3
# Note: installing COCO requires at least 21GB of disk
quilt3 install cv/coco2017 \
--top-hash 3722a4 \
--dest ./detectron2/datasets/coco/ \
--registry s3://quilt-ml
@akarve
akarve / code_samples.md
Created November 1, 2019 02:04 — forked from armandmcqueen/code_samples.md
[WIP] New API usecases and associated code samples

Quilt Package Usecases

Introduction

This document outlines several key use cases and proposes code samples to satisfy those usecases. Both usecases and code samples are open to discussion.

The document is about UX, not implementation. It does not go much into performance needs, but the expectation is that the implementation will be written such that any API we expose is as high-performance as possible.

API names are rough and will need to be improved.

def post_to_es(event_type, size, text, key, meta, version_id=''):
ES_HOST = os.environ['ES_HOST']
ES_INDEX = 'drive'
data = {
'type': event_type,
'size': size,
'text': text,
'key': key,
NB_VERSION = 4
def extract_text(notebook_str):
formatted = nbformat.reads(notebook_str, as_version=NB_VERSION)
text = []
for cell in formatted.get('cells', []):
if 'source' in cell and 'cell_type' in cell:
if cell['cell_type'] == 'code' or cell['cell_type'] == 'markdown':
text.append(cell['source'])
@akarve
akarve / indexer.py
Last active January 30, 2019 23:16
def handler(event, context):
for record in event['Records']:
try:
response = S3_CLIENT.get_object(Bucket=bucket, Key=key)
eventname = record['eventName']
bucket = unquote(record['s3']['bucket']['name'])
if eventname == 'ObjectRemoved:Delete':
event_type = 'Delete'
post_to_es(event_type, 0, '', key, {})
continue
@akarve
akarve / notebook.py
Last active July 24, 2018 07:26
Display images from a Quilt package
from quilt.data.robmarkcole import birds_vs_not_birds as birds
from quilt.asa.img import plot
%matplotlib inline
birds.birds(asa=plot())
@akarve
akarve / right-estimator-cheat-sheet.txt
Last active April 4, 2018 08:09
Choosing the right machine learning algorithm
Adapted from [scikit learn cheat sheet](http://scikit-learn.org/stable/tutorial/machine_learning_map/index.html).
* More than 50 samples?
* No
* Get more data
* Yes
* Predicting a category?
* No
* Predicting a quantity?
* No