Introduce an experimental CLI to help train TL programs using multipl… · DeepLearningCode/tensorlayer@fdea370 · GitHub
Skip to content

Commit fdea370

Browse files
authored
Introduce an experimental CLI to help train TL programs using multiple GPUs. (tensorlayer#287)
Introduce an experimental CLI to help train TL programs using multiple GPUs.
1 parent 21364aa commit fdea370

11 files changed

Lines changed: 226 additions & 7 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
File renamed without changes.

docs/index.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ method, this part of the documentation is for you.
5656
modules/distributed
5757
modules/db
5858

59+
60+
Command-line Reference
61+
----------------------
62+
63+
TensorLayer provides a handy command-line tool `tl` to perform some common tasks.
64+
65+
.. toctree::
66+
:maxdepth: 2
67+
68+
modules/cli
69+
70+
5971
Indices and tables
6072
==================
6173

docs/modules/cli.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CLI
2+
======
3+
4+
.. automodule:: tensorlayer.cli
5+
6+
.. automodule:: tensorlayer.cli.train

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ numpydoc
33
scipy
44
scikit-image
55
matplotlib
6+
pymongo
7+
sphinx

example/tutorial_imagenet_inceptionV3_distributed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def load_data(file, task_spec=None, batch_size=16, epochs=1, shuffle_size=0):
117117
dataset = dataset.shuffle(buffer_size=shuffle_size)
118118

119119
def _parse_example_fn(line):
120-
line_split = line.split(',')
120+
line_split = line.decode().split(',')
121121
filename = line_split[0]
122122
labels_names = line_split[1:]
123123
# labels

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
include_package_data=True,
1515
author='TensorLayer Contributors',
1616
author_email='hao.dong11@imperial.ac.uk',
17-
url = "https://github.com/zsdonghao/tensorlayer" ,
18-
license = "apache" ,
19-
packages = find_packages(),
17+
url="https://github.com/tensorlayer/tensorlayer",
18+
license="apache",
19+
packages=find_packages(),
2020
install_requires=install_requires,
21-
# scripts=['tutorial_mnist.py'],
22-
description = "Reinforcement Learning and Deep Learning Library for Researcher and Engineer.",
23-
keywords = "deep learning, reinforcement learning, tensorflow",
21+
scripts=[
22+
'tl',
23+
],
24+
description="Reinforcement Learning and Deep Learning Library for Researcher and Engineer.",
25+
keywords="deep learning, reinforcement learning, tensorflow",
2426
platform=['any'],
2527
)

tensorlayer/cli/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
The tensorlayer.cli module provides a command-line tool for some common tasks.
3+
"""

tensorlayer/cli/__main__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import argparse
2+
from tensorlayer.cli import train
3+
4+
if __name__ == "__main__":
5+
parser = argparse.ArgumentParser(prog='tl')
6+
subparsers = parser.add_subparsers(dest='cmd')
7+
train_parser = subparsers.add_parser('train', help='train a model using multiple local GPUs or CPUs.')
8+
train.build_arg_parser(train_parser)
9+
args = parser.parse_args()
10+
if args.cmd == 'train':
11+
train.main(args)
12+
else:
13+
parser.print_help()

tensorlayer/cli/train.py

Lines changed: 166 additions & 0 deletions

0 commit comments

Comments
 (0)