Skip to content

Commit 202888d

Browse files
allow disabling embeddings event registration (#1585)
Co-authored-by: Saksham Sirohi <sakshamsirohi27@gmail.com>
1 parent f0684e6 commit 202888d

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ The function accepts the following arguments:
499499
- `labels`: a list of corresponding labels for the tensors provided for `features`
500500
- `data_getter=fn`: (optional) a function that takes as a parameter an index into the features array and returns a summary representation of the tensor. If this is set, `data_type` must also be set.
501501
- `data_type=str`: (optional) currently the only acceptable value here is `"html"`
502+
- `opts.register_embedding_events`: (optional) set to `False` to skip registering the default Python client event handler for hover previews and lasso drilldown. This leaves embeddings interaction events for external server or frontend code to handle.
502503

503504
We currently assume that there are no more than 10 unique labels, in the future we hope to provide a colormap in opts for other cases.
504505

py/visdom/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,12 +1675,10 @@ def embeddings(
16751675
endpoint="events",
16761676
)
16771677

1678-
# Register the handlers for managing this embeddings pane
1679-
# TODO allow disabling this in a way that pushes onus for calculating
1680-
# to the server or frontend client
1681-
self._register_embeddings(
1682-
features, labels, points, data_getter, data_type, win, env, opts
1683-
)
1678+
if opts.get("register_embedding_events", True):
1679+
self._register_embeddings(
1680+
features, labels, points, data_getter, data_type, win, env, opts
1681+
)
16841682
return win
16851683

16861684
@pytorch_wrap

0 commit comments

Comments
 (0)