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
#!/bin/bash | |
TENSORFLOW_SERVING_VERSION=2.11.0 | |
TENSORFLOW_SERVING_HOSTNAME=serving | |
TENSORFLOW_SERVING_MODEL_NAME=test_model | |
INTRA_OP_PARALLELISM=2 | |
INTER_OP_PARALLELISM=2 | |
TENSORBOARD_LOGDIR="/tmp/tensorboard" | |
DOCKER_PROFILER_TAG=tensorboard_profiler:latest |
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 time | |
from memory_profiler import memory_usage | |
import logging | |
celery_logger = logging.getLogger('celery') | |
def track_celery(method): | |
""" |
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
# Copyright 2021 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 bz2 | |
import pickle | |
from django.conf import settings | |
from djang_redis import get_redis_connection | |
from tqdm import tqdm | |
from .constants import GOOGLE_WORD2VEC_MODEL_NAME | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# install job lib | |
from joblib import Parallel, delayed | |
import numpy as np | |
def myfun(p): | |
return np.linalg.norm(p[0]-p[1]) | |
X = [1,2,3,4] | |
Y = [6,4,8,1] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def _get_serve_tf_examples_fn(model, tf_transform_output): | |
model.tft_layer = tf_transform_output.transform_features_layer() | |
@tf.function | |
def serve_tf_examples_fn(serialized_tf_examples): | |
feature_spec = tf_transform_output.raw_feature_spec() | |
feature_spec.pop(_LABEL_KEY) | |
parsed_features = tf.io.parse_example(serialized_tf_examples, feature_spec) | |
transformed_features = model.tft_layer(parsed_features) |
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_hub as hub | |
BERT_TFHUB_URL = "https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/2" | |
bert_layer = hub.KerasLayer(handle=BERT_TFHUB_URL, trainable=True) | |
vocab_file_path = bert_layer.resolved_object.vocab_file.asset_path.numpy() |
NewerOlder