wandb 0.21.0__py3-none-win32.whl → 0.21.1__py3-none-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wandb/__init__.py +16 -14
- wandb/__init__.pyi +427 -450
- wandb/agents/pyagent.py +41 -12
- wandb/analytics/sentry.py +7 -2
- wandb/apis/importers/mlflow.py +1 -1
- wandb/apis/public/__init__.py +1 -1
- wandb/apis/public/api.py +526 -360
- wandb/apis/public/artifacts.py +204 -8
- wandb/apis/public/automations.py +19 -3
- wandb/apis/public/files.py +172 -33
- wandb/apis/public/history.py +67 -15
- wandb/apis/public/integrations.py +25 -2
- wandb/apis/public/jobs.py +90 -2
- wandb/apis/public/projects.py +130 -79
- wandb/apis/public/query_generator.py +11 -1
- wandb/apis/public/registries/registries_search.py +7 -15
- wandb/apis/public/reports.py +83 -5
- wandb/apis/public/runs.py +299 -105
- wandb/apis/public/sweeps.py +222 -22
- wandb/apis/public/teams.py +41 -4
- wandb/apis/public/users.py +45 -4
- wandb/beta/workflows.py +66 -30
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +80 -1
- wandb/env.py +8 -0
- wandb/errors/errors.py +4 -1
- wandb/integration/lightning/fabric/logger.py +3 -4
- wandb/integration/metaflow/__init__.py +6 -0
- wandb/integration/metaflow/data_pandas.py +74 -0
- wandb/integration/metaflow/errors.py +13 -0
- wandb/integration/metaflow/metaflow.py +205 -190
- wandb/integration/openai/fine_tuning.py +1 -2
- wandb/jupyter.py +5 -5
- wandb/plot/custom_chart.py +30 -7
- wandb/proto/v3/wandb_internal_pb2.py +280 -280
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_internal_pb2.py +280 -280
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_internal_pb2.py +280 -280
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v6/wandb_internal_pb2.py +280 -280
- wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +6 -0
- wandb/sdk/artifacts/_internal_artifact.py +19 -8
- wandb/sdk/artifacts/_validators.py +8 -0
- wandb/sdk/artifacts/artifact.py +106 -75
- wandb/sdk/data_types/audio.py +38 -10
- wandb/sdk/data_types/base_types/media.py +6 -56
- wandb/sdk/data_types/graph.py +48 -14
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
- wandb/sdk/data_types/helper_types/image_mask.py +1 -3
- wandb/sdk/data_types/histogram.py +34 -21
- wandb/sdk/data_types/html.py +35 -12
- wandb/sdk/data_types/image.py +104 -68
- wandb/sdk/data_types/molecule.py +32 -19
- wandb/sdk/data_types/object_3d.py +36 -17
- wandb/sdk/data_types/plotly.py +18 -5
- wandb/sdk/data_types/saved_model.py +4 -6
- wandb/sdk/data_types/table.py +59 -30
- wandb/sdk/data_types/video.py +53 -26
- wandb/sdk/integration_utils/auto_logging.py +2 -2
- wandb/sdk/internal/internal_api.py +6 -0
- wandb/sdk/internal/job_builder.py +6 -0
- wandb/sdk/launch/agent/agent.py +8 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
- wandb/sdk/launch/create_job.py +3 -1
- wandb/sdk/launch/inputs/internal.py +3 -4
- wandb/sdk/launch/inputs/schema.py +1 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
- wandb/sdk/launch/sweeps/scheduler.py +2 -3
- wandb/sdk/lib/asyncio_compat.py +3 -0
- wandb/sdk/lib/deprecate.py +1 -7
- wandb/sdk/lib/disabled.py +1 -1
- wandb/sdk/lib/hashutil.py +14 -1
- wandb/sdk/lib/module.py +7 -13
- wandb/sdk/lib/progress.py +0 -19
- wandb/sdk/lib/sock_client.py +0 -4
- wandb/sdk/wandb_init.py +66 -91
- wandb/sdk/wandb_login.py +18 -14
- wandb/sdk/wandb_metric.py +2 -0
- wandb/sdk/wandb_run.py +406 -414
- wandb/sdk/wandb_settings.py +130 -2
- wandb/sdk/wandb_setup.py +28 -28
- wandb/sdk/wandb_sweep.py +14 -13
- wandb/sdk/wandb_watch.py +4 -6
- wandb/sync/sync.py +10 -0
- wandb/util.py +57 -0
- wandb/wandb_run.py +1 -2
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/RECORD +95 -95
- wandb/vendor/pynvml/__init__.py +0 -0
- wandb/vendor/pynvml/pynvml.py +0 -4779
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,124 +1,67 @@
|
|
1
|
-
"""W&B Integration for Metaflow.
|
2
|
-
|
3
|
-
This integration lets users apply decorators to Metaflow flows and steps to automatically log parameters and artifacts to W&B by type dispatch.
|
4
|
-
|
5
|
-
- Decorating a step will enable or disable logging for certain types within that step
|
6
|
-
- Decorating the flow is equivalent to decorating all steps with a default
|
7
|
-
- Decorating a step after decorating the flow will overwrite the flow decoration
|
8
|
-
|
9
|
-
Examples can be found at wandb/wandb/functional_tests/metaflow
|
10
|
-
"""
|
11
|
-
|
12
1
|
import inspect
|
13
2
|
import pickle
|
14
3
|
from functools import wraps
|
15
4
|
from pathlib import Path
|
16
|
-
from typing import Union
|
5
|
+
from typing import Optional, Union
|
17
6
|
|
18
7
|
import wandb
|
19
8
|
from wandb.sdk.lib import telemetry as wb_telemetry
|
20
9
|
|
10
|
+
from . import errors
|
11
|
+
|
21
12
|
try:
|
22
13
|
from metaflow import current
|
23
14
|
except ImportError as e:
|
24
15
|
raise Exception(
|
25
|
-
"Error: `metaflow` not installed >> This integration requires metaflow!
|
16
|
+
"Error: `metaflow` not installed >> This integration requires metaflow!"
|
17
|
+
" To fix, please `pip install -Uqq metaflow`"
|
26
18
|
) from e
|
27
19
|
|
28
|
-
try:
|
29
|
-
from plum import dispatch
|
30
|
-
except ImportError as e:
|
31
|
-
raise Exception(
|
32
|
-
"Error: `plum-dispatch` not installed >> "
|
33
|
-
"This integration requires plum-dispatch! To fix, please `pip install -Uqq plum-dispatch`"
|
34
|
-
) from e
|
35
20
|
|
21
|
+
# Classes for isinstance() checks.
|
22
|
+
_NN_MODULE = None
|
23
|
+
_BASE_ESTIMATOR = None
|
36
24
|
|
37
25
|
try:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
name: str,
|
43
|
-
data: pd.DataFrame,
|
44
|
-
datasets=False,
|
45
|
-
run=None,
|
46
|
-
testing=False,
|
47
|
-
*args,
|
48
|
-
**kwargs,
|
49
|
-
): # type: ignore
|
50
|
-
if testing:
|
51
|
-
return "datasets" if datasets else None
|
52
|
-
|
53
|
-
if datasets:
|
54
|
-
run.use_artifact(f"{name}:latest")
|
55
|
-
wandb.termlog(f"Using artifact: {name} ({type(data)})")
|
56
|
-
|
57
|
-
@dispatch
|
58
|
-
def wandb_track(
|
59
|
-
name: str,
|
60
|
-
data: pd.DataFrame,
|
61
|
-
datasets=False,
|
62
|
-
run=None,
|
63
|
-
testing=False,
|
64
|
-
*args,
|
65
|
-
**kwargs,
|
66
|
-
):
|
67
|
-
if testing:
|
68
|
-
return "pd.DataFrame" if datasets else None
|
69
|
-
|
70
|
-
if datasets:
|
71
|
-
artifact = wandb.Artifact(name, type="dataset")
|
72
|
-
with artifact.new_file(f"{name}.parquet", "wb") as f:
|
73
|
-
data.to_parquet(f, engine="pyarrow")
|
74
|
-
run.log_artifact(artifact)
|
75
|
-
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
76
|
-
|
77
|
-
except ImportError:
|
78
|
-
wandb.termwarn(
|
79
|
-
"`pandas` not installed >> @wandb_log(datasets=True) may not auto log your dataset!"
|
80
|
-
)
|
26
|
+
from . import data_pandas
|
27
|
+
except errors.MissingDependencyError as e:
|
28
|
+
e.warn()
|
29
|
+
data_pandas = None
|
81
30
|
|
82
31
|
try:
|
83
32
|
import torch
|
84
33
|
import torch.nn as nn
|
85
34
|
|
86
|
-
|
87
|
-
|
35
|
+
_NN_MODULE = nn.Module
|
36
|
+
|
37
|
+
def _use_torch_module(
|
88
38
|
name: str,
|
89
39
|
data: nn.Module,
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
*args,
|
94
|
-
**kwargs,
|
95
|
-
): # type: ignore
|
40
|
+
run,
|
41
|
+
testing: bool = False,
|
42
|
+
) -> Optional[str]:
|
96
43
|
if testing:
|
97
|
-
return "models"
|
44
|
+
return "models"
|
98
45
|
|
99
|
-
|
100
|
-
|
101
|
-
|
46
|
+
run.use_artifact(f"{name}:latest")
|
47
|
+
wandb.termlog(f"Using artifact: {name} ({type(data)})")
|
48
|
+
return None
|
102
49
|
|
103
|
-
|
104
|
-
def wandb_track(
|
50
|
+
def _track_torch_module(
|
105
51
|
name: str,
|
106
52
|
data: nn.Module,
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
*args,
|
111
|
-
**kwargs,
|
112
|
-
):
|
53
|
+
run,
|
54
|
+
testing: bool = False,
|
55
|
+
) -> Optional[str]:
|
113
56
|
if testing:
|
114
|
-
return "nn.Module"
|
57
|
+
return "nn.Module"
|
115
58
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
59
|
+
artifact = wandb.Artifact(name, type="model")
|
60
|
+
with artifact.new_file(f"{name}.pkl", "wb") as f:
|
61
|
+
torch.save(data, f)
|
62
|
+
run.log_artifact(artifact)
|
63
|
+
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
64
|
+
return None
|
122
65
|
|
123
66
|
except ImportError:
|
124
67
|
wandb.termwarn(
|
@@ -128,42 +71,36 @@ except ImportError:
|
|
128
71
|
try:
|
129
72
|
from sklearn.base import BaseEstimator
|
130
73
|
|
131
|
-
|
132
|
-
|
74
|
+
_BASE_ESTIMATOR = BaseEstimator
|
75
|
+
|
76
|
+
def _use_sklearn_estimator(
|
133
77
|
name: str,
|
134
78
|
data: BaseEstimator,
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
*args,
|
139
|
-
**kwargs,
|
140
|
-
): # type: ignore
|
79
|
+
run,
|
80
|
+
testing: bool = False,
|
81
|
+
) -> Optional[str]:
|
141
82
|
if testing:
|
142
|
-
return "models"
|
83
|
+
return "models"
|
143
84
|
|
144
|
-
|
145
|
-
|
146
|
-
|
85
|
+
run.use_artifact(f"{name}:latest")
|
86
|
+
wandb.termlog(f"Using artifact: {name} ({type(data)})")
|
87
|
+
return None
|
147
88
|
|
148
|
-
|
149
|
-
def wandb_track(
|
89
|
+
def _track_sklearn_estimator(
|
150
90
|
name: str,
|
151
91
|
data: BaseEstimator,
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
*args,
|
156
|
-
**kwargs,
|
157
|
-
):
|
92
|
+
run,
|
93
|
+
testing: bool = False,
|
94
|
+
) -> Optional[str]:
|
158
95
|
if testing:
|
159
|
-
return "BaseEstimator"
|
96
|
+
return "BaseEstimator"
|
160
97
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
98
|
+
artifact = wandb.Artifact(name, type="model")
|
99
|
+
with artifact.new_file(f"{name}.pkl", "wb") as f:
|
100
|
+
pickle.dump(data, f)
|
101
|
+
run.log_artifact(artifact)
|
102
|
+
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
103
|
+
return None
|
167
104
|
|
168
105
|
except ImportError:
|
169
106
|
wandb.termwarn(
|
@@ -194,93 +131,166 @@ class ArtifactProxy:
|
|
194
131
|
return getattr(self.flow, key)
|
195
132
|
|
196
133
|
|
197
|
-
|
198
|
-
def wandb_track(
|
134
|
+
def _track_scalar(
|
199
135
|
name: str,
|
200
136
|
data: Union[dict, list, set, str, int, float, bool],
|
201
|
-
run
|
202
|
-
testing=False,
|
203
|
-
|
204
|
-
**kwargs,
|
205
|
-
): # type: ignore
|
137
|
+
run,
|
138
|
+
testing: bool = False,
|
139
|
+
) -> Optional[str]:
|
206
140
|
if testing:
|
207
141
|
return "scalar"
|
208
142
|
|
209
143
|
run.log({name: data})
|
144
|
+
return None
|
210
145
|
|
211
146
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
147
|
+
def _track_path(
|
148
|
+
name: str,
|
149
|
+
data: Path,
|
150
|
+
run,
|
151
|
+
testing: bool = False,
|
152
|
+
) -> Optional[str]:
|
216
153
|
if testing:
|
217
|
-
return "Path"
|
218
|
-
|
219
|
-
if datasets:
|
220
|
-
artifact = wandb.Artifact(name, type="dataset")
|
221
|
-
if data.is_dir():
|
222
|
-
artifact.add_dir(data)
|
223
|
-
elif data.is_file():
|
224
|
-
artifact.add_file(data)
|
225
|
-
run.log_artifact(artifact)
|
226
|
-
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
154
|
+
return "Path"
|
227
155
|
|
156
|
+
artifact = wandb.Artifact(name, type="dataset")
|
157
|
+
if data.is_dir():
|
158
|
+
artifact.add_dir(data)
|
159
|
+
elif data.is_file():
|
160
|
+
artifact.add_file(data)
|
161
|
+
run.log_artifact(artifact)
|
162
|
+
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
163
|
+
return None
|
228
164
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
165
|
+
|
166
|
+
def _track_generic(
|
167
|
+
name: str,
|
168
|
+
data,
|
169
|
+
run,
|
170
|
+
testing: bool = False,
|
171
|
+
) -> Optional[str]:
|
234
172
|
if testing:
|
235
|
-
return "generic"
|
173
|
+
return "generic"
|
174
|
+
|
175
|
+
artifact = wandb.Artifact(name, type="other")
|
176
|
+
with artifact.new_file(f"{name}.pkl", "wb") as f:
|
177
|
+
pickle.dump(data, f)
|
178
|
+
run.log_artifact(artifact)
|
179
|
+
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
180
|
+
return None
|
236
181
|
|
182
|
+
|
183
|
+
def wandb_track(
|
184
|
+
name: str,
|
185
|
+
data,
|
186
|
+
datasets: bool = False,
|
187
|
+
models: bool = False,
|
188
|
+
others: bool = False,
|
189
|
+
run: Optional[wandb.Run] = None,
|
190
|
+
testing: bool = False,
|
191
|
+
) -> Optional[str]:
|
192
|
+
"""Track data as wandb artifacts based on type and flags."""
|
193
|
+
# Check for pandas DataFrame
|
194
|
+
if data_pandas and data_pandas.is_dataframe(data) and datasets:
|
195
|
+
return data_pandas.track_dataframe(name, data, run, testing)
|
196
|
+
|
197
|
+
# Check for PyTorch Module
|
198
|
+
if _NN_MODULE and isinstance(data, _NN_MODULE) and models:
|
199
|
+
return _track_torch_module(name, data, run, testing)
|
200
|
+
|
201
|
+
# Check for scikit-learn BaseEstimator
|
202
|
+
if _BASE_ESTIMATOR and isinstance(data, _BASE_ESTIMATOR) and models:
|
203
|
+
return _track_sklearn_estimator(name, data, run, testing)
|
204
|
+
|
205
|
+
# Check for Path objects
|
206
|
+
if isinstance(data, Path) and datasets:
|
207
|
+
return _track_path(name, data, run, testing)
|
208
|
+
|
209
|
+
# Check for scalar types
|
210
|
+
if isinstance(data, (dict, list, set, str, int, float, bool)):
|
211
|
+
return _track_scalar(name, data, run, testing)
|
212
|
+
|
213
|
+
# Generic fallback
|
237
214
|
if others:
|
238
|
-
|
239
|
-
with artifact.new_file(f"{name}.pkl", "wb") as f:
|
240
|
-
pickle.dump(data, f)
|
241
|
-
run.log_artifact(artifact)
|
242
|
-
wandb.termlog(f"Logging artifact: {name} ({type(data)})")
|
215
|
+
return _track_generic(name, data, run, testing)
|
243
216
|
|
217
|
+
# No action taken
|
218
|
+
return None
|
219
|
+
|
220
|
+
|
221
|
+
def wandb_use(
|
222
|
+
name: str,
|
223
|
+
data,
|
224
|
+
datasets: bool = False,
|
225
|
+
models: bool = False,
|
226
|
+
others: bool = False,
|
227
|
+
run=None,
|
228
|
+
testing: bool = False,
|
229
|
+
) -> Optional[str]:
|
230
|
+
"""Use wandb artifacts based on data type and flags."""
|
231
|
+
# Skip scalar types - nothing to use
|
232
|
+
if isinstance(data, (dict, list, set, str, int, float, bool)):
|
233
|
+
return None
|
244
234
|
|
245
|
-
@dispatch
|
246
|
-
def wandb_use(name: str, data, *args, **kwargs):
|
247
235
|
try:
|
248
|
-
|
236
|
+
# Check for pandas DataFrame
|
237
|
+
if data_pandas and data_pandas.is_dataframe(data) and datasets:
|
238
|
+
return data_pandas.use_dataframe(name, run, testing)
|
239
|
+
|
240
|
+
# Check for PyTorch Module
|
241
|
+
elif _NN_MODULE and isinstance(data, _NN_MODULE) and models:
|
242
|
+
return _use_torch_module(name, data, run, testing)
|
243
|
+
|
244
|
+
# Check for scikit-learn BaseEstimator
|
245
|
+
elif _BASE_ESTIMATOR and isinstance(data, _BASE_ESTIMATOR) and models:
|
246
|
+
return _use_sklearn_estimator(name, data, run, testing)
|
247
|
+
|
248
|
+
# Check for Path objects
|
249
|
+
elif isinstance(data, Path) and datasets:
|
250
|
+
return _use_path(name, data, run, testing)
|
251
|
+
|
252
|
+
# Generic fallback
|
253
|
+
elif others:
|
254
|
+
return _use_generic(name, data, run, testing)
|
255
|
+
|
256
|
+
else:
|
257
|
+
return None
|
258
|
+
|
249
259
|
except wandb.CommError:
|
250
260
|
wandb.termwarn(
|
251
261
|
f"This artifact ({name}, {type(data)}) does not exist in the wandb datastore!"
|
252
|
-
|
253
|
-
|
262
|
+
" If you created an instance inline (e.g. sklearn.ensemble.RandomForestClassifier),"
|
263
|
+
" then you can safely ignore this. Otherwise you may want to check your internet connection!"
|
254
264
|
)
|
265
|
+
return None
|
255
266
|
|
256
267
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
@dispatch
|
265
|
-
def _wandb_use(
|
266
|
-
name: str, data: Path, datasets=False, run=None, testing=False, *args, **kwargs
|
267
|
-
): # type: ignore
|
268
|
+
def _use_path(
|
269
|
+
name: str,
|
270
|
+
data: Path,
|
271
|
+
run,
|
272
|
+
testing: bool = False,
|
273
|
+
) -> Optional[str]:
|
268
274
|
if testing:
|
269
|
-
return "datasets"
|
275
|
+
return "datasets"
|
270
276
|
|
271
|
-
|
272
|
-
|
273
|
-
|
277
|
+
run.use_artifact(f"{name}:latest")
|
278
|
+
wandb.termlog(f"Using artifact: {name} ({type(data)})")
|
279
|
+
return None
|
274
280
|
|
275
281
|
|
276
|
-
|
277
|
-
|
282
|
+
def _use_generic(
|
283
|
+
name: str,
|
284
|
+
data,
|
285
|
+
run,
|
286
|
+
testing: bool = False,
|
287
|
+
) -> Optional[str]:
|
278
288
|
if testing:
|
279
|
-
return "others"
|
289
|
+
return "others"
|
280
290
|
|
281
|
-
|
282
|
-
|
283
|
-
|
291
|
+
run.use_artifact(f"{name}:latest")
|
292
|
+
wandb.termlog(f"Using artifact: {name} ({type(data)})")
|
293
|
+
return None
|
284
294
|
|
285
295
|
|
286
296
|
def coalesce(*arg):
|
@@ -289,25 +299,30 @@ def coalesce(*arg):
|
|
289
299
|
|
290
300
|
def wandb_log(
|
291
301
|
func=None,
|
292
|
-
|
293
|
-
datasets=False,
|
294
|
-
models=False,
|
295
|
-
others=False,
|
296
|
-
settings=None,
|
302
|
+
/,
|
303
|
+
datasets: bool = False,
|
304
|
+
models: bool = False,
|
305
|
+
others: bool = False,
|
306
|
+
settings: Optional[wandb.Settings] = None,
|
297
307
|
):
|
298
|
-
"""Automatically log parameters and artifacts to W&B
|
308
|
+
"""Automatically log parameters and artifacts to W&B.
|
309
|
+
|
310
|
+
This decorator can be applied to a flow, step, or both:
|
299
311
|
|
300
|
-
|
301
|
-
- Decorating a
|
302
|
-
- Decorating
|
303
|
-
- Decorating a step after decorating the flow will overwrite the flow decoration
|
312
|
+
- Decorating a step enables or disables logging within that step
|
313
|
+
- Decorating a flow is equivalent to decorating all steps
|
314
|
+
- Decorating a step after decorating its flow overwrites the flow decoration
|
304
315
|
|
305
316
|
Args:
|
306
|
-
func:
|
307
|
-
datasets:
|
308
|
-
|
309
|
-
|
310
|
-
|
317
|
+
func: The step method or flow class to decorate.
|
318
|
+
datasets: Whether to log `pd.DataFrame` and `pathlib.Path`
|
319
|
+
types. Defaults to False.
|
320
|
+
models: Whether to log `nn.Module` and `sklearn.base.BaseEstimator`
|
321
|
+
types. Defaults to False.
|
322
|
+
others: If `True`, log anything pickle-able. Defaults to False.
|
323
|
+
settings: Custom settings to pass to `wandb.init`.
|
324
|
+
If `run_group` is `None`, it is set to `{flow_name}/{run_id}`.
|
325
|
+
If `run_job_type` is `None`, it is set to `{run_job_type}/{step_name}`.
|
311
326
|
"""
|
312
327
|
|
313
328
|
@wraps(func)
|
@@ -14,7 +14,6 @@ import wandb
|
|
14
14
|
from wandb import util
|
15
15
|
from wandb.data_types import Table
|
16
16
|
from wandb.sdk.lib import telemetry
|
17
|
-
from wandb.sdk.wandb_run import Run
|
18
17
|
|
19
18
|
openai = util.get_module(
|
20
19
|
name="openai",
|
@@ -54,7 +53,7 @@ class WandbLogger:
|
|
54
53
|
_wandb_api: Optional[wandb.Api] = None
|
55
54
|
_logged_in: bool = False
|
56
55
|
openai_client: Optional[OpenAI] = None
|
57
|
-
_run: Optional[Run] = None
|
56
|
+
_run: Optional[wandb.Run] = None
|
58
57
|
|
59
58
|
@classmethod
|
60
59
|
def sync(
|
wandb/jupyter.py
CHANGED
@@ -19,13 +19,13 @@ from requests.compat import urljoin
|
|
19
19
|
|
20
20
|
import wandb
|
21
21
|
import wandb.util
|
22
|
-
from wandb.sdk import
|
22
|
+
from wandb.sdk import wandb_setup
|
23
23
|
from wandb.sdk.lib import filesystem
|
24
24
|
|
25
25
|
logger = logging.getLogger(__name__)
|
26
26
|
|
27
27
|
|
28
|
-
def display_if_magic_is_used(run:
|
28
|
+
def display_if_magic_is_used(run: wandb.Run) -> bool:
|
29
29
|
"""Display a run's page if the cell has the %%wandb cell magic.
|
30
30
|
|
31
31
|
Args:
|
@@ -53,7 +53,7 @@ class _WandbCellMagicState:
|
|
53
53
|
self._height = height
|
54
54
|
self._already_displayed = False
|
55
55
|
|
56
|
-
def display_if_allowed(self, run:
|
56
|
+
def display_if_allowed(self, run: wandb.Run) -> None:
|
57
57
|
"""Display a run's iframe if one is not already displayed.
|
58
58
|
|
59
59
|
Args:
|
@@ -93,7 +93,7 @@ def _display_by_wandb_path(path: str, *, height: int) -> None:
|
|
93
93
|
)
|
94
94
|
|
95
95
|
|
96
|
-
def _display_wandb_run(run:
|
96
|
+
def _display_wandb_run(run: wandb.Run, *, height: int) -> None:
|
97
97
|
"""Display a run (usually in an iframe).
|
98
98
|
|
99
99
|
Args:
|
@@ -461,7 +461,7 @@ class Notebook:
|
|
461
461
|
|
462
462
|
return False
|
463
463
|
|
464
|
-
def save_history(self, run:
|
464
|
+
def save_history(self, run: wandb.Run):
|
465
465
|
"""This saves all cell executions in the current session as a new notebook."""
|
466
466
|
try:
|
467
467
|
from nbformat import v4, validator, write # type: ignore
|
wandb/plot/custom_chart.py
CHANGED
@@ -85,27 +85,50 @@ def plot_table(
|
|
85
85
|
This function creates a custom chart based on a Vega-Lite specification and
|
86
86
|
a data table represented by a `wandb.Table` object. The specification needs
|
87
87
|
to be predefined and stored in the W&B backend. The function returns a custom
|
88
|
-
chart object that can be logged to W&B using `wandb.log()`.
|
88
|
+
chart object that can be logged to W&B using `wandb.Run.log()`.
|
89
89
|
|
90
90
|
Args:
|
91
|
-
vega_spec_name
|
91
|
+
vega_spec_name: The name or identifier of the Vega-Lite spec
|
92
92
|
that defines the visualization structure.
|
93
|
-
data_table
|
93
|
+
data_table: A `wandb.Table` object containing the data to be
|
94
94
|
visualized.
|
95
|
-
fields
|
95
|
+
fields: A mapping between the fields in the Vega-Lite spec and the
|
96
96
|
corresponding columns in the data table to be visualized.
|
97
|
-
string_fields
|
97
|
+
string_fields: A dictionary for providing values for any string constants
|
98
98
|
required by the custom visualization.
|
99
|
-
split_table
|
99
|
+
split_table: Whether the table should be split into a separate section
|
100
100
|
in the W&B UI. If `True`, the table will be displayed in a section named
|
101
101
|
"Custom Chart Tables". Default is `False`.
|
102
102
|
|
103
103
|
Returns:
|
104
104
|
CustomChart: A custom chart object that can be logged to W&B. To log the
|
105
|
-
chart, pass
|
105
|
+
chart, pass the chart object as argument to `wandb.Run.log()`.
|
106
106
|
|
107
107
|
Raises:
|
108
108
|
wandb.Error: If `data_table` is not a `wandb.Table` object.
|
109
|
+
|
110
|
+
Example:
|
111
|
+
```python
|
112
|
+
# Create a custom chart using a Vega-Lite spec and the data table.
|
113
|
+
import wandb
|
114
|
+
|
115
|
+
data = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]
|
116
|
+
table = wandb.Table(data=data, columns=["x", "y"])
|
117
|
+
fields = {"x": "x", "y": "y", "title": "MY TITLE"}
|
118
|
+
|
119
|
+
with wandb.init() as run:
|
120
|
+
# Training code goes here
|
121
|
+
|
122
|
+
# Create a custom title with `string_fields`.
|
123
|
+
my_custom_chart = wandb.plot_table(
|
124
|
+
vega_spec_name="wandb/line/v0",
|
125
|
+
data_table=table,
|
126
|
+
fields=fields,
|
127
|
+
string_fields={"title": "Title"},
|
128
|
+
)
|
129
|
+
|
130
|
+
run.log({"custom_chart": my_custom_chart})
|
131
|
+
```
|
109
132
|
"""
|
110
133
|
|
111
134
|
if not isinstance(data_table, wandb.Table):
|