Skip to main content

Tensorplex: distributed Tensorboard and distributed logging

Tensorplex is a multiplexed extension of the popular Tensorboard visualization tool. When you have a cluster, you can collect the learning curves from multiple running nodes and display them side-by-side on a single tensorboard web page.

Tensorplex makes extensive use of ZeroMQ under the hood, an efficient, robust, and lightweight distributed communication protocol.

Loggerplex is a subcomponent of Tensorplex that does lightweight distributed logging. It collects the real-time logs from multiple nodes and send them to a single master node for persistent book-keeping.

Tensorplex is not tied to Tensorflow and can be used with any machine learning frameworks that support numpy.

THIS DOC IS INCOMPLETE. MORE COMING SOON.

Installation

git clone https://github.com/StanfordVL/Tensorplex.git
pip install -e Tensorplex/

Demo

Go to Tensorplex/examples/. Change the tensorboard log folder in run_server.py script.

In one command line window, run python run_server.py. Then in another window, run python run_client.py. The server script should print out a list of dones.

Use tensorboard --logdir ~/Temp/tensorplex/ --port 8009 to view the results.

Manual

Tensorplex requires one long-running server script. Client scripts can connect and disconnect (e.g. client crashes) without impacting the server.

Tensorplex server

There are 3 steps to create the server script.

First, initialize a Tensorplex object with the root logging folder. Different clients will write to different sub-folders that are created automatically. max_processes is the number of processes that the server uses internally. Set it to 4 should be a sweet spot.

tplex = Tensorplex(
    '~/my/logging/folder',
    max_processes=4,
)

Second, register the client groups, which helps group Tensorflow curves into the same or different graph windows. The “client IDs” (explained later) in your client scripts must be consistent with the groups you register in the server.

There are 3 types of client groups:

  1. register_normal_group(name): each graph will have only one curve in a normal group.

  2. register_indexed_group(name, bin_size): each graph will have at most bin_size number of curves. Suppose you launch 42 agents with bin_size=10, the curves of agent 0-9 will be displayed in the same graph window; likewise, the curves of 10-19, 20-29, 30-39, 40-41 will be grouped in their respective graphs.

  3. register_combined_group(name, group_criterion): TODO

To register multiple groups, you can chain the commands:

(tplex
    .register_normal_group('learner')  # 1 curve per graph
    .register_indexed_group('agent', 8)  # 8 agent learning curves per graph
    .register_indexed_group('eval', 4)  # 4 eval curves per graph
    .register_combined_group('eval', get_eval_bin_name)
 )

Third, you specify a port and launch the server. The script will be blocking:

tplex.start_server(8008)
# block main thread forever

Tensorplex client

Every TensorplexClient object must have a client ID that looks like <group_name>/<client_name>, i.e. two string names separated by /.

client = TensorplexClient(
    client_id='agent/0',  # for indexed group
    # client_id='learner/system_stats',  # for normal group, here client_name is `system_stats`
    host='123.45.6.7',  # server address to connect
    port=8008,  # server port to connect
)

Then you can write statistics to TensorplexClient

# most fundamental method
client.add_scalar(tag, 3.1415, integer_step)
# add_scalars is equivalent to multiple add_scalar() in one line
client.add_scalars({tag: 3.1415, tag2: 2.71828, tag3: 42}, integer_step)

There are

Note that tag in add_scalar behaves differently for different client group types.

For normal group,

Release files for tensorplex 0.9.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensorplex 0.9.post1
File Size Uploaded
Tensorplex-0.9.post1.tar.gz 22.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tensorplex 0.9.post1
File Interpreter ABI Platform
Tensorplex-0.9.post1-py3-none-any.whl Python 3 none any Details

Total release size: 49.2 kB

Release files / Tensorplex-0.9.post1.tar.gz

Download URL Tensorplex-0.9.post1.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
37c44fa6618bb7f0fc5be236ef2dbfb891c81ddca379630198170709129a2170
BLAKE2b-256 checksum
How to use checksums
f0ebd94ee47b8b307294aa1439abe33c41ab8455c4b7eb150d5d84330cea3054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4

Release files / Tensorplex-0.9.post1-py3-none-any.whl

Download URL Tensorplex-0.9.post1-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
754385c2c9f85e02243d12377b2bab041f5d25dde79f55b6d4268e4ab91fa8f7
BLAKE2b-256 checksum
How to use checksums
6c65c84034380e9c58fd8aabded39f7ee8bdc770b1cbb9ea21e03d107e5fd411
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.9.post1 This release

2 release files

0.9

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page