wandb 0.13.10__py3-none-any.whl → 0.14.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +2 -3
- wandb/apis/__init__.py +1 -3
- wandb/apis/importers/__init__.py +4 -0
- wandb/apis/importers/base.py +312 -0
- wandb/apis/importers/mlflow.py +113 -0
- wandb/apis/internal.py +29 -2
- wandb/apis/normalize.py +6 -5
- wandb/apis/public.py +163 -180
- wandb/apis/reports/_templates.py +6 -12
- wandb/apis/reports/report.py +1 -1
- wandb/apis/reports/runset.py +1 -3
- wandb/apis/reports/util.py +12 -10
- wandb/beta/workflows.py +57 -34
- wandb/catboost/__init__.py +1 -2
- wandb/cli/cli.py +215 -133
- wandb/data_types.py +63 -56
- wandb/docker/__init__.py +78 -16
- wandb/docker/auth.py +21 -22
- wandb/env.py +0 -1
- wandb/errors/__init__.py +8 -116
- wandb/errors/term.py +1 -1
- wandb/fastai/__init__.py +1 -2
- wandb/filesync/dir_watcher.py +8 -5
- wandb/filesync/step_prepare.py +76 -75
- wandb/filesync/step_upload.py +1 -2
- wandb/integration/catboost/__init__.py +1 -3
- wandb/integration/catboost/catboost.py +8 -14
- wandb/integration/fastai/__init__.py +7 -13
- wandb/integration/gym/__init__.py +35 -4
- wandb/integration/keras/__init__.py +3 -3
- wandb/integration/keras/callbacks/metrics_logger.py +9 -8
- wandb/integration/keras/callbacks/model_checkpoint.py +9 -9
- wandb/integration/keras/callbacks/tables_builder.py +31 -19
- wandb/integration/kfp/kfp_patch.py +20 -17
- wandb/integration/kfp/wandb_logging.py +1 -2
- wandb/integration/lightgbm/__init__.py +21 -19
- wandb/integration/prodigy/prodigy.py +6 -7
- wandb/integration/sacred/__init__.py +9 -12
- wandb/integration/sagemaker/__init__.py +1 -3
- wandb/integration/sagemaker/auth.py +0 -1
- wandb/integration/sagemaker/config.py +1 -1
- wandb/integration/sagemaker/resources.py +1 -1
- wandb/integration/sb3/sb3.py +8 -4
- wandb/integration/tensorboard/__init__.py +1 -3
- wandb/integration/tensorboard/log.py +8 -8
- wandb/integration/tensorboard/monkeypatch.py +11 -9
- wandb/integration/tensorflow/__init__.py +1 -3
- wandb/integration/xgboost/__init__.py +4 -6
- wandb/integration/yolov8/__init__.py +7 -0
- wandb/integration/yolov8/yolov8.py +250 -0
- wandb/jupyter.py +31 -35
- wandb/lightgbm/__init__.py +1 -2
- wandb/old/settings.py +2 -2
- wandb/plot/bar.py +1 -2
- wandb/plot/confusion_matrix.py +1 -3
- wandb/plot/histogram.py +1 -2
- wandb/plot/line.py +1 -2
- wandb/plot/line_series.py +4 -4
- wandb/plot/pr_curve.py +17 -20
- wandb/plot/roc_curve.py +1 -3
- wandb/plot/scatter.py +1 -2
- wandb/proto/v3/wandb_server_pb2.py +85 -39
- wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v4/wandb_server_pb2.py +51 -39
- wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
- wandb/sdk/__init__.py +1 -3
- wandb/sdk/backend/backend.py +1 -1
- wandb/sdk/data_types/_dtypes.py +38 -30
- wandb/sdk/data_types/base_types/json_metadata.py +1 -3
- wandb/sdk/data_types/base_types/media.py +17 -17
- wandb/sdk/data_types/base_types/wb_value.py +33 -26
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +91 -125
- wandb/sdk/data_types/helper_types/classes.py +1 -1
- wandb/sdk/data_types/helper_types/image_mask.py +12 -12
- wandb/sdk/data_types/histogram.py +5 -4
- wandb/sdk/data_types/html.py +1 -2
- wandb/sdk/data_types/image.py +11 -11
- wandb/sdk/data_types/molecule.py +3 -6
- wandb/sdk/data_types/object_3d.py +1 -2
- wandb/sdk/data_types/plotly.py +1 -2
- wandb/sdk/data_types/saved_model.py +10 -8
- wandb/sdk/data_types/video.py +1 -1
- wandb/sdk/integration_utils/data_logging.py +5 -5
- wandb/sdk/interface/artifacts.py +288 -266
- wandb/sdk/interface/interface.py +2 -3
- wandb/sdk/interface/interface_grpc.py +1 -1
- wandb/sdk/interface/interface_queue.py +1 -1
- wandb/sdk/interface/interface_relay.py +1 -1
- wandb/sdk/interface/interface_shared.py +1 -2
- wandb/sdk/interface/interface_sock.py +1 -1
- wandb/sdk/interface/message_future.py +1 -1
- wandb/sdk/interface/message_future_poll.py +1 -1
- wandb/sdk/interface/router.py +1 -1
- wandb/sdk/interface/router_queue.py +1 -1
- wandb/sdk/interface/router_relay.py +1 -1
- wandb/sdk/interface/router_sock.py +1 -1
- wandb/sdk/interface/summary_record.py +1 -1
- wandb/sdk/internal/artifacts.py +1 -1
- wandb/sdk/internal/datastore.py +2 -3
- wandb/sdk/internal/file_pusher.py +5 -3
- wandb/sdk/internal/file_stream.py +22 -19
- wandb/sdk/internal/handler.py +5 -4
- wandb/sdk/internal/internal.py +1 -1
- wandb/sdk/internal/internal_api.py +115 -55
- wandb/sdk/internal/job_builder.py +1 -3
- wandb/sdk/internal/profiler.py +1 -1
- wandb/sdk/internal/progress.py +4 -6
- wandb/sdk/internal/sample.py +1 -3
- wandb/sdk/internal/sender.py +28 -16
- wandb/sdk/internal/settings_static.py +5 -5
- wandb/sdk/internal/system/assets/__init__.py +1 -0
- wandb/sdk/internal/system/assets/cpu.py +3 -9
- wandb/sdk/internal/system/assets/disk.py +2 -4
- wandb/sdk/internal/system/assets/gpu.py +6 -18
- wandb/sdk/internal/system/assets/gpu_apple.py +2 -4
- wandb/sdk/internal/system/assets/interfaces.py +50 -22
- wandb/sdk/internal/system/assets/ipu.py +1 -3
- wandb/sdk/internal/system/assets/memory.py +7 -13
- wandb/sdk/internal/system/assets/network.py +4 -8
- wandb/sdk/internal/system/assets/open_metrics.py +283 -0
- wandb/sdk/internal/system/assets/tpu.py +1 -4
- wandb/sdk/internal/system/assets/trainium.py +26 -14
- wandb/sdk/internal/system/system_info.py +2 -3
- wandb/sdk/internal/system/system_monitor.py +52 -20
- wandb/sdk/internal/tb_watcher.py +12 -13
- wandb/sdk/launch/_project_spec.py +54 -65
- wandb/sdk/launch/agent/agent.py +374 -90
- wandb/sdk/launch/builder/abstract.py +61 -7
- wandb/sdk/launch/builder/build.py +81 -110
- wandb/sdk/launch/builder/docker_builder.py +181 -0
- wandb/sdk/launch/builder/kaniko_builder.py +419 -0
- wandb/sdk/launch/builder/noop.py +31 -12
- wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +70 -20
- wandb/sdk/launch/environment/abstract.py +28 -0
- wandb/sdk/launch/environment/aws_environment.py +276 -0
- wandb/sdk/launch/environment/gcp_environment.py +271 -0
- wandb/sdk/launch/environment/local_environment.py +65 -0
- wandb/sdk/launch/github_reference.py +3 -8
- wandb/sdk/launch/launch.py +38 -29
- wandb/sdk/launch/launch_add.py +6 -8
- wandb/sdk/launch/loader.py +230 -0
- wandb/sdk/launch/registry/abstract.py +54 -0
- wandb/sdk/launch/registry/elastic_container_registry.py +163 -0
- wandb/sdk/launch/registry/google_artifact_registry.py +203 -0
- wandb/sdk/launch/registry/local_registry.py +62 -0
- wandb/sdk/launch/runner/abstract.py +1 -16
- wandb/sdk/launch/runner/{kubernetes.py → kubernetes_runner.py} +83 -95
- wandb/sdk/launch/runner/local_container.py +46 -22
- wandb/sdk/launch/runner/local_process.py +1 -4
- wandb/sdk/launch/runner/{aws.py → sagemaker_runner.py} +53 -212
- wandb/sdk/launch/runner/{gcp_vertex.py → vertex_runner.py} +38 -55
- wandb/sdk/launch/sweeps/__init__.py +3 -2
- wandb/sdk/launch/sweeps/scheduler.py +132 -39
- wandb/sdk/launch/sweeps/scheduler_sweep.py +80 -89
- wandb/sdk/launch/utils.py +101 -30
- wandb/sdk/launch/wandb_reference.py +2 -7
- wandb/sdk/lib/_settings_toposort_generate.py +166 -0
- wandb/sdk/lib/_settings_toposort_generated.py +201 -0
- wandb/sdk/lib/apikey.py +2 -4
- wandb/sdk/lib/config_util.py +4 -1
- wandb/sdk/lib/console.py +1 -3
- wandb/sdk/lib/deprecate.py +3 -3
- wandb/sdk/lib/file_stream_utils.py +7 -5
- wandb/sdk/lib/filenames.py +1 -1
- wandb/sdk/lib/filesystem.py +61 -5
- wandb/sdk/lib/git.py +1 -3
- wandb/sdk/lib/import_hooks.py +4 -7
- wandb/sdk/lib/ipython.py +8 -5
- wandb/sdk/lib/lazyloader.py +1 -3
- wandb/sdk/lib/mailbox.py +14 -4
- wandb/sdk/lib/proto_util.py +10 -5
- wandb/sdk/lib/redirect.py +15 -22
- wandb/sdk/lib/reporting.py +1 -3
- wandb/sdk/lib/retry.py +4 -5
- wandb/sdk/lib/runid.py +1 -3
- wandb/sdk/lib/server.py +15 -9
- wandb/sdk/lib/sock_client.py +1 -1
- wandb/sdk/lib/sparkline.py +1 -1
- wandb/sdk/lib/wburls.py +1 -1
- wandb/sdk/service/port_file.py +1 -2
- wandb/sdk/service/service.py +36 -13
- wandb/sdk/service/service_base.py +12 -1
- wandb/sdk/verify/verify.py +5 -7
- wandb/sdk/wandb_artifacts.py +142 -177
- wandb/sdk/wandb_config.py +5 -8
- wandb/sdk/wandb_helper.py +1 -1
- wandb/sdk/wandb_init.py +24 -13
- wandb/sdk/wandb_login.py +9 -9
- wandb/sdk/wandb_manager.py +39 -4
- wandb/sdk/wandb_metric.py +2 -6
- wandb/sdk/wandb_require.py +4 -15
- wandb/sdk/wandb_require_helpers.py +1 -9
- wandb/sdk/wandb_run.py +95 -141
- wandb/sdk/wandb_save.py +1 -3
- wandb/sdk/wandb_settings.py +149 -54
- wandb/sdk/wandb_setup.py +66 -46
- wandb/sdk/wandb_summary.py +13 -10
- wandb/sdk/wandb_sweep.py +6 -7
- wandb/sdk/wandb_watch.py +1 -1
- wandb/sklearn/calculate/confusion_matrix.py +1 -1
- wandb/sklearn/calculate/learning_curve.py +1 -1
- wandb/sklearn/calculate/summary_metrics.py +1 -3
- wandb/sklearn/plot/__init__.py +1 -1
- wandb/sklearn/plot/classifier.py +27 -18
- wandb/sklearn/plot/clusterer.py +4 -5
- wandb/sklearn/plot/regressor.py +4 -4
- wandb/sklearn/plot/shared.py +2 -2
- wandb/sync/__init__.py +1 -3
- wandb/sync/sync.py +4 -5
- wandb/testing/relay.py +11 -10
- wandb/trigger.py +1 -1
- wandb/util.py +106 -81
- wandb/viz.py +4 -4
- wandb/wandb_agent.py +50 -50
- wandb/wandb_controller.py +2 -3
- wandb/wandb_run.py +1 -2
- wandb/wandb_torch.py +1 -1
- wandb/xgboost/__init__.py +1 -2
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/METADATA +6 -2
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/RECORD +224 -209
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/WHEEL +1 -1
- wandb/sdk/launch/builder/docker.py +0 -80
- wandb/sdk/launch/builder/kaniko.py +0 -393
- wandb/sdk/launch/builder/loader.py +0 -32
- wandb/sdk/launch/runner/loader.py +0 -50
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/LICENSE +0 -0
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/entry_points.txt +0 -0
- {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/top_level.txt +0 -0
@@ -57,51 +57,34 @@ class BoundingBoxes2D(JSONMetadata):
|
|
57
57
|
wandb.init()
|
58
58
|
image = np.random.randint(low=0, high=256, size=(200, 300, 3))
|
59
59
|
|
60
|
-
class_labels = {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
"minX": 0.1,
|
74
|
-
"maxX": 0.2,
|
75
|
-
"minY": 0.3,
|
76
|
-
"maxY": 0.4
|
60
|
+
class_labels = {0: "person", 1: "car", 2: "road", 3: "building"}
|
61
|
+
|
62
|
+
img = wandb.Image(
|
63
|
+
image,
|
64
|
+
boxes={
|
65
|
+
"predictions": {
|
66
|
+
"box_data": [
|
67
|
+
{
|
68
|
+
# one box expressed in the default relative/fractional domain
|
69
|
+
"position": {"minX": 0.1, "maxX": 0.2, "minY": 0.3, "maxY": 0.4},
|
70
|
+
"class_id": 1,
|
71
|
+
"box_caption": class_labels[1],
|
72
|
+
"scores": {"acc": 0.2, "loss": 1.2},
|
77
73
|
},
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
"
|
82
|
-
"
|
83
|
-
|
84
|
-
|
85
|
-
{
|
86
|
-
# another box expressed in the pixel domain
|
87
|
-
"position": {
|
88
|
-
"middle": [150, 20],
|
89
|
-
"width": 68,
|
90
|
-
"height": 112
|
74
|
+
{
|
75
|
+
# another box expressed in the pixel domain
|
76
|
+
"position": {"middle": [150, 20], "width": 68, "height": 112},
|
77
|
+
"domain": "pixel",
|
78
|
+
"class_id": 3,
|
79
|
+
"box_caption": "a building",
|
80
|
+
"scores": {"acc": 0.5, "loss": 0.7},
|
91
81
|
},
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
99
|
-
},
|
100
|
-
# Log as many boxes an as needed
|
101
|
-
],
|
102
|
-
"class_labels": class_labels
|
103
|
-
}
|
104
|
-
})
|
82
|
+
# Log as many boxes an as needed
|
83
|
+
],
|
84
|
+
"class_labels": class_labels,
|
85
|
+
}
|
86
|
+
},
|
87
|
+
)
|
105
88
|
|
106
89
|
wandb.log({"driving_scene": img})
|
107
90
|
```
|
@@ -109,65 +92,50 @@ class BoundingBoxes2D(JSONMetadata):
|
|
109
92
|
### Log a bounding box overlay to a Table
|
110
93
|
<!--yeadoc-test:bb2d-image-with-labels-->
|
111
94
|
```python
|
112
|
-
|
113
95
|
import numpy as np
|
114
96
|
import wandb
|
115
97
|
|
116
98
|
wandb.init()
|
117
99
|
image = np.random.randint(low=0, high=256, size=(200, 300, 3))
|
118
100
|
|
119
|
-
class_labels = {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
"
|
140
|
-
"
|
141
|
-
"minY": 0.3,
|
142
|
-
"maxY": 0.4
|
101
|
+
class_labels = {0: "person", 1: "car", 2: "road", 3: "building"}
|
102
|
+
|
103
|
+
class_set = wandb.Classes(
|
104
|
+
[
|
105
|
+
{"name": "person", "id": 0},
|
106
|
+
{"name": "car", "id": 1},
|
107
|
+
{"name": "road", "id": 2},
|
108
|
+
{"name": "building", "id": 3},
|
109
|
+
]
|
110
|
+
)
|
111
|
+
|
112
|
+
img = wandb.Image(
|
113
|
+
image,
|
114
|
+
boxes={
|
115
|
+
"predictions": {
|
116
|
+
"box_data": [
|
117
|
+
{
|
118
|
+
# one box expressed in the default relative/fractional domain
|
119
|
+
"position": {"minX": 0.1, "maxX": 0.2, "minY": 0.3, "maxY": 0.4},
|
120
|
+
"class_id": 1,
|
121
|
+
"box_caption": class_labels[1],
|
122
|
+
"scores": {"acc": 0.2, "loss": 1.2},
|
143
123
|
},
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
"
|
148
|
-
"
|
149
|
-
|
150
|
-
|
151
|
-
{
|
152
|
-
# another box expressed in the pixel domain
|
153
|
-
"position": {
|
154
|
-
"middle": [150, 20],
|
155
|
-
"width": 68,
|
156
|
-
"height": 112
|
124
|
+
{
|
125
|
+
# another box expressed in the pixel domain
|
126
|
+
"position": {"middle": [150, 20], "width": 68, "height": 112},
|
127
|
+
"domain": "pixel",
|
128
|
+
"class_id": 3,
|
129
|
+
"box_caption": "a building",
|
130
|
+
"scores": {"acc": 0.5, "loss": 0.7},
|
157
131
|
},
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
},
|
166
|
-
# Log as many boxes an as needed
|
167
|
-
],
|
168
|
-
"class_labels": class_labels
|
169
|
-
}
|
170
|
-
}, classes=class_set)
|
132
|
+
# Log as many boxes an as needed
|
133
|
+
],
|
134
|
+
"class_labels": class_labels,
|
135
|
+
}
|
136
|
+
},
|
137
|
+
classes=class_set,
|
138
|
+
)
|
171
139
|
|
172
140
|
table = wandb.Table(columns=["image"])
|
173
141
|
table.add_data(img)
|
@@ -180,36 +148,35 @@ class BoundingBoxes2D(JSONMetadata):
|
|
180
148
|
# it here as _log_type, associate it in to_json
|
181
149
|
|
182
150
|
def __init__(self, val: dict, key: str) -> None:
|
183
|
-
"""
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
The readable name or id for this set of bounding boxes (e.g. predictions, ground_truth)
|
151
|
+
"""Initialize a BoundingBoxes object.
|
152
|
+
|
153
|
+
The input dictionary `val` should contain the keys:
|
154
|
+
box_data: a list of dictionaries, each of which describes a bounding box.
|
155
|
+
class_labels: (optional) A map of integer class labels to their readable
|
156
|
+
class names.
|
157
|
+
|
158
|
+
Each bounding box dictionary should contain the following keys:
|
159
|
+
position: (dictionary) the position and size of the bounding box.
|
160
|
+
domain: (string) One of two options for the bounding box coordinate domain.
|
161
|
+
class_id: (integer) The class label id for this box.
|
162
|
+
scores: (dictionary of string to number, optional) A mapping of named fields
|
163
|
+
to numerical values (float or int).
|
164
|
+
box_caption: (optional) The label text, often composed of the class label,
|
165
|
+
class name, and/or scores.
|
166
|
+
|
167
|
+
The position dictionary should be in one of two formats:
|
168
|
+
{"minX", "minY", "maxX", "maxY"}: (dictionary) A set of coordinates defining
|
169
|
+
the upper and lower bounds of the box (the bottom left and top right
|
170
|
+
corners).
|
171
|
+
{"middle", "width", "height"}: (dictionary) A set of coordinates defining
|
172
|
+
the center and dimensions of the box, with "middle" as a list [x, y] for
|
173
|
+
the center point and "width" and "height" as numbers.
|
174
|
+
Note that boxes need not all use the same format.
|
175
|
+
|
176
|
+
Args:
|
177
|
+
val: (dictionary) A dictionary containing the bounding box data.
|
178
|
+
key: (string) The readable name or id for this set of bounding boxes (e.g.
|
179
|
+
predictions, ground_truth)
|
213
180
|
"""
|
214
181
|
super().__init__(val)
|
215
182
|
self._val = val["box_data"]
|
@@ -308,7 +275,6 @@ class BoundingBoxes2D(JSONMetadata):
|
|
308
275
|
return True
|
309
276
|
|
310
277
|
def to_json(self, run_or_artifact: Union["LocalRun", "LocalArtifact"]) -> dict:
|
311
|
-
|
312
278
|
if isinstance(run_or_artifact, wandb.wandb_sdk.wandb_run.Run):
|
313
279
|
return super().to_json(run_or_artifact)
|
314
280
|
elif isinstance(run_or_artifact, wandb.wandb_sdk.wandb_artifacts.Artifact):
|
@@ -17,7 +17,7 @@ class Classes(Media):
|
|
17
17
|
_class_set: Sequence[dict]
|
18
18
|
|
19
19
|
def __init__(self, class_set: Sequence[dict]) -> None:
|
20
|
-
"""Classes is holds class metadata intended to be used in concert with other objects when visualizing artifacts
|
20
|
+
"""Classes is holds class metadata intended to be used in concert with other objects when visualizing artifacts.
|
21
21
|
|
22
22
|
Args:
|
23
23
|
class_set (list): list of dicts in the form of {"id":int|str, "name":str}
|
@@ -116,19 +116,19 @@ class ImageMask(Media):
|
|
116
116
|
_log_type = "mask"
|
117
117
|
|
118
118
|
def __init__(self, val: dict, key: str) -> None:
|
119
|
-
"""
|
119
|
+
"""Initialize an ImageMask object.
|
120
|
+
|
120
121
|
Arguments:
|
121
|
-
val: (dictionary)
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
The readable name or id for this mask type (e.g. predictions, ground_truth)
|
122
|
+
val: (dictionary) One of these two keys to represent the image:
|
123
|
+
mask_data : (2D numpy array) The mask containing an integer class label
|
124
|
+
for each pixel in the image
|
125
|
+
path : (string) The path to a saved image file of the mask
|
126
|
+
class_labels : (dictionary of integers to strings, optional) A mapping
|
127
|
+
of the integer class labels in the mask to readable class names.
|
128
|
+
These will default to class_0, class_1, class_2, etc.
|
129
|
+
|
130
|
+
key: (string)
|
131
|
+
The readable name or id for this mask type (e.g. predictions, ground_truth)
|
132
132
|
"""
|
133
133
|
super().__init__()
|
134
134
|
|
@@ -23,7 +23,7 @@ class Histogram(WBValue):
|
|
23
23
|
Examples:
|
24
24
|
Generate histogram from a sequence
|
25
25
|
```python
|
26
|
-
wandb.Histogram([1,2,3])
|
26
|
+
wandb.Histogram([1, 2, 3])
|
27
27
|
```
|
28
28
|
|
29
29
|
Efficiently initialize from np.histogram.
|
@@ -52,7 +52,6 @@ class Histogram(WBValue):
|
|
52
52
|
np_histogram: Optional["NumpyHistogram"] = None,
|
53
53
|
num_bins: int = 64,
|
54
54
|
) -> None:
|
55
|
-
|
56
55
|
if np_histogram:
|
57
56
|
if len(np_histogram) == 2:
|
58
57
|
self.histogram = (
|
@@ -88,7 +87,9 @@ class Histogram(WBValue):
|
|
88
87
|
return {"_type": self._log_type, "values": self.histogram, "bins": self.bins}
|
89
88
|
|
90
89
|
def __sizeof__(self) -> int:
|
91
|
-
"""
|
92
|
-
|
90
|
+
"""Estimated size in bytes.
|
91
|
+
|
92
|
+
Currently the factor of 1.7 is used to account for the JSON encoding. We use
|
93
|
+
this in tb_watcher.TBHistory.
|
93
94
|
"""
|
94
95
|
return int((sys.getsizeof(self.histogram) + sys.getsizeof(self.bins)) * 1.7)
|
wandb/sdk/data_types/html.py
CHANGED
wandb/sdk/data_types/image.py
CHANGED
@@ -34,13 +34,16 @@ if TYPE_CHECKING: # pragma: no cover
|
|
34
34
|
|
35
35
|
|
36
36
|
def _server_accepts_image_filenames() -> bool:
|
37
|
-
|
37
|
+
if util._is_offline():
|
38
|
+
return True
|
38
39
|
|
39
40
|
# Newer versions of wandb accept large image filenames arrays
|
40
41
|
# but older versions would have issues with this.
|
41
42
|
max_cli_version = util._get_max_cli_version()
|
42
43
|
if max_cli_version is None:
|
43
44
|
return False
|
45
|
+
from pkg_resources import parse_version
|
46
|
+
|
44
47
|
accepts_image_filenames: bool = parse_version("0.12.10") <= parse_version(
|
45
48
|
max_cli_version
|
46
49
|
)
|
@@ -435,9 +438,7 @@ class Image(BatchableMedia):
|
|
435
438
|
return json_dict
|
436
439
|
|
437
440
|
def guess_mode(self, data: "np.ndarray") -> str:
|
438
|
-
"""
|
439
|
-
Guess what type of image the np.array is representing
|
440
|
-
"""
|
441
|
+
"""Guess what type of image the np.array is representing."""
|
441
442
|
# TODO: do we want to support dimensions being at the beginning of the array?
|
442
443
|
if data.ndim == 2:
|
443
444
|
return "L"
|
@@ -452,9 +453,10 @@ class Image(BatchableMedia):
|
|
452
453
|
|
453
454
|
@classmethod
|
454
455
|
def to_uint8(cls, data: "np.ndarray") -> "np.ndarray":
|
455
|
-
"""
|
456
|
-
|
457
|
-
on the range [0,
|
456
|
+
"""Convert image data to uint8.
|
457
|
+
|
458
|
+
Convert floating point image on the range [0,1] and integer images on the range
|
459
|
+
[0,255] to uint8, clipping if necessary.
|
458
460
|
"""
|
459
461
|
np = util.get_module(
|
460
462
|
"numpy",
|
@@ -482,9 +484,7 @@ class Image(BatchableMedia):
|
|
482
484
|
key: str,
|
483
485
|
step: Union[int, str],
|
484
486
|
) -> dict:
|
485
|
-
"""
|
486
|
-
Combines a list of images into a meta dictionary object describing the child images.
|
487
|
-
"""
|
487
|
+
"""Combine a list of images into a meta dictionary object describing the child images."""
|
488
488
|
if TYPE_CHECKING:
|
489
489
|
seq = cast(Sequence["Image"], seq)
|
490
490
|
|
@@ -528,7 +528,7 @@ class Image(BatchableMedia):
|
|
528
528
|
]
|
529
529
|
else:
|
530
530
|
wandb.termwarn(
|
531
|
-
"Unable to log image array filenames. In some cases, this can prevent images from being"
|
531
|
+
"Unable to log image array filenames. In some cases, this can prevent images from being "
|
532
532
|
"viewed in the UI. Please upgrade your wandb server",
|
533
533
|
repeat=False,
|
534
534
|
)
|
wandb/sdk/data_types/molecule.py
CHANGED
@@ -21,8 +21,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
21
21
|
|
22
22
|
|
23
23
|
class Molecule(BatchableMedia):
|
24
|
-
"""
|
25
|
-
Wandb class for 3D Molecular data
|
24
|
+
"""Wandb class for 3D Molecular data.
|
26
25
|
|
27
26
|
Arguments:
|
28
27
|
data_or_path: (string, io)
|
@@ -103,8 +102,7 @@ class Molecule(BatchableMedia):
|
|
103
102
|
convert_to_3d_and_optimize: bool = True,
|
104
103
|
mmff_optimize_molecule_max_iterations: int = 200,
|
105
104
|
) -> "Molecule":
|
106
|
-
"""
|
107
|
-
Convert RDKit-supported file/object types to wandb.Molecule
|
105
|
+
"""Convert RDKit-supported file/object types to wandb.Molecule.
|
108
106
|
|
109
107
|
Arguments:
|
110
108
|
data_or_path: (string, rdkit.Chem.rdchem.Mol)
|
@@ -171,8 +169,7 @@ class Molecule(BatchableMedia):
|
|
171
169
|
convert_to_3d_and_optimize: bool = True,
|
172
170
|
mmff_optimize_molecule_max_iterations: int = 200,
|
173
171
|
) -> "Molecule":
|
174
|
-
"""
|
175
|
-
Convert SMILES string to wandb.Molecule
|
172
|
+
"""Convert SMILES string to wandb.Molecule.
|
176
173
|
|
177
174
|
Arguments:
|
178
175
|
data: (string)
|
wandb/sdk/data_types/plotly.py
CHANGED
@@ -71,8 +71,7 @@ SavedModelObjType = TypeVar("SavedModelObjType")
|
|
71
71
|
|
72
72
|
|
73
73
|
class _SavedModel(WBValue, Generic[SavedModelObjType]):
|
74
|
-
"""
|
75
|
-
inside of a W&B Artifact.
|
74
|
+
"""Internal W&B Artifact model storage.
|
76
75
|
|
77
76
|
_model_type_id: (str) The id of the SavedModel subclass used to serialize the model.
|
78
77
|
"""
|
@@ -184,7 +183,7 @@ class _SavedModel(WBValue, Generic[SavedModelObjType]):
|
|
184
183
|
return json_obj
|
185
184
|
|
186
185
|
def model_obj(self) -> SavedModelObjType:
|
187
|
-
"""
|
186
|
+
"""Return the model object."""
|
188
187
|
if self._model_obj is None:
|
189
188
|
assert self._path is not None, "Cannot load model object without path"
|
190
189
|
self._set_obj(self._deserialize(self._path))
|
@@ -195,19 +194,22 @@ class _SavedModel(WBValue, Generic[SavedModelObjType]):
|
|
195
194
|
# Methods to be implemented by subclasses
|
196
195
|
@staticmethod
|
197
196
|
def _deserialize(path: str) -> SavedModelObjType:
|
198
|
-
"""
|
197
|
+
"""Return the model object from a path. Allowed to throw errors."""
|
199
198
|
raise NotImplementedError
|
200
199
|
|
201
200
|
@staticmethod
|
202
201
|
def _validate_obj(obj: Any) -> bool:
|
203
|
-
"""
|
202
|
+
"""Validate the model object. Allowed to throw errors."""
|
204
203
|
raise NotImplementedError
|
205
204
|
|
206
205
|
@staticmethod
|
207
206
|
def _serialize(obj: SavedModelObjType, dir_or_file_path: str) -> None:
|
208
|
-
"""Save the model to disk.
|
209
|
-
|
210
|
-
|
207
|
+
"""Save the model to disk.
|
208
|
+
|
209
|
+
The method will receive a directory path which all files needed for
|
210
|
+
deserialization should be saved. A directory will always be passed if
|
211
|
+
_path_extension is an empty string, else a single file will be passed. Allowed
|
212
|
+
to throw errors.
|
211
213
|
"""
|
212
214
|
raise NotImplementedError
|
213
215
|
|
wandb/sdk/data_types/video.py
CHANGED
@@ -183,7 +183,7 @@ class Video(BatchableMedia):
|
|
183
183
|
return json_dict
|
184
184
|
|
185
185
|
def _prepare_video(self, video: "np.ndarray") -> "np.ndarray":
|
186
|
-
"""This logic was mostly taken from tensorboardX"""
|
186
|
+
"""This logic was mostly taken from tensorboardX."""
|
187
187
|
np = util.get_module(
|
188
188
|
"numpy",
|
189
189
|
required='wandb.Video requires numpy when passing raw data. To get it, run "pip install numpy".',
|
@@ -44,7 +44,7 @@ class ValidationDataLogger:
|
|
44
44
|
class_labels: Optional[List[str]] = None,
|
45
45
|
infer_missing_processors: bool = True,
|
46
46
|
) -> None:
|
47
|
-
"""
|
47
|
+
"""Initialize a new ValidationDataLogger.
|
48
48
|
|
49
49
|
Args:
|
50
50
|
inputs: A list of input vectors or dictionary of lists of input vectors
|
@@ -143,7 +143,7 @@ class ValidationDataLogger:
|
|
143
143
|
def make_predictions(
|
144
144
|
self, predict_fn: Callable
|
145
145
|
) -> Union[Sequence, Dict[str, Sequence]]:
|
146
|
-
"""
|
146
|
+
"""Produce predictions by passing `validation_inputs` to `predict_fn`.
|
147
147
|
|
148
148
|
Args:
|
149
149
|
predict_fn (Callable): Any function which can accept `validation_inputs` and produce
|
@@ -162,7 +162,7 @@ class ValidationDataLogger:
|
|
162
162
|
table_name: str = "validation_predictions",
|
163
163
|
commit: bool = True,
|
164
164
|
) -> wandb.data_types.Table:
|
165
|
-
"""
|
165
|
+
"""Log a set of predictions.
|
166
166
|
|
167
167
|
Intended usage:
|
168
168
|
|
@@ -221,7 +221,7 @@ def _make_example(data: Any) -> Optional[Union[Dict, Sequence, Any]]:
|
|
221
221
|
|
222
222
|
|
223
223
|
def _get_example_shape(example: Union[Sequence, Any]):
|
224
|
-
"""
|
224
|
+
"""Get the shape of an object if applicable."""
|
225
225
|
shape = []
|
226
226
|
if type(example) is not str and hasattr(example, "__len__"):
|
227
227
|
length = len(example)
|
@@ -232,7 +232,7 @@ def _get_example_shape(example: Union[Sequence, Any]):
|
|
232
232
|
|
233
233
|
|
234
234
|
def _bind(lambda_fn: Callable, **closure_kwargs: Any) -> Callable:
|
235
|
-
"""
|
235
|
+
"""Create a closure around a lambda function by binding `closure_kwargs` to the function."""
|
236
236
|
|
237
237
|
def closure(*args: Any, **kwargs: Any) -> Any:
|
238
238
|
_k = {}
|