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)
[![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
```
def_run(batch_inputs=True, prepare_filename_queues=True)
Define `run()` function.
See also `help(def_run())`.
Args:
batch_inputs: If `True`, create batches from Tensors
returned from `train_input_fn()` and `train_input_fn()` and feed
them to a model.
prepare_filename_queues: If `True`, create filename queues for train
and eval data based on file paths specified by command line
arguments.
Returns:
`run()` function.
run(model_fn, train_input_fn, eval_input_fn=None)
Run `tf.contrib.learn.python.learn.learn_runner.run()`.
Args:
model_fn: A function to construct a model.
Types of its arguments must be one of the following:
`Tensor, ...`,
`Tensor, ..., mode=ModeKeys`.
Types of its return values must be one of the following:
`Tensor, Tensor, Operation, eval_metrics=dict<str, Tensor>`
(predictions, loss, train_op, and eval_metrics (if any)),
`ModelFnOps`.
train_input_fn, eval_input_fn: Functions to serve input Tensors
fed into the model. If `eval_input_fn` is `None`,
`train_input_fn` will be used instead.
Types of its arguments must be one of the following:
`QueueBase` (a filename queue),
`None` (No argument).
Types of its return values must be one of the following:
`Tensor, Tensor` (x and y),
`dict<str, Tensor>, dict<str, Tensor>`
(features and labels).
The keys of `dict` arguments must match with names of
`model_fn` arguments.
Returns:
Return value of `tf.contrib.learn.python.learn.learn_runner.run()`.
add_flag(name, *args, **kwargs)
Add a flag.
Args:
name: Flag name. Real flag name will be `"--{}".format(name)`.
*args, **kwargs: The rest arguments are the same as
`argparse.add_argument()`.
add_required_flag(name, *args, **kwargs)
Add a required flag.
Its interface is the same as `add_flag()` but `required=True` is set by
default.
```
## Examples
See [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)
[![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
```
def_run(batch_inputs=True, prepare_filename_queues=True)
Define `run()` function.
See also `help(def_run())`.
Args:
batch_inputs: If `True`, create batches from Tensors
returned from `train_input_fn()` and `train_input_fn()` and feed
them to a model.
prepare_filename_queues: If `True`, create filename queues for train
and eval data based on file paths specified by command line
arguments.
Returns:
`run()` function.
run(model_fn, train_input_fn, eval_input_fn=None)
Run `tf.contrib.learn.python.learn.learn_runner.run()`.
Args:
model_fn: A function to construct a model.
Types of its arguments must be one of the following:
`Tensor, ...`,
`Tensor, ..., mode=ModeKeys`.
Types of its return values must be one of the following:
`Tensor, Tensor, Operation, eval_metrics=dict<str, Tensor>`
(predictions, loss, train_op, and eval_metrics (if any)),
`ModelFnOps`.
train_input_fn, eval_input_fn: Functions to serve input Tensors
fed into the model. If `eval_input_fn` is `None`,
`train_input_fn` will be used instead.
Types of its arguments must be one of the following:
`QueueBase` (a filename queue),
`None` (No argument).
Types of its return values must be one of the following:
`Tensor, Tensor` (x and y),
`dict<str, Tensor>, dict<str, Tensor>`
(features and labels).
The keys of `dict` arguments must match with names of
`model_fn` arguments.
Returns:
Return value of `tf.contrib.learn.python.learn.learn_runner.run()`.
add_flag(name, *args, **kwargs)
Add a flag.
Args:
name: Flag name. Real flag name will be `"--{}".format(name)`.
*args, **kwargs: The rest arguments are the same as
`argparse.add_argument()`.
add_required_flag(name, *args, **kwargs)
Add a required flag.
Its interface is the same as `add_flag()` but `required=True` is set by
default.
```
## Examples
See [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.4.tar.gz
(8.5 kB
view hashes)
Built Distributions
tensorflow_qnd-0.0.4-py3.5.egg
(25.0 kB
view hashes)
Close
Hashes for tensorflow_qnd-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71df6395ba1b2d253e0a969db5045cc157458645e248234c7313cdc1f277d04 |
|
MD5 | 8a267329d6ae5164b4125f22ddf22220 |
|
BLAKE2b-256 | 80520df0e80253c725757990c4ca9e9ddfe810a84e27989a5d7b36ff51bf050b |