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
# -*- encoding:utf-8 -*- | |
""" | |
@作者:Mr.zhang | |
@文件名:Data_replication_equalization.py | |
@时间:20-6-03 上午10:54 | |
@文档说明: | |
1. 使用pandas包 | |
2. 对csv文件的数据做数据均衡 | |
3. 通过复制的方式均衡数据 | |
""" |
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
FROM python:3.6.12-slim as builder | |
MAINTAINER zhanghao <zhanghao_3389@163.com> | |
RUN apt update \ | |
&& apt install -y ffmpeg libsm6 libxext6 | |
ENV EXTERNAL_PYPI_SERVER=https://mirrors.aliyun.com/pypi/simple/ | |
ENV MIRROR=mirrors.aliyun.com | |
ENV PATH="/opt/venv/bin:$PATH" |
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
docker run -it -p 8501:8501 \ | |
-v "$(pwd)/save_model:/models/docker_test" \ | |
-e MODEL_NAME=docker_test tensorflow/serving |
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
docker run --runtime=nvidia -it -p 8501:8501 \ | |
-v "$(pwd)/save_model:/models/docker_test" \ | |
-e MODEL_NAME=docker_test tensorflow/serving:latest-gpu |
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
saved_model_cli show --dir saved_model/0 --tag_set serve --signature_def serving_default |
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 keras | |
import os | |
import tensorflow as tf | |
from tensorflow.python.util import compat | |
from keras import backend as K | |
def export_savedmodel(model): | |
''' | |
传入keras model会自动保存为pb格式 | |
''' |
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 tensorflow as tf | |
# The export path contains the name and the version of the model | |
tf.keras.backend.set_learning_phase(0) # Ignore dropout at inference | |
model = tf.keras.models.load_model('./inception.h5') # 需要加载的模型路径 | |
export_path = '../my_image_classifier/1' # 将要导出模型的路径 | |
# Fetch the Keras session and save the model | |
# The signature definition is defined by the input and output tensors | |
# And stored with the default serving key |
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
docker run --rm -it --entrypoint bash nmtwizard/opennmt-tf | |
docker run -v $PWD:/root/data --rm -it --entrypoint bash nmtwizard/opennmt-tf |
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
from concurrent.futures import ThreadPoolExecutor | |
def run(msg): | |
pass | |
data = list() | |
with ThreadPoolExecutor() as executor: | |
for _ in tqdm(executor.map(run, data), total=len(data)): | |
pass |
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 fnmatch, os | |
def find(pattern, path): | |
result = [] | |
for root, dirs, files in os.walk(path): | |
for name in files: | |
if fnmatch.fnmatch(name, pattern): | |
result.append(os.path.join(root, name)) | |
return result |
OlderNewer