Skip to content

Instantly share code, notes, and snippets.

View leanderme's full-sized avatar

Leander Melms leanderme

  • UKE
  • Hamburg, Germany
  • 15:56 (UTC +02:00)
View GitHub Profile
@optiluca
optiluca / cudnnlstm_to_lstm_repro.py
Created December 3, 2018 09:48
Repro for cudnnlstm_to_lstm failure
import numpy as np
from keras.layers.core import Dense, Activation, Dropout
from keras.layers import CuDNNLSTM, LSTM
from keras.models import Sequential
from keras.models import load_model
from keras import optimizers
from keras.engine.saving import preprocess_weights_for_loading
sample_size = 100
@alexeygrigorev
alexeygrigorev / create_python_files.sh
Last active August 16, 2022 15:34
tf.make_tensor_proto
pip install grpcio-tools
wget https://github.com/tensorflow/tensorflow/archive/v1.9.0.zip -O tf-190.zip
unzip tf-190.zip && rm tf-190.zip
wget https://github.com/tensorflow/serving/archive/1.9.0.zip -O tf-serving-190.zip
unzip tf-serving-190.zip && rm tf-serving-190.zip
mv serving-1.9.0/tensorflow_serving tensorflow-1.9.0
@melgor
melgor / check_model_at_cpy.ipynb
Last active June 25, 2021 04:32
How to restore CUDNNLSTM of TensorFlow at CPU device? So that it could be used in GPU, CPU or Mobile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created April 4, 2018 14:13
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@renexu
renexu / train.py
Created December 28, 2017 05:46
Keras HDF5Matrix and fit_generator for huge hdf5 dataset
import threading
from keras.applications.inception_v3 import InceptionV3
from keras.optimizers import Adam
from keras.utils.io_utils import HDF5Matrix
class threadsafe_iter:
"""Takes an iterator/generator and makes it thread-safe by
serializing call to the `next` method of given iterator/generator.
@joemarshall
joemarshall / CUDNNCompatibleGRU.py
Last active May 12, 2019 14:43
Bug in keras CUDNN weight ordering
# I just put this in so you can see why it matters
class CUDNNCompatible_GRUCell(keras.layers.Layer):
"""Cell class for the GRU layer which is compatible with CuDNN GRU cells (but doesn't require tensorflow/Cuda).
# Arguments
units: Positive integer, dimensionality of the output space.
activation: Activation function to use
(see [activations](../activations.md)).
If you pass None, no activation is applied
(ie. "linear" activation: `a(x) = x`).
'''Train MNIST with tfrecords yielded from a TF Dataset
In order to run this example you should first run 'mnist_to_tfrecord.py'
which will download MNIST data and serialize it into 3 tfrecords files
(train.tfrecords, validation.tfrecords, and test.tfrecords).
This example demonstrates the use of TF Datasets wrapped by a generator
function. The example currently only works with a fork of keras that accepts
`workers=0` as an argument to fit_generator, etc. Passing `workers=0` results
in the generator function being run on the main thread (without this various
@aallan
aallan / listen.py
Last active September 21, 2020 23:45
Example script using TensorFlow on the Raspberry Pi to listen for commands.
#!/usr/bin/env python3
# Copyright 2017 Google Inc.
#
# 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
@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active July 10, 2025 15:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras
@iteufel
iteufel / zipcodes.germany.sql
Created September 19, 2017 11:22
German Zip codes with coordinates and names
This file has been truncated, but you can view the full file.
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.7.16-0ubuntu0.16.04.1)
# Generation Time: 2016-12-21 12:35:15 +0000
# ************************************************************