Skip to content

Instantly share code, notes, and snippets.

View gogasca's full-sized avatar

Gonzalo Gasca Meza gogasca

View GitHub Profile
@gogasca
gogasca / library_import_time.awk
Last active December 29, 2025 01:04
library_import_time.awk
function get_library_name(filepath, parts, i, n, lib_name) {
n = split(filepath, parts, "/");
for (i = 1; i <= n; i++) {
if ((parts[i] == "dist-packages" || parts[i] == "site-packages") && i < n) {
lib_name = parts[i+1];
sub(/-.*/, "", lib_name); # Clean up versioned names
return lib_name;
}
}
# Check for stdlib separately
@gogasca
gogasca / gist:e8dc9bf44129df34cbb16bf3afaa362a
Created May 15, 2021 00:18
Notebook Executor Operator
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
@gogasca
gogasca / proto2serve.py
Created September 23, 2018 07:39
Serving
import tensorflow as tf
import pickle
from utils import build_dict, build_prediction, batch_iter
with open('args.pickle', 'rb') as f:
args = pickle.load(f)
text = ["""australian foreign minister alexander downer called wednesday for
the reform of the un security council and expressed support for brazil ,
@gogasca
gogasca / freeze2proto.py
Created September 23, 2018 07:33
Freeze to Protobuff
import tensorflow as tf
SAVE_PATH = './saved_model/'
MODEL_NAME = 'test'
VERSION = 1
SERVE_PATH = './serve/{}/{}'.format(MODEL_NAME, VERSION)
checkpoint = tf.train.latest_checkpoint(SAVE_PATH)
tf.reset_default_graph()
@gogasca
gogasca / freeze.py
Created September 19, 2018 23:59
Freeze Graph
"""Freeze graph.
https://stackoverflow.com/questions/45864363/tensorflow-how-to-convert-meta-data-and-index-model-files-into-one-graph-pb
"""
import tensorflow as tf
import pickle
from model import Model
from utils import build_dict