Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --samples_per_plugin to specify explicit sampling counts #1138

Merged
merged 1 commit into from Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions tensorboard/backend/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@
_VALID_PLUGIN_RE = re.compile(r'^[A-Za-z0-9_.-]+$')


def tensor_size_guidance_from_flags(flags):
"""Apply user per-summary size guidance overrides."""

tensor_size_guidance = dict(DEFAULT_TENSOR_SIZE_GUIDANCE)
if not flags or not flags.samples_per_plugin:
return tensor_size_guidance

for token in flags.samples_per_plugin.split(','):
k, v = token.strip().split('=')
tensor_size_guidance[k] = int(v)

return tensor_size_guidance


def standard_tensorboard_wsgi(
logdir,
purge_orphaned_data,
Expand All @@ -90,13 +104,13 @@ def standard_tensorboard_wsgi(
reload_interval: The interval at which the backend reloads more data in
seconds. Zero means load once at startup; negative means never load.
plugins: A list of constructor functions for TBPlugin subclasses.
path_prefix: A prefix of the path when app isn't served from root.
db_uri: A String containing the URI of the SQL database for persisting
data, or empty for memory-only mode.
assets_zip_provider: See TBContext documentation for more information.
If this value is not specified, this function will attempt to load
the `tensorboard.default` module to use the default. This behavior
might be removed in the future.
path_prefix: A prefix of the path when app isn't served from root.
window_title: A string specifying the the window title.
max_reload_threads: The max number of threads that TensorBoard can use
to reload runs. Not relevant for db mode. Each thread reloads one run
Expand All @@ -110,7 +124,7 @@ def standard_tensorboard_wsgi(
assets_zip_provider = default.get_assets_zip_provider()
multiplexer = event_multiplexer.EventMultiplexer(
size_guidance=DEFAULT_SIZE_GUIDANCE,
tensor_size_guidance=DEFAULT_TENSOR_SIZE_GUIDANCE,
tensor_size_guidance=tensor_size_guidance_from_flags(flags),
purge_orphaned_data=purge_orphaned_data,
max_reload_threads=max_reload_threads)
db_module, db_connection_provider = get_database_info(db_uri)
Expand Down
10 changes: 10 additions & 0 deletions tensorboard/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@
'The max number of threads that TensorBoard can use to reload runs. Not '
'relevant for db mode. Each thread reloads one run at a time.')

tf.flags.DEFINE_string(
'samples_per_plugin', '', 'An optional comma separated list of '
'plugin_name=num_samples pairs to explicitly specify how many samples to '
'keep per tag for that plugin. For unspecified plugins, TensorBoard '
'randomly downsamples logged summaries to reasonable values to prevent '
'out-of-memory errors for long running jobs. This flag allows fine control '
'over that downsampling. Note that 0 means keep all samples of that type. '
'For instance, "scalars=500,images=0" keeps 500 scalars and all images. '
'Most users should not need to set this flag.')

FLAGS = tf.flags.FLAGS


Expand Down