This file contains hidden or 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
| #!/usr/bin/env python | |
| # Benchmark transferring data, part of troubleshooting https://github.com/tensorflow/tensorflow/issues/6116 | |
| # | |
| # Take a independent workers communicating with b parameter shards | |
| # Each worker tries to add to variables stored on parameter server as fast as | |
| # possible. | |
| # | |
| # macbook | |
| # ps=1: 1.6 GB/s | |
| # ps=2: 2.6 GB/s |
This file contains hidden or 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
| # convert yaml to json | |
| # pip3 install pyyaml | |
| # http://pyyaml.org/wiki/PyYAMLDocumentation | |
| # py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml | |
| # gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73 | |
| import yaml, json, sys | |
| sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2)) |
This file contains hidden or 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
| """ | |
| Beam decoder for tensorflow | |
| Sample usage: | |
| ``` | |
| from tf_beam_decoder import beam_decoder | |
| decoded_sparse, decoded_logprobs = beam_decoder( | |
| cell=cell, |
This file contains hidden or 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
| # Working example for my blog post at: | |
| # http://danijar.com/variable-sequence-lengths-in-tensorflow/ | |
| import functools | |
| import sets | |
| import tensorflow as tf | |
| from tensorflow.models.rnn import rnn_cell | |
| from tensorflow.models.rnn import rnn | |
| def lazy_property(function): |
This file contains hidden or 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
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
This file contains hidden or 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
| """ | |
| This is a batched LSTM forward and backward pass | |
| """ | |
| import numpy as np | |
| import code | |
| class LSTM: | |
| @staticmethod | |
| def init(input_size, hidden_size, fancy_forget_bias_init = 3): |
This file contains hidden or 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
| license: gpl-3.0 |
NewerOlder