wandb 0.18.4__py3-none-any.whl → 0.18.6__py3-none-any.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 +2 -2
- wandb/__init__.pyi +21 -19
- wandb/agents/pyagent.py +1 -1
- wandb/apis/importers/wandb.py +1 -1
- wandb/apis/normalize.py +2 -18
- wandb/apis/public/api.py +122 -62
- wandb/apis/public/artifacts.py +8 -3
- wandb/apis/public/files.py +17 -2
- wandb/apis/public/jobs.py +2 -2
- wandb/apis/public/query_generator.py +1 -1
- wandb/apis/public/runs.py +8 -8
- wandb/apis/public/teams.py +3 -3
- wandb/apis/public/users.py +1 -1
- wandb/apis/public/utils.py +68 -0
- wandb/bin/gpu_stats +0 -0
- wandb/cli/cli.py +12 -3
- wandb/data_types.py +1 -1
- wandb/docker/__init__.py +2 -1
- wandb/docker/auth.py +2 -3
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +7 -6
- wandb/filesync/step_prepare.py +1 -1
- wandb/filesync/upload_job.py +1 -1
- wandb/integration/catboost/catboost.py +2 -2
- wandb/integration/diffusers/pipeline_resolver.py +1 -1
- wandb/integration/diffusers/resolvers/multimodal.py +6 -6
- wandb/integration/diffusers/resolvers/utils.py +1 -1
- wandb/integration/fastai/__init__.py +3 -2
- wandb/integration/keras/callbacks/metrics_logger.py +1 -1
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -1
- wandb/integration/keras/keras.py +1 -1
- wandb/integration/kfp/kfp_patch.py +1 -1
- wandb/integration/lightgbm/__init__.py +2 -2
- wandb/integration/magic.py +2 -2
- wandb/integration/metaflow/metaflow.py +1 -1
- wandb/integration/sacred/__init__.py +1 -1
- wandb/integration/sagemaker/auth.py +1 -1
- wandb/integration/sklearn/plot/classifier.py +7 -7
- wandb/integration/sklearn/plot/clusterer.py +3 -3
- wandb/integration/sklearn/plot/regressor.py +3 -3
- wandb/integration/sklearn/plot/shared.py +2 -2
- wandb/integration/tensorboard/log.py +2 -2
- wandb/integration/ultralytics/callback.py +2 -2
- wandb/integration/xgboost/xgboost.py +1 -1
- wandb/jupyter.py +0 -1
- wandb/plot/__init__.py +17 -8
- wandb/plot/bar.py +53 -27
- wandb/plot/confusion_matrix.py +151 -70
- wandb/plot/custom_chart.py +124 -0
- wandb/plot/histogram.py +46 -20
- wandb/plot/line.py +57 -26
- wandb/plot/line_series.py +148 -60
- wandb/plot/pr_curve.py +89 -44
- wandb/plot/roc_curve.py +82 -37
- wandb/plot/scatter.py +53 -20
- wandb/plot/viz.py +20 -102
- wandb/sdk/artifacts/artifact.py +280 -328
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +9 -4
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -3
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +2 -2
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
- wandb/sdk/backend/backend.py +0 -1
- wandb/sdk/data_types/audio.py +1 -1
- wandb/sdk/data_types/base_types/media.py +66 -5
- wandb/sdk/data_types/bokeh.py +1 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -1
- wandb/sdk/data_types/helper_types/image_mask.py +2 -2
- wandb/sdk/data_types/histogram.py +1 -1
- wandb/sdk/data_types/html.py +1 -1
- wandb/sdk/data_types/image.py +1 -1
- wandb/sdk/data_types/molecule.py +3 -3
- wandb/sdk/data_types/object_3d.py +4 -4
- wandb/sdk/data_types/plotly.py +1 -1
- wandb/sdk/data_types/saved_model.py +0 -1
- wandb/sdk/data_types/table.py +7 -7
- wandb/sdk/data_types/trace_tree.py +1 -1
- wandb/sdk/data_types/video.py +4 -3
- wandb/sdk/interface/router.py +0 -2
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/file_pusher.py +1 -1
- wandb/sdk/internal/file_stream.py +4 -4
- wandb/sdk/internal/handler.py +3 -2
- wandb/sdk/internal/internal.py +1 -1
- wandb/sdk/internal/internal_api.py +183 -64
- wandb/sdk/internal/job_builder.py +4 -3
- wandb/sdk/internal/system/assets/__init__.py +0 -2
- wandb/sdk/internal/tb_watcher.py +11 -10
- wandb/sdk/launch/_launch.py +4 -3
- wandb/sdk/launch/_launch_add.py +2 -2
- wandb/sdk/launch/builder/kaniko_builder.py +0 -1
- wandb/sdk/launch/create_job.py +1 -0
- wandb/sdk/launch/environment/local_environment.py +0 -1
- wandb/sdk/launch/errors.py +0 -6
- wandb/sdk/launch/registry/local_registry.py +0 -2
- wandb/sdk/launch/runner/abstract.py +0 -5
- wandb/sdk/launch/sweeps/__init__.py +0 -2
- wandb/sdk/launch/sweeps/scheduler.py +0 -2
- wandb/sdk/launch/sweeps/scheduler_sweep.py +0 -1
- wandb/sdk/lib/apikey.py +3 -3
- wandb/sdk/lib/file_stream_utils.py +1 -1
- wandb/sdk/lib/filesystem.py +1 -1
- wandb/sdk/lib/ipython.py +16 -9
- wandb/sdk/lib/mailbox.py +0 -4
- wandb/sdk/lib/printer.py +44 -8
- wandb/sdk/lib/retry.py +1 -1
- wandb/sdk/service/service.py +3 -3
- wandb/sdk/service/streams.py +2 -4
- wandb/sdk/wandb_init.py +20 -20
- wandb/sdk/wandb_login.py +1 -1
- wandb/sdk/wandb_require.py +1 -4
- wandb/sdk/wandb_run.py +57 -69
- wandb/sdk/wandb_settings.py +3 -4
- wandb/sdk/wandb_sync.py +2 -1
- wandb/util.py +46 -18
- wandb/wandb_agent.py +3 -3
- wandb/wandb_controller.py +2 -2
- {wandb-0.18.4.dist-info → wandb-0.18.6.dist-info}/METADATA +1 -1
- {wandb-0.18.4.dist-info → wandb-0.18.6.dist-info}/RECORD +124 -125
- wandb/sdk/internal/system/assets/gpu_apple.py +0 -177
- wandb/sdk/lib/_wburls_generate.py +0 -25
- wandb/sdk/lib/_wburls_generated.py +0 -22
- wandb/sdk/lib/wburls.py +0 -46
- {wandb-0.18.4.dist-info → wandb-0.18.6.dist-info}/WHEEL +0 -0
- {wandb-0.18.4.dist-info → wandb-0.18.6.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.4.dist-info → wandb-0.18.6.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py
CHANGED
@@ -31,14 +31,15 @@ import requests
|
|
31
31
|
|
32
32
|
import wandb
|
33
33
|
import wandb.env
|
34
|
-
from wandb import
|
34
|
+
from wandb import trigger
|
35
35
|
from wandb._globals import _datatypes_set_callback
|
36
36
|
from wandb.apis import internal, public
|
37
37
|
from wandb.apis.internal import Api
|
38
38
|
from wandb.apis.public import Api as PublicApi
|
39
|
-
from wandb.errors import CommError
|
39
|
+
from wandb.errors import CommError, UnsupportedError, UsageError
|
40
|
+
from wandb.errors.links import url_registry
|
40
41
|
from wandb.integration.torch import wandb_torch
|
41
|
-
from wandb.plot
|
42
|
+
from wandb.plot import CustomChart, Visualize, plot_table
|
42
43
|
from wandb.proto.wandb_internal_pb2 import (
|
43
44
|
MetricRecord,
|
44
45
|
PollExitResponse,
|
@@ -89,7 +90,6 @@ from .lib.gitlib import GitRepo
|
|
89
90
|
from .lib.mailbox import MailboxError, MailboxHandle, MailboxProbe, MailboxProgress
|
90
91
|
from .lib.proto_util import message_to_dict
|
91
92
|
from .lib.reporting import Reporter
|
92
|
-
from .lib.wburls import wburls
|
93
93
|
from .wandb_alerts import AlertLevel
|
94
94
|
from .wandb_settings import Settings
|
95
95
|
from .wandb_setup import _WandbSetup
|
@@ -410,7 +410,7 @@ class _run_decorator: # noqa: N801
|
|
410
410
|
if only_warn:
|
411
411
|
warnings.warn(resolved_message, UserWarning, stacklevel=2)
|
412
412
|
else:
|
413
|
-
raise
|
413
|
+
raise UsageError(resolved_message)
|
414
414
|
|
415
415
|
return wrapper_fn
|
416
416
|
|
@@ -430,11 +430,10 @@ class _run_decorator: # noqa: N801
|
|
430
430
|
# - for fork case the new process share mem space hence the value would be of parent process.
|
431
431
|
_init_pid = getattr(self, "_init_pid", None)
|
432
432
|
if _init_pid != os.getpid():
|
433
|
-
message =
|
434
|
-
func.__name__,
|
435
|
-
|
436
|
-
|
437
|
-
wburls.get("multiprocess"),
|
433
|
+
message = (
|
434
|
+
f"`{func.__name__}` ignored (called from pid={os.getpid()}, "
|
435
|
+
f"`init` called from pid={_init_pid}). "
|
436
|
+
f"See: {url_registry.url('multiprocess')}"
|
438
437
|
)
|
439
438
|
# - if this process was pickled in non-service case,
|
440
439
|
# we ignore the attributes (since pickle is not supported)
|
@@ -443,7 +442,7 @@ class _run_decorator: # noqa: N801
|
|
443
442
|
settings = getattr(self, "_settings", None)
|
444
443
|
if settings and settings["strict"]:
|
445
444
|
wandb.termerror(message, repeat=False)
|
446
|
-
raise
|
445
|
+
raise UnsupportedError(
|
447
446
|
f"`{func.__name__}` does not support multiprocessing"
|
448
447
|
)
|
449
448
|
wandb.termwarn(message, repeat=False)
|
@@ -633,7 +632,7 @@ class Run:
|
|
633
632
|
|
634
633
|
_datatypes_set_callback(self._datatypes_callback)
|
635
634
|
|
636
|
-
self._printer = printer.
|
635
|
+
self._printer = printer.new_printer()
|
637
636
|
self._wl = None
|
638
637
|
self._reporter: Reporter | None = None
|
639
638
|
|
@@ -1158,7 +1157,7 @@ class Run:
|
|
1158
1157
|
|
1159
1158
|
By default, it walks the current directory and logs all files that end with `.py`.
|
1160
1159
|
|
1161
|
-
|
1160
|
+
Args:
|
1162
1161
|
root: The relative (to `os.getcwd()`) or absolute path to recursively find code from.
|
1163
1162
|
name: (str, optional) The name of our code artifact. By default, we'll name
|
1164
1163
|
the artifact `source-$PROJECT_ID-$ENTRYPOINT_RELPATH`. There may be scenarios where you want
|
@@ -1415,7 +1414,7 @@ class Run:
|
|
1415
1414
|
if is_id:
|
1416
1415
|
artifact = Artifact._from_id(artifact_string, public_api._client)
|
1417
1416
|
else:
|
1418
|
-
artifact = public_api.
|
1417
|
+
artifact = public_api._artifact(name=artifact_string)
|
1419
1418
|
# in the future we'll need to support using artifacts from
|
1420
1419
|
# different instances of wandb.
|
1421
1420
|
|
@@ -1473,36 +1472,27 @@ class Run:
|
|
1473
1472
|
def _visualization_hack(self, row: dict[str, Any]) -> dict[str, Any]:
|
1474
1473
|
# TODO(jhr): move visualize hack somewhere else
|
1475
1474
|
chart_keys = set()
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1475
|
+
for k, v in row.items():
|
1476
|
+
if isinstance(v, Visualize):
|
1477
|
+
row[k] = v.table
|
1478
|
+
v.set_key(k)
|
1479
|
+
self._config_callback(
|
1480
|
+
val=v.spec.config_value,
|
1481
|
+
key=v.spec.config_key,
|
1482
|
+
)
|
1483
|
+
elif isinstance(v, CustomChart):
|
1484
1484
|
chart_keys.add(k)
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
split_table_set.add(k)
|
1491
|
-
else:
|
1492
|
-
value = row[k].get_config_value(
|
1493
|
-
"Vega2", row[k].user_query(f"{k}_table")
|
1494
|
-
)
|
1495
|
-
row[k] = row[k]._data
|
1496
|
-
self._config_callback(val=value, key=key)
|
1485
|
+
v.set_key(k)
|
1486
|
+
self._config_callback(
|
1487
|
+
key=v.spec.config_key,
|
1488
|
+
val=v.spec.config_value,
|
1489
|
+
)
|
1497
1490
|
|
1498
1491
|
for k in chart_keys:
|
1499
1492
|
# remove the chart key from the row
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
row[f"Custom Chart Tables/{k}_table"] = row.pop(k)
|
1504
|
-
else:
|
1505
|
-
row[f"{k}_table"] = row.pop(k)
|
1493
|
+
v = row.pop(k)
|
1494
|
+
if isinstance(v, CustomChart):
|
1495
|
+
row[v.spec.table_key] = v.table
|
1506
1496
|
return row
|
1507
1497
|
|
1508
1498
|
def _partial_history_callback(
|
@@ -1707,7 +1697,7 @@ class Run:
|
|
1707
1697
|
[guides to logging](https://docs.wandb.ai/guides/track/log) for examples,
|
1708
1698
|
from 3D molecular structures and segmentation masks to PR curves and histograms.
|
1709
1699
|
You can use `wandb.Table` to log structured data. See our
|
1710
|
-
[guide to logging tables](https://docs.wandb.ai/guides/
|
1700
|
+
[guide to logging tables](https://docs.wandb.ai/guides/tables/tables-walkthrough)
|
1711
1701
|
for details.
|
1712
1702
|
|
1713
1703
|
The W&B UI organizes metrics with a forward slash (`/`) in their name
|
@@ -1770,7 +1760,7 @@ class Run:
|
|
1770
1760
|
run.log({"accuracy": 0.9}, step=current_step)
|
1771
1761
|
```
|
1772
1762
|
|
1773
|
-
|
1763
|
+
Args:
|
1774
1764
|
data: A `dict` with `str` keys and values that are serializable
|
1775
1765
|
Python objects including: `int`, `float` and `string`;
|
1776
1766
|
any of the `wandb.data_types`; lists, tuples and NumPy arrays
|
@@ -1923,7 +1913,7 @@ class Run:
|
|
1923
1913
|
if self._settings._shared and step is not None:
|
1924
1914
|
wandb.termwarn(
|
1925
1915
|
"In shared mode, the use of `wandb.log` with the step argument is not supported "
|
1926
|
-
f"and will be ignored. Please refer to {
|
1916
|
+
f"and will be ignored. Please refer to {url_registry.url('define-metric')} "
|
1927
1917
|
"on how to customize your x-axis.",
|
1928
1918
|
repeat=False,
|
1929
1919
|
)
|
@@ -1971,7 +1961,7 @@ class Run:
|
|
1971
1961
|
Note: when given an absolute path or glob and no `base_path`, one
|
1972
1962
|
directory level is preserved as in the example above.
|
1973
1963
|
|
1974
|
-
|
1964
|
+
Args:
|
1975
1965
|
glob_str: A relative or absolute path or Unix glob.
|
1976
1966
|
base_path: A path to use to infer a directory structure; see examples.
|
1977
1967
|
policy: One of `live`, `now`, or `end`.
|
@@ -1998,9 +1988,7 @@ class Run:
|
|
1998
1988
|
if isinstance(glob_str, bytes):
|
1999
1989
|
# Preserved for backward compatibility: allow bytes inputs.
|
2000
1990
|
glob_str = glob_str.decode("utf-8")
|
2001
|
-
if isinstance(glob_str, str) and (
|
2002
|
-
glob_str.startswith("gs://") or glob_str.startswith("s3://")
|
2003
|
-
):
|
1991
|
+
if isinstance(glob_str, str) and (glob_str.startswith(("gs://", "s3://"))):
|
2004
1992
|
# Provide a better error message for a common misuse.
|
2005
1993
|
wandb.termlog(f"{glob_str} is a cloud storage url, can't save file to W&B.")
|
2006
1994
|
return []
|
@@ -2144,7 +2132,7 @@ class Run:
|
|
2144
2132
|
This is used when creating multiple runs in the same process. We automatically
|
2145
2133
|
call this method when your script exits or if you use the run context manager.
|
2146
2134
|
|
2147
|
-
|
2135
|
+
Args:
|
2148
2136
|
exit_code: Set to something other than 0 to mark a run as failed
|
2149
2137
|
quiet: Set to true to minimize log output
|
2150
2138
|
"""
|
@@ -2246,11 +2234,11 @@ class Run:
|
|
2246
2234
|
data_table: Table,
|
2247
2235
|
fields: dict[str, Any],
|
2248
2236
|
string_fields: dict[str, Any] | None = None,
|
2249
|
-
split_table: bool
|
2237
|
+
split_table: bool = False,
|
2250
2238
|
) -> CustomChart:
|
2251
2239
|
"""Create a custom plot on a table.
|
2252
2240
|
|
2253
|
-
|
2241
|
+
Args:
|
2254
2242
|
vega_spec_name: the name of the spec for the plot
|
2255
2243
|
data_table: a wandb.Table object containing the data to
|
2256
2244
|
be used on the visualization
|
@@ -2261,7 +2249,7 @@ class Run:
|
|
2261
2249
|
split_table: a boolean that indicates whether the table should be in
|
2262
2250
|
a separate section in the UI
|
2263
2251
|
"""
|
2264
|
-
return
|
2252
|
+
return plot_table(
|
2265
2253
|
vega_spec_name, data_table, fields, string_fields or {}, split_table
|
2266
2254
|
)
|
2267
2255
|
|
@@ -2751,7 +2739,7 @@ class Run:
|
|
2751
2739
|
) -> wandb_metric.Metric:
|
2752
2740
|
"""Customize metrics logged with `wandb.log()`.
|
2753
2741
|
|
2754
|
-
|
2742
|
+
Args:
|
2755
2743
|
name: The name of the metric to customize.
|
2756
2744
|
step_metric: The name of another metric to serve as the X-axis
|
2757
2745
|
for this metric in automatically generated charts.
|
@@ -2977,10 +2965,10 @@ class Run:
|
|
2977
2965
|
|
2978
2966
|
The linked artifact will be visible in the UI for the specified portfolio.
|
2979
2967
|
|
2980
|
-
|
2968
|
+
Args:
|
2981
2969
|
artifact: the (public or local) artifact which will be linked
|
2982
|
-
target_path: `str` - takes the following forms: {portfolio}
|
2983
|
-
or {entity}/{project}/{portfolio}
|
2970
|
+
target_path: `str` - takes the following forms: `{portfolio}`, `{project}/{portfolio}`,
|
2971
|
+
or `{entity}/{project}/{portfolio}`
|
2984
2972
|
aliases: `List[str]` - optional alias(es) that will only be applied on this linked artifact
|
2985
2973
|
inside the portfolio.
|
2986
2974
|
The alias "latest" will always be applied to the latest version of an artifact that is linked.
|
@@ -3046,7 +3034,7 @@ class Run:
|
|
3046
3034
|
|
3047
3035
|
Call `download` or `file` on the returned object to get the contents locally.
|
3048
3036
|
|
3049
|
-
|
3037
|
+
Args:
|
3050
3038
|
artifact_or_name: (str or Artifact) An artifact name.
|
3051
3039
|
May be prefixed with project/ or entity/project/.
|
3052
3040
|
If no entity is specified in the name, the Run or API setting's entity is used.
|
@@ -3075,7 +3063,7 @@ class Run:
|
|
3075
3063
|
else:
|
3076
3064
|
name = artifact_or_name
|
3077
3065
|
public_api = self._public_api()
|
3078
|
-
artifact = public_api.
|
3066
|
+
artifact = public_api._artifact(type=type, name=name)
|
3079
3067
|
if type is not None and type != artifact.type:
|
3080
3068
|
raise ValueError(
|
3081
3069
|
"Supplied type {} does not match type {} of artifact {}".format(
|
@@ -3155,7 +3143,7 @@ class Run:
|
|
3155
3143
|
) -> Artifact:
|
3156
3144
|
"""Declare an artifact as an output of a run.
|
3157
3145
|
|
3158
|
-
|
3146
|
+
Args:
|
3159
3147
|
artifact_or_path: (str or Artifact) A path to the contents of this artifact,
|
3160
3148
|
can be in the following forms:
|
3161
3149
|
- `/local/directory`
|
@@ -3200,7 +3188,7 @@ class Run:
|
|
3200
3188
|
Note that you must call run.finish_artifact() to finalize the artifact.
|
3201
3189
|
This is useful when distributed jobs need to all contribute to the same artifact.
|
3202
3190
|
|
3203
|
-
|
3191
|
+
Args:
|
3204
3192
|
artifact_or_path: (str or Artifact) A path to the contents of this artifact,
|
3205
3193
|
can be in the following forms:
|
3206
3194
|
- `/local/directory`
|
@@ -3253,7 +3241,7 @@ class Run:
|
|
3253
3241
|
|
3254
3242
|
Subsequent "upserts" with the same distributed ID will result in a new version.
|
3255
3243
|
|
3256
|
-
|
3244
|
+
Args:
|
3257
3245
|
artifact_or_path: (str or Artifact) A path to the contents of this artifact,
|
3258
3246
|
can be in the following forms:
|
3259
3247
|
- `/local/directory`
|
@@ -3442,7 +3430,7 @@ class Run:
|
|
3442
3430
|
) -> None:
|
3443
3431
|
"""Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run.
|
3444
3432
|
|
3445
|
-
|
3433
|
+
Args:
|
3446
3434
|
path: (str) A path to the contents of this model,
|
3447
3435
|
can be in the following forms:
|
3448
3436
|
- `/local/directory`
|
@@ -3488,7 +3476,7 @@ class Run:
|
|
3488
3476
|
def use_model(self, name: str) -> FilePathStr:
|
3489
3477
|
"""Download the files logged in a model artifact 'name'.
|
3490
3478
|
|
3491
|
-
|
3479
|
+
Args:
|
3492
3480
|
name: (str) A model artifact name. 'name' must match the name of an existing logged
|
3493
3481
|
model artifact.
|
3494
3482
|
May be prefixed with entity/project/. Valid names
|
@@ -3558,7 +3546,7 @@ class Run:
|
|
3558
3546
|
- Link version of model artifact 'name' to registered model, 'registered_model_name'.
|
3559
3547
|
- Attach aliases from 'aliases' list to the newly linked model artifact version.
|
3560
3548
|
|
3561
|
-
|
3549
|
+
Args:
|
3562
3550
|
path: (str) A path to the contents of this model,
|
3563
3551
|
can be in the following forms:
|
3564
3552
|
- `/local/directory`
|
@@ -3617,7 +3605,7 @@ class Run:
|
|
3617
3605
|
|
3618
3606
|
public_api = self._public_api()
|
3619
3607
|
try:
|
3620
|
-
artifact = public_api.
|
3608
|
+
artifact = public_api._artifact(name=f"{name}:latest")
|
3621
3609
|
assert (
|
3622
3610
|
"model" in str(artifact.type.lower())
|
3623
3611
|
), "You can only use this method for 'model' artifacts. For an artifact to be a 'model' artifact, its type property must contain the substring 'model'."
|
@@ -3641,7 +3629,7 @@ class Run:
|
|
3641
3629
|
) -> None:
|
3642
3630
|
"""Launch an alert with the given title and text.
|
3643
3631
|
|
3644
|
-
|
3632
|
+
Args:
|
3645
3633
|
title: (str) The title of the alert, must be less than 64 characters long.
|
3646
3634
|
text: (str) The text body of the alert.
|
3647
3635
|
level: (str or AlertLevel, optional) The alert level to use, either: `INFO`, `WARN`, or `ERROR`.
|
@@ -3815,7 +3803,7 @@ class Run:
|
|
3815
3803
|
|
3816
3804
|
# TODO(settings): make settings the source of truth
|
3817
3805
|
if not wandb.jupyter.quiet(): # type: ignore
|
3818
|
-
doc_html = printer.link(
|
3806
|
+
doc_html = printer.link(url_registry.url("developer-guide"), "docs")
|
3819
3807
|
|
3820
3808
|
project_html = printer.link(project_url, "Weights & Biases")
|
3821
3809
|
project_line = f"to {project_html} ({doc_html})"
|
@@ -4058,7 +4046,7 @@ class Run:
|
|
4058
4046
|
printer.display(
|
4059
4047
|
"The legacy backend is deprecated. In future versions, `wandb-core` will become "
|
4060
4048
|
"the sole backend service, and the `wandb.require('legacy-service')` flag will be removed. "
|
4061
|
-
"For more information, visit
|
4049
|
+
f"For more information, visit {url_registry.url('wandb-core')}",
|
4062
4050
|
level="warn",
|
4063
4051
|
)
|
4064
4052
|
|
@@ -4103,7 +4091,7 @@ def restore(
|
|
4103
4091
|
File is placed into the current directory or run directory.
|
4104
4092
|
By default, will only download the file if it doesn't already exist.
|
4105
4093
|
|
4106
|
-
|
4094
|
+
Args:
|
4107
4095
|
name: the name of the file
|
4108
4096
|
run_path: optional path to a run to pull files from, i.e. `username/project_name/run_id`
|
4109
4097
|
if wandb.init has not been called, this is required.
|
@@ -4161,7 +4149,7 @@ def finish(exit_code: int | None = None, quiet: bool | None = None) -> None:
|
|
4161
4149
|
This is used when creating multiple runs in the same process.
|
4162
4150
|
We automatically call this method when your script exits.
|
4163
4151
|
|
4164
|
-
|
4152
|
+
Args:
|
4165
4153
|
exit_code: Set to something other than 0 to mark a run as failed
|
4166
4154
|
quiet: Set to true to minimize log output
|
4167
4155
|
"""
|
wandb/sdk/wandb_settings.py
CHANGED
@@ -48,9 +48,8 @@ from wandb.sdk.lib._settings_toposort_generated import SETTINGS_TOPOLOGICALLY_SO
|
|
48
48
|
from wandb.sdk.lib.run_moment import RunMoment
|
49
49
|
from wandb.sdk.wandb_setup import _EarlyLogger
|
50
50
|
|
51
|
-
from .lib import apikey
|
51
|
+
from .lib import apikey, ipython
|
52
52
|
from .lib.gitlib import GitRepo
|
53
|
-
from .lib.ipython import _get_python_type
|
54
53
|
from .lib.runid import generate_id
|
55
54
|
|
56
55
|
if sys.version_info >= (3, 8):
|
@@ -690,11 +689,11 @@ class Settings(SettingsData):
|
|
690
689
|
_internal_check_process={"value": 8, "preprocessor": float},
|
691
690
|
_internal_queue_timeout={"value": 2, "preprocessor": float},
|
692
691
|
_ipython={
|
693
|
-
"hook": lambda _:
|
692
|
+
"hook": lambda _: ipython.in_ipython(),
|
694
693
|
"auto_hook": True,
|
695
694
|
},
|
696
695
|
_jupyter={
|
697
|
-
"hook": lambda _:
|
696
|
+
"hook": lambda _: ipython.in_jupyter(),
|
698
697
|
"auto_hook": True,
|
699
698
|
},
|
700
699
|
_kaggle={"hook": lambda _: util._is_likely_kaggle(), "auto_hook": True},
|
wandb/sdk/wandb_sync.py
CHANGED
wandb/util.py
CHANGED
@@ -84,7 +84,6 @@ _not_importable = set()
|
|
84
84
|
|
85
85
|
MAX_LINE_BYTES = (10 << 20) - (100 << 10) # imposed by back end
|
86
86
|
IS_GIT = os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git"))
|
87
|
-
RE_WINFNAMES = re.compile(r'[<>:"\\?*]')
|
88
87
|
|
89
88
|
# From https://docs.docker.com/engine/reference/commandline/tag/
|
90
89
|
# "Name components may contain lowercase letters, digits and separators.
|
@@ -881,6 +880,23 @@ def no_retry_4xx(e: Exception) -> bool:
|
|
881
880
|
raise UsageError(body["errors"][0]["message"])
|
882
881
|
|
883
882
|
|
883
|
+
def parse_backend_error_messages(response: requests.Response) -> List[str]:
|
884
|
+
errors: List[str] = []
|
885
|
+
try:
|
886
|
+
data = response.json()
|
887
|
+
except ValueError:
|
888
|
+
return errors
|
889
|
+
|
890
|
+
if "errors" in data and isinstance(data["errors"], list):
|
891
|
+
for error in data["errors"]:
|
892
|
+
# Our tests and potentially some api endpoints return a string error?
|
893
|
+
if isinstance(error, str):
|
894
|
+
error = {"message": error}
|
895
|
+
if "message" in error:
|
896
|
+
errors.append(error["message"])
|
897
|
+
return errors
|
898
|
+
|
899
|
+
|
884
900
|
def no_retry_auth(e: Any) -> bool:
|
885
901
|
if hasattr(e, "exception"):
|
886
902
|
e = e.exception
|
@@ -894,7 +910,9 @@ def no_retry_auth(e: Any) -> bool:
|
|
894
910
|
# Retry all non-forbidden/unauthorized/not-found errors.
|
895
911
|
if e.response.status_code not in (401, 403, 404):
|
896
912
|
return True
|
897
|
-
|
913
|
+
|
914
|
+
# Crash with more informational message on forbidden/unauthorized errors.
|
915
|
+
# UnauthorizedError
|
898
916
|
if e.response.status_code == 401:
|
899
917
|
raise AuthenticationError(
|
900
918
|
"The API key you provided is either invalid or missing. "
|
@@ -904,15 +922,29 @@ def no_retry_auth(e: Any) -> bool:
|
|
904
922
|
"If you're not sure, you can try logging in again using the 'wandb login --relogin --host [hostname]' command."
|
905
923
|
f"(Error {e.response.status_code}: {e.response.reason})"
|
906
924
|
)
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
925
|
+
# ForbiddenError
|
926
|
+
if e.response.status_code == 403:
|
927
|
+
if wandb.run:
|
928
|
+
raise CommError(f"Permission denied to access {wandb.run.path}")
|
929
|
+
else:
|
930
|
+
raise CommError(
|
931
|
+
"It appears that you do not have permission to access the requested resource. "
|
932
|
+
"Please reach out to the project owner to grant you access. "
|
933
|
+
"If you have the correct permissions, verify that there are no issues with your networking setup."
|
934
|
+
f"(Error {e.response.status_code}: {e.response.reason})"
|
935
|
+
)
|
936
|
+
|
937
|
+
# NotFoundError
|
938
|
+
if e.response.status_code == 404:
|
939
|
+
# If error message is empty, raise a more generic NotFoundError message.
|
940
|
+
if parse_backend_error_messages(e.response):
|
941
|
+
return False
|
942
|
+
else:
|
943
|
+
raise LookupError(
|
944
|
+
f"Failed to find resource. Please make sure you have the correct resource path. "
|
945
|
+
f"(Error {e.response.status_code}: {e.response.reason})"
|
946
|
+
)
|
947
|
+
return False
|
916
948
|
|
917
949
|
|
918
950
|
def check_retry_conflict(e: Any) -> Optional[bool]:
|
@@ -956,7 +988,7 @@ def make_check_retry_fn(
|
|
956
988
|
) -> CheckRetryFnType:
|
957
989
|
"""Return a check_retry_fn which can be used by lib.Retry().
|
958
990
|
|
959
|
-
|
991
|
+
Args:
|
960
992
|
fallback_fn: Use this function if check_fn didn't decide if a retry should happen.
|
961
993
|
check_fn: Function which returns bool if retry should happen or None if unsure.
|
962
994
|
check_timedelta: Optional retry timeout if we check_fn matches the exception
|
@@ -978,7 +1010,7 @@ def make_check_retry_fn(
|
|
978
1010
|
def find_runner(program: str) -> Union[None, list, List[str]]:
|
979
1011
|
"""Return a command that will run program.
|
980
1012
|
|
981
|
-
|
1013
|
+
Args:
|
982
1014
|
program: The string name of the program to try to run.
|
983
1015
|
|
984
1016
|
Returns:
|
@@ -1283,7 +1315,7 @@ def prompt_choices(
|
|
1283
1315
|
def guess_data_type(shape: Sequence[int], risky: bool = False) -> Optional[str]:
|
1284
1316
|
"""Infer the type of data based on the shape of the tensors.
|
1285
1317
|
|
1286
|
-
|
1318
|
+
Args:
|
1287
1319
|
shape (Sequence[int]): The shape of the data
|
1288
1320
|
risky(bool): some guesses are more likely to be wrong.
|
1289
1321
|
"""
|
@@ -1563,10 +1595,6 @@ def _is_py_requirements_or_dockerfile(path: str) -> bool:
|
|
1563
1595
|
)
|
1564
1596
|
|
1565
1597
|
|
1566
|
-
def check_windows_valid_filename(path: Union[int, str]) -> bool:
|
1567
|
-
return not bool(re.search(RE_WINFNAMES, path)) # type: ignore
|
1568
|
-
|
1569
|
-
|
1570
1598
|
def artifact_to_json(artifact: "Artifact") -> Dict[str, Any]:
|
1571
1599
|
return {
|
1572
1600
|
"_type": "artifactVersion",
|
wandb/wandb_agent.py
CHANGED
@@ -19,6 +19,7 @@ from wandb import util, wandb_lib, wandb_sdk
|
|
19
19
|
from wandb.agents.pyagent import pyagent
|
20
20
|
from wandb.apis import InternalApi
|
21
21
|
from wandb.sdk.launch.sweeps import utils as sweep_utils
|
22
|
+
from wandb.sdk.lib import ipython
|
22
23
|
|
23
24
|
logger = logging.getLogger(__name__)
|
24
25
|
|
@@ -546,7 +547,7 @@ def agent(
|
|
546
547
|
is a part of, what function to execute, and (optionally) how
|
547
548
|
many agents to run.
|
548
549
|
|
549
|
-
|
550
|
+
Args:
|
550
551
|
sweep_id: The unique identifier for a sweep. A sweep ID
|
551
552
|
is generated by W&B CLI or Python SDK.
|
552
553
|
function: A function to call instead of the "program"
|
@@ -568,11 +569,10 @@ def agent(
|
|
568
569
|
wandb_sdk.wandb_login._login(_silent=True)
|
569
570
|
if function:
|
570
571
|
return pyagent(sweep_id, function, entity, project, count)
|
571
|
-
in_jupyter = wandb.wandb_sdk.lib.ipython._get_python_type() != "python"
|
572
572
|
return run_agent(
|
573
573
|
sweep_id,
|
574
574
|
function=function,
|
575
|
-
in_jupyter=in_jupyter,
|
575
|
+
in_jupyter=ipython.in_jupyter(),
|
576
576
|
entity=entity,
|
577
577
|
project=project,
|
578
578
|
count=count,
|
wandb/wandb_controller.py
CHANGED
@@ -88,8 +88,6 @@ def _id_generator(size=10, chars=string.ascii_lowercase + string.digits):
|
|
88
88
|
class ControllerError(Exception):
|
89
89
|
"""Base class for sweep errors."""
|
90
90
|
|
91
|
-
pass
|
92
|
-
|
93
91
|
|
94
92
|
class _WandbController:
|
95
93
|
"""Sweep controller class.
|
@@ -309,6 +307,8 @@ class _WandbController:
|
|
309
307
|
self._create["parameters"][name]["value"] = value
|
310
308
|
if values is not None:
|
311
309
|
self._create["parameters"][name]["values"] = values
|
310
|
+
if distribution is not None:
|
311
|
+
self._create["parameters"][name]["distribution"] = distribution
|
312
312
|
if min is not None:
|
313
313
|
self._create["parameters"][name]["min"] = min
|
314
314
|
if max is not None:
|