wandb 0.16.6__py3-none-any.whl → 0.17.0rc2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- package_readme.md +95 -0
- wandb/__init__.py +2 -2
- wandb/agents/pyagent.py +0 -1
- wandb/analytics/sentry.py +2 -1
- wandb/apis/importers/internals/protocols.py +30 -56
- wandb/apis/importers/mlflow.py +13 -26
- wandb/apis/importers/wandb.py +8 -14
- wandb/apis/public/api.py +1 -0
- wandb/apis/public/artifacts.py +1 -0
- wandb/apis/public/files.py +1 -0
- wandb/apis/public/history.py +1 -0
- wandb/apis/public/jobs.py +1 -0
- wandb/apis/public/projects.py +1 -0
- wandb/apis/public/reports.py +1 -0
- wandb/apis/public/runs.py +1 -0
- wandb/apis/public/sweeps.py +1 -0
- wandb/apis/public/teams.py +1 -0
- wandb/apis/public/users.py +1 -0
- wandb/apis/reports/v1/_blocks.py +3 -7
- wandb/apis/reports/v2/gql.py +1 -0
- wandb/apis/reports/v2/interface.py +3 -4
- wandb/apis/reports/v2/internal.py +5 -8
- wandb/cli/cli.py +2 -2
- wandb/data_types.py +9 -6
- wandb/docker/__init__.py +1 -1
- wandb/env.py +38 -8
- wandb/errors/__init__.py +5 -0
- wandb/integration/catboost/catboost.py +1 -1
- wandb/integration/fastai/__init__.py +1 -0
- wandb/integration/huggingface/resolver.py +2 -2
- wandb/integration/keras/__init__.py +1 -0
- wandb/integration/keras/callbacks/metrics_logger.py +1 -1
- wandb/integration/keras/keras.py +7 -7
- wandb/integration/langchain/wandb_tracer.py +1 -0
- wandb/integration/lightning/fabric/logger.py +1 -3
- wandb/integration/metaflow/metaflow.py +41 -6
- wandb/integration/openai/fine_tuning.py +3 -3
- wandb/keras/__init__.py +1 -0
- wandb/old/summary.py +1 -1
- wandb/plot/confusion_matrix.py +1 -1
- wandb/plots/precision_recall.py +1 -1
- wandb/plots/roc.py +1 -1
- wandb/proto/v3/wandb_internal_pb2.py +364 -332
- wandb/proto/v3/wandb_settings_pb2.py +1 -1
- wandb/proto/v4/wandb_internal_pb2.py +322 -316
- wandb/proto/v4/wandb_settings_pb2.py +1 -1
- wandb/proto/wandb_internal_codegen.py +0 -25
- wandb/sdk/artifacts/artifact.py +16 -4
- wandb/sdk/artifacts/artifact_download_logger.py +1 -0
- wandb/sdk/artifacts/artifact_file_cache.py +18 -4
- wandb/sdk/artifacts/artifact_instance_cache.py +1 -0
- wandb/sdk/artifacts/artifact_manifest.py +1 -0
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -0
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -0
- wandb/sdk/artifacts/artifact_saver.py +5 -2
- wandb/sdk/artifacts/artifact_state.py +1 -0
- wandb/sdk/artifacts/artifact_ttl.py +1 -0
- wandb/sdk/artifacts/exceptions.py +1 -0
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +13 -18
- wandb/sdk/artifacts/storage_handlers/http_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +5 -3
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +1 -0
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +1 -0
- wandb/sdk/artifacts/storage_policy.py +1 -0
- wandb/sdk/data_types/_dtypes.py +8 -8
- wandb/sdk/data_types/base_types/media.py +3 -6
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +3 -1
- wandb/sdk/data_types/image.py +1 -1
- wandb/sdk/data_types/video.py +1 -1
- wandb/sdk/integration_utils/auto_logging.py +5 -6
- wandb/sdk/integration_utils/data_logging.py +10 -6
- wandb/sdk/interface/interface.py +55 -32
- wandb/sdk/interface/interface_shared.py +7 -13
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/handler.py +18 -2
- wandb/sdk/internal/internal.py +0 -1
- wandb/sdk/internal/internal_util.py +0 -1
- wandb/sdk/internal/job_builder.py +5 -4
- wandb/sdk/internal/profiler.py +1 -0
- wandb/sdk/internal/run.py +1 -0
- wandb/sdk/internal/sender.py +1 -1
- wandb/sdk/internal/system/assets/gpu_amd.py +44 -44
- wandb/sdk/internal/system/assets/gpu_apple.py +56 -11
- wandb/sdk/internal/system/assets/interfaces.py +6 -8
- wandb/sdk/internal/system/assets/open_metrics.py +2 -2
- wandb/sdk/internal/system/assets/trainium.py +1 -3
- wandb/sdk/launch/_project_spec.py +8 -4
- wandb/sdk/launch/agent/agent.py +2 -1
- wandb/sdk/launch/agent/config.py +72 -11
- wandb/sdk/launch/builder/abstract.py +2 -1
- wandb/sdk/launch/builder/build.py +29 -2
- wandb/sdk/launch/builder/docker_builder.py +1 -0
- wandb/sdk/launch/builder/kaniko_builder.py +2 -2
- wandb/sdk/launch/builder/noop.py +1 -0
- wandb/sdk/launch/create_job.py +18 -0
- wandb/sdk/launch/environment/abstract.py +1 -0
- wandb/sdk/launch/environment/gcp_environment.py +1 -0
- wandb/sdk/launch/environment/local_environment.py +1 -0
- wandb/sdk/launch/loader.py +1 -0
- wandb/sdk/launch/registry/abstract.py +1 -0
- wandb/sdk/launch/registry/azure_container_registry.py +1 -0
- wandb/sdk/launch/registry/elastic_container_registry.py +1 -0
- wandb/sdk/launch/registry/google_artifact_registry.py +2 -1
- wandb/sdk/launch/registry/local_registry.py +1 -0
- wandb/sdk/launch/runner/abstract.py +1 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +4 -3
- wandb/sdk/launch/runner/sagemaker_runner.py +11 -10
- wandb/sdk/launch/sweeps/scheduler.py +4 -3
- wandb/sdk/launch/sweeps/scheduler_sweep.py +2 -1
- wandb/sdk/launch/sweeps/utils.py +3 -3
- wandb/sdk/launch/utils.py +3 -3
- wandb/sdk/lib/fsm.py +8 -12
- wandb/sdk/lib/gitlib.py +4 -4
- wandb/sdk/lib/import_hooks.py +1 -1
- wandb/sdk/lib/lazyloader.py +0 -1
- wandb/sdk/lib/proto_util.py +1 -1
- wandb/sdk/lib/redirect.py +19 -14
- wandb/sdk/lib/retry.py +3 -2
- wandb/sdk/lib/tracelog.py +1 -1
- wandb/sdk/service/service.py +17 -15
- wandb/sdk/verify/verify.py +2 -1
- wandb/sdk/wandb_manager.py +2 -2
- wandb/sdk/wandb_require.py +5 -0
- wandb/sdk/wandb_run.py +25 -20
- wandb/sdk/wandb_settings.py +0 -1
- wandb/sdk/wandb_setup.py +1 -1
- wandb/sklearn/__init__.py +1 -0
- wandb/sklearn/plot/__init__.py +1 -0
- wandb/sklearn/plot/classifier.py +7 -6
- wandb/sklearn/plot/clusterer.py +2 -1
- wandb/sklearn/plot/regressor.py +1 -0
- wandb/sklearn/plot/shared.py +1 -0
- wandb/sklearn/utils.py +1 -0
- wandb/testing/relay.py +4 -4
- wandb/trigger.py +1 -0
- wandb/util.py +40 -17
- wandb/wandb_controller.py +2 -3
- wandb/wandb_torch.py +1 -2
- {wandb-0.16.6.dist-info → wandb-0.17.0rc2.dist-info}/METADATA +68 -69
- {wandb-0.16.6.dist-info → wandb-0.17.0rc2.dist-info}/RECORD +149 -150
- {wandb-0.16.6.dist-info → wandb-0.17.0rc2.dist-info}/WHEEL +1 -2
- wandb/bin/apple_gpu_stats +0 -0
- wandb-0.16.6.dist-info/top_level.txt +0 -1
- {wandb-0.16.6.dist-info → wandb-0.17.0rc2.dist-info}/entry_points.txt +0 -0
- {wandb-0.16.6.dist-info → wandb-0.17.0rc2.dist-info/licenses}/LICENSE +0 -0
wandb/sdk/lib/redirect.py
CHANGED
@@ -224,7 +224,7 @@ class TerminalEmulator:
|
|
224
224
|
def carriage_return(self):
|
225
225
|
self.cursor.x = 0
|
226
226
|
|
227
|
-
def
|
227
|
+
def cursor_position(self, line, column):
|
228
228
|
self.cursor.x = min(column, 1) - 1
|
229
229
|
self.cursor.y = min(line, 1) - 1
|
230
230
|
|
@@ -393,25 +393,30 @@ class TerminalEmulator:
|
|
393
393
|
p = (int(p[0]), 1)
|
394
394
|
else:
|
395
395
|
p = (1, 1)
|
396
|
-
self.
|
396
|
+
self.cursor_position(*p)
|
397
397
|
except Exception:
|
398
398
|
pass
|
399
399
|
|
400
400
|
def _get_line(self, n):
|
401
401
|
line = self.buffer[n]
|
402
402
|
line_len = self._get_line_len(n)
|
403
|
-
# We have to loop through each character in the line and check if foreground,
|
404
|
-
# other attributes (italics, bold, underline, etc) of the ith
|
405
|
-
# (i-1)th character. If different, the
|
406
|
-
#
|
407
|
-
#
|
408
|
-
#
|
409
|
-
|
410
|
-
#
|
411
|
-
#
|
412
|
-
|
413
|
-
#
|
414
|
-
#
|
403
|
+
# We have to loop through each character in the line and check if foreground,
|
404
|
+
# background and other attributes (italics, bold, underline, etc) of the ith
|
405
|
+
# character are different from those of the (i-1)th character. If different, the
|
406
|
+
# appropriate ascii character for switching the color/attribute should be
|
407
|
+
# appended to the output string before appending the actual character. This loop
|
408
|
+
# and subsequent checks can be expensive, especially because 99% of terminal
|
409
|
+
# output use default colors and formatting. Even in outputs that do contain
|
410
|
+
# colors and styles, its unlikely that they will change on a per character
|
411
|
+
# basis.
|
412
|
+
|
413
|
+
# So instead we create a character list without any ascii codes (`out`), and a
|
414
|
+
# list of all the foregrounds in the line (`fgs`) on which we call np.diff() and
|
415
|
+
# np.where() to find the indices where the foreground change, and insert the
|
416
|
+
# ascii characters in the output list (`out`) on those indices. All of this is
|
417
|
+
# the done only if there are more than 1 foreground color in the line in the
|
418
|
+
# first place (`if len(set(fgs)) > 1 else None`). Same logic is repeated for
|
419
|
+
# background colors and other attributes.
|
415
420
|
|
416
421
|
out = [line[i].data for i in range(line_len)]
|
417
422
|
|
wandb/sdk/lib/retry.py
CHANGED
@@ -248,8 +248,9 @@ class ExponentialBackoff(Backoff):
|
|
248
248
|
if self._timeout_at is not None and NOW_FN() > self._timeout_at:
|
249
249
|
raise exc
|
250
250
|
|
251
|
-
result, self._next_sleep =
|
252
|
-
self.
|
251
|
+
result, self._next_sleep = (
|
252
|
+
self._next_sleep,
|
253
|
+
min(self._max_sleep, self._next_sleep * (1 + random.random())),
|
253
254
|
)
|
254
255
|
|
255
256
|
return result
|
wandb/sdk/lib/tracelog.py
CHANGED
@@ -6,7 +6,7 @@ Functions:
|
|
6
6
|
log_message_send - message sent to socket
|
7
7
|
log_message_recv - message received from socket
|
8
8
|
log_message_process - message processed by thread
|
9
|
-
log_message_link - message linked to another
|
9
|
+
log_message_link - message linked to another message
|
10
10
|
log_message_assert - message encountered problem
|
11
11
|
|
12
12
|
"""
|
wandb/sdk/service/service.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
Backend server process can be connected to using tcp sockets transport.
|
4
4
|
"""
|
5
|
+
|
5
6
|
import datetime
|
6
7
|
import os
|
7
8
|
import pathlib
|
@@ -14,8 +15,8 @@ import time
|
|
14
15
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
15
16
|
|
16
17
|
from wandb import _sentry, termlog
|
17
|
-
from wandb.env import
|
18
|
-
from wandb.errors import Error
|
18
|
+
from wandb.env import core_debug, core_error_reporting_enabled, is_require_core
|
19
|
+
from wandb.errors import Error, WandbCoreNotAvailableError
|
19
20
|
from wandb.sdk.lib.wburls import wburls
|
20
21
|
from wandb.util import get_core_path, get_module
|
21
22
|
|
@@ -161,28 +162,29 @@ class _Service:
|
|
161
162
|
exec_cmd_list += ["coverage", "run", "-m"]
|
162
163
|
|
163
164
|
service_args = []
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
165
|
+
|
166
|
+
if is_require_core():
|
167
|
+
try:
|
168
|
+
core_path = get_core_path()
|
169
|
+
except WandbCoreNotAvailableError as e:
|
170
|
+
_sentry.reraise(e)
|
171
|
+
|
171
172
|
service_args.extend([core_path])
|
172
|
-
|
173
|
+
|
174
|
+
if not core_error_reporting_enabled(default="True"):
|
173
175
|
service_args.append("--no-observability")
|
174
|
-
|
176
|
+
|
177
|
+
if core_debug(default="False"):
|
175
178
|
service_args.append("--debug")
|
179
|
+
|
176
180
|
trace_filename = os.environ.get("_WANDB_TRACE")
|
177
181
|
if trace_filename is not None:
|
178
182
|
service_args.extend(["--trace", trace_filename])
|
179
183
|
|
180
184
|
exec_cmd_list = []
|
181
|
-
# TODO: remove this after the wandb-core GA release
|
182
|
-
wandb_core = get_module("wandb_core")
|
183
185
|
termlog(
|
184
|
-
|
185
|
-
f"Please refer to {wburls.get('wandb_core')} for more information.",
|
186
|
+
"Using wandb-core as the SDK backend."
|
187
|
+
f" Please refer to {wburls.get('wandb_core')} for more information.",
|
186
188
|
repeat=False,
|
187
189
|
)
|
188
190
|
else:
|
wandb/sdk/verify/verify.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Utilities for wandb verify."""
|
2
|
+
|
2
3
|
import getpass
|
3
4
|
import os
|
4
5
|
import time
|
@@ -20,7 +21,7 @@ PROJECT_NAME = "verify"
|
|
20
21
|
GET_RUN_MAX_TIME = 10
|
21
22
|
MIN_RETRYS = 3
|
22
23
|
CHECKMARK = "\u2705"
|
23
|
-
RED_X = "\
|
24
|
+
RED_X = "\u274c"
|
24
25
|
ID_PREFIX = runid.generate_id()
|
25
26
|
|
26
27
|
|
wandb/sdk/wandb_manager.py
CHANGED
@@ -5,7 +5,7 @@ Create a manager channel.
|
|
5
5
|
|
6
6
|
import atexit
|
7
7
|
import os
|
8
|
-
from typing import TYPE_CHECKING,
|
8
|
+
from typing import TYPE_CHECKING, Callable, Optional
|
9
9
|
|
10
10
|
import psutil
|
11
11
|
|
@@ -205,7 +205,7 @@ class _Manager:
|
|
205
205
|
svc_iface = self._get_service_interface()
|
206
206
|
svc_iface._svc_inform_start(settings=settings, run_id=run_id)
|
207
207
|
|
208
|
-
def _inform_attach(self, attach_id: str) -> Optional[
|
208
|
+
def _inform_attach(self, attach_id: str) -> Optional["wandb_settings_pb2.Settings"]:
|
209
209
|
svc_iface = self._get_service_interface()
|
210
210
|
try:
|
211
211
|
response = svc_iface._svc_inform_attach(attach_id=attach_id)
|
wandb/sdk/wandb_require.py
CHANGED
@@ -9,9 +9,11 @@ Example:
|
|
9
9
|
wandb.require("incremental-artifacts@beta")
|
10
10
|
"""
|
11
11
|
|
12
|
+
import os
|
12
13
|
from typing import Optional, Sequence, Union
|
13
14
|
|
14
15
|
import wandb
|
16
|
+
from wandb.env import _REQUIRE_CORE
|
15
17
|
from wandb.errors import UnsupportedError
|
16
18
|
from wandb.sdk import wandb_run
|
17
19
|
from wandb.sdk.lib.wburls import wburls
|
@@ -38,6 +40,9 @@ class _Requires:
|
|
38
40
|
def require_service(self) -> None:
|
39
41
|
self._require_service()
|
40
42
|
|
43
|
+
def require_core(self) -> None:
|
44
|
+
os.environ[_REQUIRE_CORE] = "true"
|
45
|
+
|
41
46
|
def apply(self) -> None:
|
42
47
|
"""Call require_* method for supported features."""
|
43
48
|
last_message: str = ""
|
wandb/sdk/wandb_run.py
CHANGED
@@ -327,8 +327,7 @@ class RunStatusChecker:
|
|
327
327
|
class _run_decorator: # noqa: N801
|
328
328
|
_is_attaching: str = ""
|
329
329
|
|
330
|
-
class Dummy:
|
331
|
-
...
|
330
|
+
class Dummy: ...
|
332
331
|
|
333
332
|
@classmethod
|
334
333
|
def _attach(cls, func: Callable) -> Callable:
|
@@ -1854,7 +1853,7 @@ class Run:
|
|
1854
1853
|
picked up automatically.
|
1855
1854
|
|
1856
1855
|
A `base_path` may be provided to control the directory structure of
|
1857
|
-
uploaded files. It should be a prefix of `glob_str`, and the
|
1856
|
+
uploaded files. It should be a prefix of `glob_str`, and the directory
|
1858
1857
|
structure beneath it is preserved. It's best understood through
|
1859
1858
|
examples:
|
1860
1859
|
|
@@ -1866,16 +1865,19 @@ class Run:
|
|
1866
1865
|
# => Saves files in an "are/myfiles/" folder in the run.
|
1867
1866
|
|
1868
1867
|
wandb.save("/User/username/Documents/run123/*.txt")
|
1869
|
-
# => Saves files in a "run123/" folder in the run.
|
1868
|
+
# => Saves files in a "run123/" folder in the run. See note below.
|
1870
1869
|
|
1871
1870
|
wandb.save("/User/username/Documents/run123/*.txt", base_path="/User")
|
1872
1871
|
# => Saves files in a "username/Documents/run123/" folder in the run.
|
1873
1872
|
|
1874
1873
|
wandb.save("files/*/saveme.txt")
|
1875
1874
|
# => Saves each "saveme.txt" file in an appropriate subdirectory
|
1876
|
-
#
|
1875
|
+
# of "files/".
|
1877
1876
|
```
|
1878
1877
|
|
1878
|
+
Note: when given an absolute path or glob and no `base_path`, one
|
1879
|
+
directory level is preserved as in the example above.
|
1880
|
+
|
1879
1881
|
Arguments:
|
1880
1882
|
glob_str: A relative or absolute path or Unix glob.
|
1881
1883
|
base_path: A path to use to infer a directory structure; see examples.
|
@@ -1909,7 +1911,11 @@ class Run:
|
|
1909
1911
|
# Provide a better error message for a common misuse.
|
1910
1912
|
wandb.termlog(f"{glob_str} is a cloud storage url, can't save file to W&B.")
|
1911
1913
|
return []
|
1912
|
-
|
1914
|
+
# NOTE: We use PurePath instead of Path because WindowsPath doesn't
|
1915
|
+
# like asterisks and errors out in resolve(). It also makes logical
|
1916
|
+
# sense: globs aren't real paths, they're just path-like strings.
|
1917
|
+
glob_path = pathlib.PurePath(glob_str)
|
1918
|
+
resolved_glob_path = pathlib.PurePath(os.path.abspath(glob_path))
|
1913
1919
|
|
1914
1920
|
if base_path is not None:
|
1915
1921
|
base_path = pathlib.Path(base_path)
|
@@ -1923,15 +1929,14 @@ class Run:
|
|
1923
1929
|
'wandb.save("/mnt/folder/file.h5", base_path="/mnt")',
|
1924
1930
|
repeat=False,
|
1925
1931
|
)
|
1926
|
-
base_path =
|
1932
|
+
base_path = resolved_glob_path.parent.parent
|
1927
1933
|
|
1928
1934
|
if policy not in ("live", "end", "now"):
|
1929
1935
|
raise ValueError(
|
1930
1936
|
'Only "live", "end" and "now" policies are currently supported.'
|
1931
1937
|
)
|
1932
1938
|
|
1933
|
-
|
1934
|
-
resolved_base_path = base_path.resolve()
|
1939
|
+
resolved_base_path = pathlib.PurePath(os.path.abspath(base_path))
|
1935
1940
|
|
1936
1941
|
return self._save(
|
1937
1942
|
resolved_glob_path,
|
@@ -1941,8 +1946,8 @@ class Run:
|
|
1941
1946
|
|
1942
1947
|
def _save(
|
1943
1948
|
self,
|
1944
|
-
glob_path: pathlib.
|
1945
|
-
base_path: pathlib.
|
1949
|
+
glob_path: pathlib.PurePath,
|
1950
|
+
base_path: pathlib.PurePath,
|
1946
1951
|
policy: "PolicyName",
|
1947
1952
|
) -> List[str]:
|
1948
1953
|
# Can't use is_relative_to() because that's added in Python 3.9,
|
@@ -3171,13 +3176,13 @@ class Run:
|
|
3171
3176
|
)
|
3172
3177
|
if entity and artifact._source_entity and entity != artifact._source_entity:
|
3173
3178
|
raise ValueError(
|
3174
|
-
f"Artifact {artifact.name} is owned by entity
|
3175
|
-
f"moved to '{
|
3179
|
+
f"Artifact {artifact.name} is owned by entity "
|
3180
|
+
f"'{artifact._source_entity}'; it can't be moved to '{entity}'"
|
3176
3181
|
)
|
3177
3182
|
if project and artifact._source_project and project != artifact._source_project:
|
3178
3183
|
raise ValueError(
|
3179
|
-
f"Artifact {artifact.name} exists in project
|
3180
|
-
f"moved to '{
|
3184
|
+
f"Artifact {artifact.name} exists in project "
|
3185
|
+
f"'{artifact._source_project}'; it can't be moved to '{project}'"
|
3181
3186
|
)
|
3182
3187
|
|
3183
3188
|
def _prepare_artifact(
|
@@ -3304,8 +3309,8 @@ class Run:
|
|
3304
3309
|
path: (str) path to downloaded model artifact file(s).
|
3305
3310
|
"""
|
3306
3311
|
artifact = self.use_artifact(artifact_or_name=name)
|
3307
|
-
assert
|
3308
|
-
artifact.type.lower()
|
3312
|
+
assert (
|
3313
|
+
"model" in str(artifact.type.lower())
|
3309
3314
|
), "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'."
|
3310
3315
|
path = artifact.download()
|
3311
3316
|
|
@@ -3397,8 +3402,8 @@ class Run:
|
|
3397
3402
|
public_api = self._public_api()
|
3398
3403
|
try:
|
3399
3404
|
artifact = public_api.artifact(name=f"{name}:latest")
|
3400
|
-
assert
|
3401
|
-
artifact.type.lower()
|
3405
|
+
assert (
|
3406
|
+
"model" in str(artifact.type.lower())
|
3402
3407
|
), "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'."
|
3403
3408
|
artifact = self._log_artifact(
|
3404
3409
|
artifact_or_path=path, name=name, type=artifact.type
|
@@ -3656,7 +3661,7 @@ class Run:
|
|
3656
3661
|
# FOOTER
|
3657
3662
|
# ------------------------------------------------------------------------------
|
3658
3663
|
# Note: All the footer methods are static methods since we want to share the printing logic
|
3659
|
-
# with the service execution path that doesn't have
|
3664
|
+
# with the service execution path that doesn't have access to the run instance
|
3660
3665
|
@staticmethod
|
3661
3666
|
def _footer(
|
3662
3667
|
sampled_history: Optional["SampledHistoryResponse"] = None,
|
wandb/sdk/wandb_settings.py
CHANGED
@@ -1675,7 +1675,6 @@ class Settings(SettingsData):
|
|
1675
1675
|
"WANDB_TRACELOG": "_tracelog",
|
1676
1676
|
"WANDB_DISABLE_SERVICE": "_disable_service",
|
1677
1677
|
"WANDB_SERVICE_TRANSPORT": "_service_transport",
|
1678
|
-
"WANDB_REQUIRE_CORE": "_require_core",
|
1679
1678
|
"WANDB_DIR": "root_dir",
|
1680
1679
|
"WANDB_NAME": "run_name",
|
1681
1680
|
"WANDB_NOTES": "run_notes",
|
wandb/sdk/wandb_setup.py
CHANGED
wandb/sklearn/__init__.py
CHANGED
wandb/sklearn/plot/__init__.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Create and logs charts introspecting models built with scikit-learn to W&B."""
|
2
|
+
|
2
3
|
from .classifier import calibration_curve as plot_calibration_curve
|
3
4
|
from .classifier import class_proportions as plot_class_proportions
|
4
5
|
from .classifier import classifier as plot_classifier
|
wandb/sklearn/plot/classifier.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Define plots for classification models built with scikit-learn."""
|
2
|
+
|
2
3
|
from warnings import simplefilter
|
3
4
|
|
4
5
|
import numpy as np
|
@@ -32,9 +33,9 @@ def classifier(
|
|
32
33
|
|
33
34
|
The following plots are generated:
|
34
35
|
feature importances, confusion matrix, summary metrics,
|
35
|
-
class
|
36
|
+
class proportions, calibration curve, roc curve, precision-recall curve.
|
36
37
|
|
37
|
-
Should only be called with a fitted
|
38
|
+
Should only be called with a fitted classifier (otherwise an error is thrown).
|
38
39
|
|
39
40
|
Arguments:
|
40
41
|
model: (classifier) Takes in a fitted classifier.
|
@@ -44,7 +45,7 @@ def classifier(
|
|
44
45
|
y_test: (arr) Test set labels.
|
45
46
|
y_pred: (arr) Test set predictions by the model passed.
|
46
47
|
y_probas: (arr) Test set predicted probabilities by the model passed.
|
47
|
-
labels: (list) Named labels for target
|
48
|
+
labels: (list) Named labels for target variable (y). Makes plots easier to
|
48
49
|
read by replacing target values with corresponding index.
|
49
50
|
For example if `labels=['dog', 'cat', 'owl']` all 0s are
|
50
51
|
replaced by dog, 1s by cat.
|
@@ -224,7 +225,7 @@ def feature_importances(
|
|
224
225
|
):
|
225
226
|
"""Log a plot depicting the relative importance of each feature for a classifier's decisions.
|
226
227
|
|
227
|
-
Should only be called with a fitted
|
228
|
+
Should only be called with a fitted classifier (otherwise an error is thrown).
|
228
229
|
Only works with classifiers that have a feature_importances_ attribute, like trees.
|
229
230
|
|
230
231
|
Arguments:
|
@@ -251,7 +252,7 @@ def feature_importances(
|
|
251
252
|
|
252
253
|
|
253
254
|
def class_proportions(y_train=None, y_test=None, labels=None):
|
254
|
-
"""Plot the distribution of target
|
255
|
+
"""Plot the distribution of target classes in training and test sets.
|
255
256
|
|
256
257
|
Useful for detecting imbalanced classes.
|
257
258
|
|
@@ -295,7 +296,7 @@ def calibration_curve(clf=None, X=None, y=None, clf_name="Classifier"):
|
|
295
296
|
if so which calibration (sigmoid or isotonic) might help fix this.
|
296
297
|
For more details, see https://scikit-learn.org/stable/auto_examples/calibration/plot_calibration_curve.html.
|
297
298
|
|
298
|
-
Should only be called with a fitted
|
299
|
+
Should only be called with a fitted classifier (otherwise an error is thrown).
|
299
300
|
|
300
301
|
Please note this function fits variations of the model on the training set when called.
|
301
302
|
|
wandb/sklearn/plot/clusterer.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Define plots for clustering models built with scikit-learn."""
|
2
|
+
|
2
3
|
from warnings import simplefilter
|
3
4
|
|
4
5
|
import pandas as pd
|
@@ -24,7 +25,7 @@ def clusterer(model, X_train, cluster_labels, labels=None, model_name="Clusterer
|
|
24
25
|
X_train: (arr) Training set features.
|
25
26
|
cluster_labels: (list) Names for cluster labels. Makes plots easier to read
|
26
27
|
by replacing cluster indexes with corresponding names.
|
27
|
-
labels: (list) Named labels for target
|
28
|
+
labels: (list) Named labels for target variable (y). Makes plots easier to
|
28
29
|
read by replacing target values with corresponding index.
|
29
30
|
For example if `labels=['dog', 'cat', 'owl']` all 0s are
|
30
31
|
replaced by dog, 1s by cat.
|
wandb/sklearn/plot/regressor.py
CHANGED
wandb/sklearn/plot/shared.py
CHANGED
wandb/sklearn/utils.py
CHANGED
wandb/testing/relay.py
CHANGED
@@ -586,11 +586,11 @@ class InjectedResponse:
|
|
586
586
|
|
587
587
|
|
588
588
|
class RelayControlProtocol(Protocol):
|
589
|
-
def process(self, request: "flask.Request") -> None:
|
590
|
-
... # pragma: no cover
|
589
|
+
def process(self, request: "flask.Request") -> None: ... # pragma: no cover
|
591
590
|
|
592
|
-
def control(
|
593
|
-
|
591
|
+
def control(
|
592
|
+
self, request: "flask.Request"
|
593
|
+
) -> Mapping[str, str]: ... # pragma: no cover
|
594
594
|
|
595
595
|
|
596
596
|
class RelayServer:
|
wandb/trigger.py
CHANGED
wandb/util.py
CHANGED
@@ -11,6 +11,7 @@ import logging
|
|
11
11
|
import math
|
12
12
|
import numbers
|
13
13
|
import os
|
14
|
+
import pathlib
|
14
15
|
import platform
|
15
16
|
import queue
|
16
17
|
import random
|
@@ -55,7 +56,13 @@ import yaml
|
|
55
56
|
|
56
57
|
import wandb
|
57
58
|
import wandb.env
|
58
|
-
from wandb.errors import
|
59
|
+
from wandb.errors import (
|
60
|
+
AuthenticationError,
|
61
|
+
CommError,
|
62
|
+
UsageError,
|
63
|
+
WandbCoreNotAvailableError,
|
64
|
+
term,
|
65
|
+
)
|
59
66
|
from wandb.sdk.internal.thread_local_settings import _thread_local_api_settings
|
60
67
|
from wandb.sdk.lib import filesystem, runid
|
61
68
|
from wandb.sdk.lib.json_util import dump, dumps
|
@@ -1842,15 +1849,6 @@ def sample_with_exponential_decay_weights(
|
|
1842
1849
|
return sampled_xs, sampled_ys, sampled_keys
|
1843
1850
|
|
1844
1851
|
|
1845
|
-
def get_core_path() -> str:
|
1846
|
-
core_path: str = os.environ.get("_WANDB_CORE_PATH", "")
|
1847
|
-
wandb_core = get_module("wandb_core")
|
1848
|
-
if not core_path and wandb_core:
|
1849
|
-
_check_wandb_core_version_compatibility(wandb_core.__version__)
|
1850
|
-
core_path = wandb_core.get_core_path()
|
1851
|
-
return core_path
|
1852
|
-
|
1853
|
-
|
1854
1852
|
@dataclasses.dataclass(frozen=True)
|
1855
1853
|
class InstalledDistribution:
|
1856
1854
|
"""An installed distribution.
|
@@ -1888,15 +1886,40 @@ def parse_version(version: str) -> "packaging.version.Version":
|
|
1888
1886
|
try:
|
1889
1887
|
from packaging.version import parse as parse_version # type: ignore
|
1890
1888
|
except ImportError:
|
1891
|
-
from pkg_resources import parse_version
|
1889
|
+
from pkg_resources import parse_version # type: ignore[assignment]
|
1892
1890
|
|
1893
1891
|
return parse_version(version)
|
1894
1892
|
|
1895
1893
|
|
1896
|
-
def
|
1897
|
-
"""
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1894
|
+
def get_core_path() -> str:
|
1895
|
+
"""Returns the path to the wandb-core binary.
|
1896
|
+
|
1897
|
+
The path can be set explicitly via the _WANDB_CORE_PATH environment
|
1898
|
+
variable. Otherwise, the path to the binary in the current package
|
1899
|
+
is returned.
|
1900
|
+
|
1901
|
+
Returns:
|
1902
|
+
str: The path to the wandb-core package.
|
1903
|
+
|
1904
|
+
Raises:
|
1905
|
+
WandbCoreNotAvailableError: If wandb-core was not built for the current system.
|
1906
|
+
"""
|
1907
|
+
# NOTE: Environment variable _WANDB_CORE_PATH is a temporary development feature
|
1908
|
+
# to assist in running the core service from a live development directory.
|
1909
|
+
path_from_env: str = os.environ.get("_WANDB_CORE_PATH", "")
|
1910
|
+
if path_from_env:
|
1911
|
+
wandb.termwarn(
|
1912
|
+
f"Using wandb-core from path `_WANDB_CORE_PATH={path_from_env}`. "
|
1913
|
+
"This is a development feature and may not work as expected."
|
1914
|
+
)
|
1915
|
+
return path_from_env
|
1916
|
+
|
1917
|
+
bin_path = pathlib.Path(__file__).parent / "bin" / "wandb-core"
|
1918
|
+
if not bin_path.exists():
|
1919
|
+
raise WandbCoreNotAvailableError(
|
1920
|
+
f"Looks like wandb-core is not compiled for your system ({platform.platform()}):"
|
1921
|
+
" Please contact support at support@wandb.com to request `wandb-core`"
|
1922
|
+
" support for your system."
|
1902
1923
|
)
|
1924
|
+
|
1925
|
+
return str(bin_path)
|
wandb/wandb_controller.py
CHANGED
@@ -20,7 +20,7 @@ Example:
|
|
20
20
|
tuner = wandb.controller()
|
21
21
|
tuner.configure(sweep_config)
|
22
22
|
tuner.create()
|
23
|
-
# (3) create by constructing
|
23
|
+
# (3) create by constructing programmatic sweep configuration
|
24
24
|
tuner = wandb.controller()
|
25
25
|
tuner.configure_search('random')
|
26
26
|
tuner.configure_program('train-dummy.py')
|
@@ -47,7 +47,6 @@ Example:
|
|
47
47
|
tuner.stop_runs(runs)
|
48
48
|
"""
|
49
49
|
|
50
|
-
|
51
50
|
import json
|
52
51
|
import os
|
53
52
|
import random
|
@@ -128,7 +127,7 @@ class _WandbController:
|
|
128
127
|
"""
|
129
128
|
|
130
129
|
def __init__(self, sweep_id_or_config=None, entity=None, project=None):
|
131
|
-
# sweep id configured in
|
130
|
+
# sweep id configured in constructor
|
132
131
|
self._sweep_id: Optional[str] = None
|
133
132
|
|
134
133
|
# configured parameters
|