Skip to content

Instantly share code, notes, and snippets.

View zzsza's full-sized avatar
🎯
Focusing

Sung Yun Byeon zzsza

🎯
Focusing
View GitHub Profile
@jorgemf
jorgemf / Dockerfile_TFserving_1_6
Last active July 19, 2018 14:07
Dockerfile to compile TensorFlow Serving 1.6 using GPU
# docker build --pull -t tf/tensorflow-serving --label 1.6 -f Dockerfile .
# export TF_SERVING_PORT=9000
# export TF_SERVING_MODEL_PATH=/tf_models/mymodel
# export CONTAINER_NAME=tf_serving_1_6
# CUDA_VISIBLE_DEVICES=0 docker run --runtime=nvidia -it -p $TF_SERVING_PORT:$TF_SERVING_PORT -v $TF_SERVING_MODEL_PATH:/root/tf_model --name $CONTAINER_NAME tf/tensorflow-serving /usr/local/bin/tensorflow_model_server --port=$TF_SERVING_PORT --enable_batching=true --model_base_path=/root/tf_model/
# docker start -ai $CONTAINER_NAME
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify # flask 사용
import json
import requests # requests 사용
app = Flask(__name__)
def validate(imp_uid):
# 1. 인증 토큰 발급 받기
access_token = ""
try:
@goodvc78
goodvc78 / instacart_data_exploratory.ipynb
Created June 26, 2017 16:20
instacart data exploatory
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

TensorFlow Serving in 10 minutes!

TensorFlow SERVING is Googles' recommended way to deploy TensorFlow models. Without proper computer engineering background, it can be quite intimidating, even for people who feel comfortable with TensorFlow itself. Few things that I've found particularly hard were:

  • Tutorial examples have C++ code (which I don't know)
  • Tutorials have Kubernetes, gRPG, Bezel (some of which I saw for the first time)
  • It needs to be compiled. That process takes forever!

After all, it worked just fine. Here I present an easiest possible way to deploy your models with TensorFlow Serving. You will have your self-built model running inside TF-Serving by the end of this tutorial. It will be scalable, and you will be able to query it via REST.

@savelee
savelee / Array.sql
Created February 22, 2017 09:43
BigQuery Array Struct example
#standardSQL
#Top two Hacker News articles by day
WITH TitlesAndScores AS (
SELECT
ARRAY_AGG(STRUCT(title,
score)) AS titles,
EXTRACT(DATE
FROM
time_ts) AS date
FROM
@bernhardschaefer
bernhardschaefer / spark-submit-streaming-yarn.sh
Last active March 21, 2022 05:04
spark-submit template for running Spark Streaming on YARN (referenced in https://www.inovex.de/blog/247-spark-streaming-on-yarn-in-production/)
#!/bin/bash
# Minimum TODOs on a per job basis:
# 1. define name, application jar path, main class, queue and log4j-yarn.properties path
# 2. remove properties not applicable to your Spark version (Spark 1.x vs. Spark 2.x)
# 3. tweak num_executors, executor_memory (+ overhead), and backpressure settings
# the two most important settings:
num_executors=6
executor_memory=3g
@rex-lin
rex-lin / iOS Retention - BigQuery - (Tableau)
Last active October 27, 2017 04:55
iOS Retention - BigQuery - (Tableau)
SELECT
a.date,
'iOS' AS platform,
COUNT(DISTINCT a.fullVisitorId) AS day0,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -1 DAY) THEN b.fullVisitorId ELSE NULL END) AS day1,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -7 DAY) THEN b.fullVisitorId ELSE NULL END) AS day7,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -14 DAY) THEN b.fullVisitorId ELSE NULL END) AS day14,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -30 DAY) THEN b.fullVisitorId ELSE NULL END) AS day30,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -60 DAY) THEN b.fullVisitorId ELSE NULL END) AS day60,
COUNT(DISTINCT CASE WHEN a.date = date_add(b.date, INTERVAL -90 DAY) THEN b.fullVisitorId ELSE NULL END) AS day90
# Name Type 1 Type 2 Total HP Attack Defense Sp. Atk Sp. Def Speed Generation Legendary
1 Bulbasaur Grass Poison 318 45 49 49 65 65 45 1 False
2 Ivysaur Grass Poison 405 60 62 63 80 80 60 1 False
3 Venusaur Grass Poison 525 80 82 83 100 100 80 1 False
3 VenusaurMega Venusaur Grass Poison 625 80 100 123 122 120 80 1 False
4 Charmander Fire 309 39 52 43 60 50 65 1 False
5 Charmeleon Fire 405 58 64 58 80 65 80 1 False
6 Charizard Fire Flying 534 78 84 78 109 85 100 1 False
6 CharizardMega Charizard X Fire Dragon 634 78 130 111 130 85 100 1 False
6 CharizardMega Charizard Y Fire Flying 634 78 104 78 159 115 100 1 False