Skip to content

Instantly share code, notes, and snippets.

View ben0it8's full-sized avatar

ben_oght_ah_eight ben0it8

  • Aignostics
  • Berlin
View GitHub Profile
@ben0it8
ben0it8 / app.py
Last active July 29, 2019 10:12
FastAPI app for IMDB Transformer
#!/usr/local/bin/python3
import logging, sys, os
logging.basicConfig(stream=sys.stdout,
format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.INFO)
import torch
import torch.nn.functional as F
from pytorch_transformers import BertTokenizer
from utils import TransformerWithClfHead
from types import SimpleNamespace
# Install training requirements
COPY docker-res/requirements.txt "/tmp/"
RUN pip install -r "tmp/requirements.txt"
# Install app requirements
RUN pip install --upgrade uvicorn fastapi
@ben0it8
ben0it8 / Dockerfile
Created July 30, 2019 11:49
dockerfile variables
# Set up paths
ENV RESOURCES_PATH="/resources" \
DATA_PATH="/data" \
LOG_PATH="/logs"
RUN \
mkdir -p $RESOURCES_PATH && \
mkdir -p $DATA_PATH && \
chmod -R a+rwx $DATA_PATH
@ben0it8
ben0it8 / Dockerfile
Created October 31, 2019 12:20
Ubuntu 18.04 + Python3.7 + tf1.5 + dali-nightly
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
WORKDIR /srv
RUN chmod 777 /tmp
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3.7 python3.7-dev python3-virtualenv