Quick and Distributed TensorFlow command framework
Project description
# tensorflow-qnd
[![PyPI version](https://badge.fury.io/py/tensorflow-qnd.svg)](https://badge.fury.io/py/tensorflow-qnd)
[![Python versions](https://img.shields.io/pypi/pyversions/tensorflow-qnd.svg)]()
[![Build Status](https://travis-ci.org/raviqqe/tensorflow-qnd.svg?branch=master)](https://travis-ci.org/raviqqe/tensorflow-qnd)
[![License](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://unlicense.org)
Quick and Distributed TensorFlow command framework
tensorflow-qnd is a TensorFlow framework to create commands to experiment with
models on multiple computers.
While made to be used on multiple computers in a cluster, this library is also
useful to exploit multiple GPUs on a single machine.
## Installation
Python 3.5+ and TensorFlow 0.12+ are required.
```
$ pip3 install --user --upgrade tensorflow-qnd
```
## Usage
See [documentation](https://raviqqe.github.io/tensorflow-qnd/qnd).
## Examples
```python
import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature = lambda dtype: tf.FixedLenFeature([], dtype)
features = tf.parse_single_example(serialized, {
"image_raw": scalar_feature(tf.string),
"label": scalar_feature(tf.int64),
})
image = tf.decode_raw(features["image_raw"], tf.uint8)
image.set_shape([28**2])
return tf.to_float(image) / 255 - 0.5, features["label"]
def minimize(loss):
return tf.contrib.layers.optimize_loss(
loss,
tf.contrib.framework.get_global_step(),
0.01,
"Adam")
def model(image, number):
h = tf.contrib.layers.fully_connected(image, 64)
h = tf.contrib.layers.fully_connected(h, 10, activation_fn=None)
loss = tf.reduce_mean(
tf.nn.sparse_softmax_cross_entropy_with_logits(h, number))
predictions = tf.argmax(h, axis=1)
return predictions, loss, minimize(loss), {
"accuracy": tf.reduce_mean(tf.to_float(tf.equal(predictions, number)))
}
run = qnd.def_run()
def main():
run(model, read_file)
if __name__ == "__main__":
main()
```
See also [examples](examples) directory.
## License
[The Unlicense](https://unlicense.org)
[![PyPI version](https://badge.fury.io/py/tensorflow-qnd.svg)](https://badge.fury.io/py/tensorflow-qnd)
[![Python versions](https://img.shields.io/pypi/pyversions/tensorflow-qnd.svg)]()
[![Build Status](https://travis-ci.org/raviqqe/tensorflow-qnd.svg?branch=master)](https://travis-ci.org/raviqqe/tensorflow-qnd)
[![License](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://unlicense.org)
Quick and Distributed TensorFlow command framework
tensorflow-qnd is a TensorFlow framework to create commands to experiment with
models on multiple computers.
While made to be used on multiple computers in a cluster, this library is also
useful to exploit multiple GPUs on a single machine.
## Installation
Python 3.5+ and TensorFlow 0.12+ are required.
```
$ pip3 install --user --upgrade tensorflow-qnd
```
## Usage
See [documentation](https://raviqqe.github.io/tensorflow-qnd/qnd).
## Examples
```python
import logging
import qnd
import tensorflow as tf
logging.getLogger().setLevel(logging.INFO)
def read_file(filename_queue):
_, serialized = tf.TFRecordReader().read(filename_queue)
scalar_feature = lambda dtype: tf.FixedLenFeature([], dtype)
features = tf.parse_single_example(serialized, {
"image_raw": scalar_feature(tf.string),
"label": scalar_feature(tf.int64),
})
image = tf.decode_raw(features["image_raw"], tf.uint8)
image.set_shape([28**2])
return tf.to_float(image) / 255 - 0.5, features["label"]
def minimize(loss):
return tf.contrib.layers.optimize_loss(
loss,
tf.contrib.framework.get_global_step(),
0.01,
"Adam")
def model(image, number):
h = tf.contrib.layers.fully_connected(image, 64)
h = tf.contrib.layers.fully_connected(h, 10, activation_fn=None)
loss = tf.reduce_mean(
tf.nn.sparse_softmax_cross_entropy_with_logits(h, number))
predictions = tf.argmax(h, axis=1)
return predictions, loss, minimize(loss), {
"accuracy": tf.reduce_mean(tf.to_float(tf.equal(predictions, number)))
}
run = qnd.def_run()
def main():
run(model, read_file)
if __name__ == "__main__":
main()
```
See also [examples](examples) directory.
## License
[The Unlicense](https://unlicense.org)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tensorflow-qnd-0.0.5.tar.gz
(9.5 kB
view hashes)
Built Distributions
tensorflow_qnd-0.0.5-py3.5.egg
(25.2 kB
view hashes)
Close
Hashes for tensorflow_qnd-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d48008834166b44e2fb0cc8082c46e4646dc281d202bf20f78e6c54d4ebf7ba |
|
MD5 | f4d3941d36f8230462edd49b1574015e |
|
BLAKE2b-256 | 8990df653e1beb0c81e96edd66d4da82f789eb6f4bb1b7107d231bf5f54e5a7c |