wandb 0.17.8rc1__py3-none-any.whl → 0.18.0__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.
- package_readme.md +47 -53
- wandb/__init__.py +8 -7
- wandb/__init__.pyi +134 -14
- wandb/analytics/sentry.py +1 -1
- wandb/bin/nvidia_gpu_stats +0 -0
- wandb/cli/cli.py +15 -10
- wandb/data_types.py +1 -0
- wandb/env.py +4 -3
- wandb/integration/keras/__init__.py +2 -5
- wandb/integration/keras/callbacks/metrics_logger.py +10 -4
- wandb/integration/keras/callbacks/model_checkpoint.py +0 -5
- wandb/integration/keras/keras.py +12 -1
- wandb/integration/openai/fine_tuning.py +5 -5
- wandb/integration/tensorboard/log.py +1 -4
- wandb/jupyter.py +18 -3
- wandb/proto/v3/wandb_internal_pb2.py +238 -228
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v4/wandb_internal_pb2.py +230 -228
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +12 -12
- wandb/proto/v5/wandb_internal_pb2.py +230 -228
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +12 -12
- wandb/proto/wandb_deprecated.py +4 -0
- wandb/sdk/__init__.py +1 -1
- wandb/sdk/artifacts/_validators.py +45 -0
- wandb/sdk/artifacts/artifact.py +109 -56
- wandb/sdk/artifacts/artifact_manifest_entry.py +10 -2
- wandb/sdk/artifacts/artifact_saver.py +6 -0
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +31 -0
- wandb/sdk/interface/interface.py +7 -4
- wandb/sdk/internal/internal_api.py +16 -6
- wandb/sdk/internal/sender.py +1 -0
- wandb/sdk/internal/system/assets/gpu_amd.py +11 -2
- wandb/sdk/internal/system/assets/trainium.py +2 -1
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/launch/inputs/internal.py +2 -2
- wandb/sdk/lib/_settings_toposort_generated.py +3 -3
- wandb/sdk/service/server_sock.py +1 -1
- wandb/sdk/service/service.py +6 -2
- wandb/sdk/wandb_init.py +12 -3
- wandb/sdk/wandb_login.py +1 -0
- wandb/sdk/wandb_manager.py +0 -3
- wandb/sdk/wandb_require.py +7 -2
- wandb/sdk/wandb_run.py +40 -14
- wandb/sdk/wandb_settings.py +32 -12
- wandb/sdk/wandb_setup.py +3 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.18.0.dist-info}/METADATA +52 -58
- {wandb-0.17.8rc1.dist-info → wandb-0.18.0.dist-info}/RECORD +54 -54
- wandb/testing/relay.py +0 -874
- /wandb/{viz.py → sdk/lib/viz.py} +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.18.0.dist-info}/WHEEL +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.18.0.dist-info}/entry_points.txt +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.18.0.dist-info}/licenses/LICENSE +0 -0
package_readme.md
CHANGED
@@ -4,92 +4,86 @@
|
|
4
4
|
|
5
5
|
# Weights and Biases [](https://pypi.python.org/pypi/wandb) [](https://anaconda.org/conda-forge/wandb) [](https://circleci.com/gh/wandb/wandb) [](https://codecov.io/gh/wandb/wandb)
|
6
6
|
|
7
|
-
Use W&B to build better models faster. Track and visualize all the pieces of your machine learning pipeline, from datasets to production models.
|
7
|
+
Use W&B to build better models faster. Track and visualize all the pieces of your machine learning pipeline, from datasets to production machine learning models. Get started with W&B today, [sign up for an account!](https://wandb.com?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=readme)
|
8
8
|
|
9
|
-
- Quickly identify model regressions. Use W&B to visualize results in real time, all in a central dashboard.
|
10
|
-
- Focus on the interesting ML. Spend less time manually tracking results in spreadsheets and text files.
|
11
|
-
- Capture dataset versions with W&B Artifacts to identify how changing data affects your resulting models.
|
12
|
-
- Reproduce any model, with saved code, hyperparameters, launch commands, input data, and resulting model weights.
|
13
9
|
|
14
|
-
[Sign up for a free account →](https://wandb.ai/login?signup=true)
|
15
10
|
|
16
|
-
|
11
|
+
See the [W&B Developer Guide](https://docs.wandb.ai/?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) and [API Reference Guide](https://docs.wandb.ai/ref?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) for a full technical description of the W&B platform.
|
17
12
|
|
18
|
-
|
19
|
-
- Search, compare, and visualize training runs
|
20
|
-
- Analyze system usage metrics alongside runs
|
21
|
-
- Collaborate with team members
|
22
|
-
- Replicate historic results
|
23
|
-
- Run parameter sweeps
|
24
|
-
- Keep records of experiments available forever
|
13
|
+
|
25
14
|
|
26
|
-
|
15
|
+
# Quickstart
|
27
16
|
|
28
|
-
|
17
|
+
Get started with W&B in four steps:
|
18
|
+
|
19
|
+
1. First, sign up for a [W&B account](https://wandb.ai/login?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=quickstart).
|
20
|
+
|
21
|
+
2. Second, install the W&B SDK with [pip](https://pip.pypa.io/en/stable/). Navigate to your terminal and type the following command:
|
29
22
|
|
30
23
|
```shell
|
31
24
|
pip install wandb
|
32
25
|
```
|
33
26
|
|
34
|
-
|
27
|
+
3. Third, log into W&B:
|
35
28
|
|
36
29
|
```python
|
37
|
-
|
30
|
+
wandb.login()
|
31
|
+
```
|
38
32
|
|
39
|
-
|
40
|
-
args = ...
|
33
|
+
4. Use the example code snippet below as a template to integrate W&B to your Python script:
|
41
34
|
|
42
|
-
|
43
|
-
wandb
|
35
|
+
```python
|
36
|
+
import wandb
|
44
37
|
|
38
|
+
# Start a W&B Run with wandb.init
|
39
|
+
run = wandb.init(project="my_first_project")
|
45
40
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
epoch, loss, val_loss = ...
|
50
|
-
# Framework agnostic / custom metrics
|
51
|
-
wandb.log({"epoch": epoch, "loss": loss, "val_loss": val_loss})
|
52
|
-
```
|
41
|
+
# Save model inputs and hyperparameters in a wandb.config object
|
42
|
+
config = run.config
|
43
|
+
config.learning_rate = 0.01
|
53
44
|
|
54
|
-
|
45
|
+
# Model training code here ...
|
55
46
|
|
56
|
-
|
57
|
-
|
47
|
+
# Log metrics over time to visualize performance with wandb.log
|
48
|
+
for i in range(10):
|
49
|
+
run.log({"loss": ...})
|
50
|
+
|
51
|
+
# Mark the run as finished, and finish uploading all data
|
52
|
+
run.finish()
|
58
53
|
```
|
59
54
|
|
60
|
-
|
55
|
+
For example, if the preceding code was stored in a script called train.py:
|
61
56
|
|
62
|
-
|
57
|
+
```shell
|
58
|
+
python train.py
|
59
|
+
```
|
63
60
|
|
64
|
-
|
61
|
+
You will see a URL in your terminal logs when your script starts and finishes. Data is staged locally in a directory named _wandb_ relative to your script. Navigate to the W&B App to view a dashboard of your first W&B Experiment. Use the W&B App to compare multiple experiments in a unified place, dive into the results of a single run, and much more!
|
65
62
|
|
66
|
-
|
63
|
+
|
67
64
|
|
68
|
-
|
65
|
+
# Integrations
|
69
66
|
|
70
|
-
|
71
|
-
[](https://youtu.be/EeqhOSvNX-A)
|
72
|
-
[Introduction video →](https://youtu.be/EeqhOSvNX-A)
|
67
|
+
Use your favorite framework with W&B. W&B integrations make it fast and easy to set up experiment tracking and data versioning inside existing projects. For more information on how to integrate W&B with the framework of your choice, see [W&B Integrations](https://docs.wandb.ai/guides/integrations) in the W&B Developer Guide.
|
73
68
|
|
74
|
-
|
69
|
+
|
75
70
|
|
76
|
-
|
71
|
+
# Contribution guidelines
|
72
|
+
Weights & Biases ❤️ open source, and we welcome contributions from the community! See the [Contribution guide](https://github.com/wandb/wandb/blob/main/CONTRIBUTING.md) for more information on the development workflow and the internals of the wandb library. For wandb bugs and feature requests, visit [GitHub Issues](https://github.com/wandb/wandb/issues) or contact support@wandb.com.
|
77
73
|
|
78
|
-
|
74
|
+
|
79
75
|
|
80
|
-
|
76
|
+
# Academic Researchers
|
77
|
+
Reach out to W&B Support at support@wandb.com to get a [free academic license](https://www.wandb.com/academic) for you and your research group.
|
81
78
|
|
82
|
-
|
79
|
+
|
83
80
|
|
84
|
-
#
|
85
|
-
If you'd like a free academic account for your research group, [reach out to us →](https://www.wandb.com/academic)
|
81
|
+
# W&B Community
|
86
82
|
|
87
|
-
|
88
|
-
[](https://www.wandb.com/academic)
|
83
|
+
Be a part of the growing W&B Community and interact with the W&B team in our [Discord](https://wandb.me/discord). Stay connected with the latest ML updates and tutorials with [W&B Fully Connected](https://wandb.ai/fully-connected).
|
89
84
|
|
90
|
-
|
91
|
-
Got questions, feedback or want to join a community of ML engineers working on exciting projects?
|
85
|
+
|
92
86
|
|
93
|
-
|
87
|
+
# License
|
94
88
|
|
95
|
-
[
|
89
|
+
[MIT License](https://github.com/wandb/wandb/blob/main/LICENSE)
|
wandb/__init__.py
CHANGED
@@ -8,7 +8,7 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
|
|
8
8
|
|
9
9
|
For reference documentation, see https://docs.wandb.com/ref/python.
|
10
10
|
"""
|
11
|
-
__version__ = "0.
|
11
|
+
__version__ = "0.18.0"
|
12
12
|
|
13
13
|
from typing import Optional
|
14
14
|
|
@@ -76,8 +76,7 @@ from wandb.data_types import JoinedTable
|
|
76
76
|
|
77
77
|
from wandb.wandb_agent import agent
|
78
78
|
|
79
|
-
|
80
|
-
from wandb.viz import visualize
|
79
|
+
from wandb.sdk.lib.viz import visualize
|
81
80
|
from wandb import plot
|
82
81
|
from wandb.integration.sagemaker import sagemaker_auth
|
83
82
|
from wandb.sdk.internal import profiler
|
@@ -199,14 +198,13 @@ if wandb_sdk.lib.ipython.in_notebook():
|
|
199
198
|
from .analytics import Sentry as _Sentry
|
200
199
|
|
201
200
|
if "dev" in __version__:
|
201
|
+
import wandb.env
|
202
202
|
import os
|
203
203
|
|
204
204
|
# disable error reporting in dev versions for the python client
|
205
|
-
os.environ[
|
206
|
-
|
205
|
+
os.environ[wandb.env.ERROR_REPORTING] = os.environ.get(
|
206
|
+
wandb.env.ERROR_REPORTING, "false"
|
207
207
|
)
|
208
|
-
# turn on wandb-core for dev versions
|
209
|
-
os.environ["WANDB__REQUIRE_CORE"] = os.environ.get("WANDB__REQUIRE_CORE", "true")
|
210
208
|
|
211
209
|
_sentry = _Sentry()
|
212
210
|
_sentry.setup()
|
@@ -215,6 +213,7 @@ _sentry.setup()
|
|
215
213
|
__all__ = (
|
216
214
|
"__version__",
|
217
215
|
"init",
|
216
|
+
"finish",
|
218
217
|
"setup",
|
219
218
|
"save",
|
220
219
|
"sweep",
|
@@ -237,6 +236,8 @@ __all__ = (
|
|
237
236
|
"Molecule",
|
238
237
|
"Histogram",
|
239
238
|
"ArtifactTTL",
|
239
|
+
"log_artifact",
|
240
|
+
"use_artifact",
|
240
241
|
"log_model",
|
241
242
|
"use_model",
|
242
243
|
"link_model",
|
wandb/__init__.pyi
CHANGED
@@ -12,7 +12,9 @@ For reference documentation, see https://docs.wandb.com/ref/python.
|
|
12
12
|
__all__ = (
|
13
13
|
"__version__",
|
14
14
|
"init",
|
15
|
+
"finish",
|
15
16
|
"setup",
|
17
|
+
"login",
|
16
18
|
"save",
|
17
19
|
"sweep",
|
18
20
|
"controller",
|
@@ -33,6 +35,8 @@ __all__ = (
|
|
33
35
|
"Molecule",
|
34
36
|
"Histogram",
|
35
37
|
"ArtifactTTL",
|
38
|
+
"log_artifact",
|
39
|
+
"use_artifact",
|
36
40
|
"log_model",
|
37
41
|
"use_model",
|
38
42
|
"link_model",
|
@@ -48,7 +52,7 @@ __all__ = (
|
|
48
52
|
)
|
49
53
|
|
50
54
|
import os
|
51
|
-
from typing import Any, Callable, Dict, List, Optional, Sequence, Union
|
55
|
+
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Union
|
52
56
|
|
53
57
|
from wandb.analytics import Sentry as _Sentry
|
54
58
|
from wandb.apis import InternalApi, PublicApi
|
@@ -75,7 +79,7 @@ from wandb.sdk.wandb_run import Run
|
|
75
79
|
from wandb.sdk.wandb_setup import _WandbSetup
|
76
80
|
from wandb.wandb_controller import _WandbController
|
77
81
|
|
78
|
-
__version__: str = "0.
|
82
|
+
__version__: str = "0.18.0"
|
79
83
|
|
80
84
|
run: Optional[Run] = None
|
81
85
|
config = wandb_config.Config
|
@@ -143,7 +147,7 @@ def setup(
|
|
143
147
|
|
144
148
|
# Optional: Explicitly shut down the backend
|
145
149
|
wandb.teardown()
|
146
|
-
|
150
|
+
```
|
147
151
|
"""
|
148
152
|
...
|
149
153
|
|
@@ -339,6 +343,7 @@ def init(
|
|
339
343
|
mode if a user isn't logged in to W&B. (default: `False`)
|
340
344
|
sync_tensorboard: (bool, optional) Synchronize wandb logs from tensorboard or
|
341
345
|
tensorboardX and save the relevant events file. (default: `False`)
|
346
|
+
tensorboard: (bool, optional) Alias for `sync_tensorboard`, deprecated.
|
342
347
|
monitor_gym: (bool, optional) Automatically log videos of environment when
|
343
348
|
using OpenAI Gym. (default: `False`)
|
344
349
|
See [our guide to this integration](https://docs.wandb.com/guides/integrations/openai-gym).
|
@@ -352,6 +357,12 @@ def init(
|
|
352
357
|
a moment in a previous run to fork a new run from. Creates a new run that picks up
|
353
358
|
logging history from the specified run at the specified moment. The target run must
|
354
359
|
be in the current project. Example: `fork_from="my-run-id?_step=1234"`.
|
360
|
+
resume_from: (str, optional) A string with the format {run_id}?_step={step} describing
|
361
|
+
a moment in a previous run to resume a run from. This allows users to truncate
|
362
|
+
the history logged to a run at an intermediate step and resume logging from that step.
|
363
|
+
It uses run forking under the hood. The target run must be in the
|
364
|
+
current project. Example: `resume_from="my-run-id?_step=1234"`.
|
365
|
+
settings: (dict, wandb.Settings, optional) Settings to use for this run. (default: None)
|
355
366
|
|
356
367
|
Examples:
|
357
368
|
### Set where the run is logged
|
@@ -389,7 +400,56 @@ def init(
|
|
389
400
|
KeyboardInterrupt: if user interrupts the run.
|
390
401
|
|
391
402
|
Returns:
|
392
|
-
|
403
|
+
A `Run` object.
|
404
|
+
"""
|
405
|
+
...
|
406
|
+
|
407
|
+
def finish(exit_code: Optional[int] = None, quiet: Optional[bool] = None) -> None:
|
408
|
+
"""Mark a run as finished, and finish uploading all data.
|
409
|
+
|
410
|
+
This is used when creating multiple runs in the same process.
|
411
|
+
We automatically call this method when your script exits.
|
412
|
+
|
413
|
+
Arguments:
|
414
|
+
exit_code: Set to something other than 0 to mark a run as failed
|
415
|
+
quiet: Set to true to minimize log output
|
416
|
+
"""
|
417
|
+
...
|
418
|
+
|
419
|
+
def login(
|
420
|
+
anonymous: Optional[Literal["must", "allow", "never"]] = None,
|
421
|
+
key: Optional[str] = None,
|
422
|
+
relogin: Optional[bool] = None,
|
423
|
+
host: Optional[str] = None,
|
424
|
+
force: Optional[bool] = None,
|
425
|
+
timeout: Optional[int] = None,
|
426
|
+
verify: bool = False,
|
427
|
+
) -> bool:
|
428
|
+
"""Set up W&B login credentials.
|
429
|
+
|
430
|
+
By default, this will only store credentials locally without
|
431
|
+
verifying them with the W&B server. To verify credentials, pass
|
432
|
+
`verify=True`.
|
433
|
+
|
434
|
+
Arguments:
|
435
|
+
anonymous: (string, optional) Can be "must", "allow", or "never".
|
436
|
+
If set to "must", always log a user in anonymously. If set to
|
437
|
+
"allow", only create an anonymous user if the user
|
438
|
+
isn't already logged in. If set to "never", never log a
|
439
|
+
user anonymously. Default set to "never".
|
440
|
+
key: (string, optional) The API key to use.
|
441
|
+
relogin: (bool, optional) If true, will re-prompt for API key.
|
442
|
+
host: (string, optional) The host to connect to.
|
443
|
+
force: (bool, optional) If true, will force a relogin.
|
444
|
+
timeout: (int, optional) Number of seconds to wait for user input.
|
445
|
+
verify: (bool) Verify the credentials with the W&B server.
|
446
|
+
|
447
|
+
Returns:
|
448
|
+
bool: if key is configured
|
449
|
+
|
450
|
+
Raises:
|
451
|
+
AuthenticationError - if api_key fails verification with the server
|
452
|
+
UsageError - if api_key cannot be configured and no tty
|
393
453
|
"""
|
394
454
|
...
|
395
455
|
|
@@ -623,7 +683,7 @@ def log(
|
|
623
683
|
|
624
684
|
Raises:
|
625
685
|
wandb.Error: if called before `wandb.init`
|
626
|
-
|
686
|
+
ValueError: if invalid data is passed
|
627
687
|
"""
|
628
688
|
...
|
629
689
|
|
@@ -677,7 +737,7 @@ def save(
|
|
677
737
|
Returns:
|
678
738
|
Paths to the symlinks created for the matched files.
|
679
739
|
|
680
|
-
|
740
|
+
For historical reasons, this may return a boolean in legacy code.
|
681
741
|
"""
|
682
742
|
...
|
683
743
|
|
@@ -714,7 +774,7 @@ def sweep(
|
|
714
774
|
prior_runs: The run IDs of existing runs to add to this sweep.
|
715
775
|
|
716
776
|
Returns:
|
717
|
-
|
777
|
+
sweep_id: str. A unique identifier for the sweep.
|
718
778
|
"""
|
719
779
|
...
|
720
780
|
|
@@ -734,7 +794,7 @@ def controller(
|
|
734
794
|
print(tuner.sweep_id)
|
735
795
|
tuner.configure_search(...)
|
736
796
|
tuner.configure_stopping(...)
|
737
|
-
|
797
|
+
```
|
738
798
|
"""
|
739
799
|
...
|
740
800
|
|
@@ -764,7 +824,7 @@ def agent(
|
|
764
824
|
project: The name of the project where W&B runs created from
|
765
825
|
the sweep are sent to. If the project is not specified, the
|
766
826
|
run is sent to a project labeled "Uncategorized".
|
767
|
-
|
827
|
+
count: The number of sweep config trials to try.
|
768
828
|
"""
|
769
829
|
...
|
770
830
|
|
@@ -801,7 +861,67 @@ def define_metric(
|
|
801
861
|
previous calls.
|
802
862
|
|
803
863
|
Returns:
|
804
|
-
|
864
|
+
An object that represents this call but can otherwise be discarded.
|
865
|
+
"""
|
866
|
+
...
|
867
|
+
|
868
|
+
def log_artifact(
|
869
|
+
artifact_or_path: Union[Artifact, StrPath],
|
870
|
+
name: Optional[str] = None,
|
871
|
+
type: Optional[str] = None,
|
872
|
+
aliases: Optional[List[str]] = None,
|
873
|
+
tags: Optional[List[str]] = None,
|
874
|
+
) -> Artifact:
|
875
|
+
"""Declare an artifact as an output of a run.
|
876
|
+
|
877
|
+
Arguments:
|
878
|
+
artifact_or_path: (str or Artifact) A path to the contents of this artifact,
|
879
|
+
can be in the following forms:
|
880
|
+
- `/local/directory`
|
881
|
+
- `/local/directory/file.txt`
|
882
|
+
- `s3://bucket/path`
|
883
|
+
You can also pass an Artifact object created by calling
|
884
|
+
`wandb.Artifact`.
|
885
|
+
name: (str, optional) An artifact name. Valid names can be in the following forms:
|
886
|
+
- name:version
|
887
|
+
- name:alias
|
888
|
+
- digest
|
889
|
+
This will default to the basename of the path prepended with the current
|
890
|
+
run id if not specified.
|
891
|
+
type: (str) The type of artifact to log, examples include `dataset`, `model`
|
892
|
+
aliases: (list, optional) Aliases to apply to this artifact,
|
893
|
+
defaults to `["latest"]`
|
894
|
+
tags: (list, optional) Tags to apply to this artifact, if any.
|
895
|
+
|
896
|
+
Returns:
|
897
|
+
An `Artifact` object.
|
898
|
+
"""
|
899
|
+
...
|
900
|
+
|
901
|
+
def use_artifact(
|
902
|
+
artifact_or_name: Union[str, Artifact],
|
903
|
+
type: Optional[str] = None,
|
904
|
+
aliases: Optional[List[str]] = None,
|
905
|
+
use_as: Optional[str] = None,
|
906
|
+
) -> Artifact:
|
907
|
+
"""Declare an artifact as an input to a run.
|
908
|
+
|
909
|
+
Call `download` or `file` on the returned object to get the contents locally.
|
910
|
+
|
911
|
+
Arguments:
|
912
|
+
artifact_or_name: (str or Artifact) An artifact name.
|
913
|
+
May be prefixed with entity/project/. Valid names
|
914
|
+
can be in the following forms:
|
915
|
+
- name:version
|
916
|
+
- name:alias
|
917
|
+
You can also pass an Artifact object created by calling `wandb.Artifact`
|
918
|
+
type: (str, optional) The type of artifact to use.
|
919
|
+
aliases: (list, optional) Aliases to apply to this artifact
|
920
|
+
use_as: (string, optional) Optional string indicating what purpose the artifact was used with.
|
921
|
+
Will be shown in UI.
|
922
|
+
|
923
|
+
Returns:
|
924
|
+
An `Artifact` object.
|
805
925
|
"""
|
806
926
|
...
|
807
927
|
|
@@ -847,7 +967,7 @@ def log_model(
|
|
847
967
|
ValueError: if name has invalid special characters
|
848
968
|
|
849
969
|
Returns:
|
850
|
-
|
970
|
+
None
|
851
971
|
"""
|
852
972
|
...
|
853
973
|
|
@@ -888,7 +1008,7 @@ def use_model(name: str) -> FilePathStr:
|
|
888
1008
|
AssertionError: if model artifact 'name' is of a type that does not contain the substring 'model'.
|
889
1009
|
|
890
1010
|
Returns:
|
891
|
-
|
1011
|
+
path: (str) path to downloaded model artifact file(s).
|
892
1012
|
"""
|
893
1013
|
...
|
894
1014
|
|
@@ -920,7 +1040,7 @@ def link_model(
|
|
920
1040
|
registered_model_name: (str) - the name of the registered model that the model is to be linked to.
|
921
1041
|
A registered model is a collection of model versions linked to the model registry, typically representing a
|
922
1042
|
team's specific ML Task. The entity that this registered model belongs to will be derived from the run
|
923
|
-
|
1043
|
+
name: (str, optional) - the name of the model artifact that files in 'path' will be logged to. This will
|
924
1044
|
default to the basename of the path prepended with the current run id if not specified.
|
925
1045
|
aliases: (List[str], optional) - alias(es) that will only be applied on this linked artifact
|
926
1046
|
inside the registered model.
|
@@ -959,6 +1079,6 @@ def link_model(
|
|
959
1079
|
ValueError: if name has invalid special characters
|
960
1080
|
|
961
1081
|
Returns:
|
962
|
-
|
1082
|
+
None
|
963
1083
|
"""
|
964
1084
|
...
|
wandb/analytics/sentry.py
CHANGED
wandb/bin/nvidia_gpu_stats
CHANGED
Binary file
|
wandb/cli/cli.py
CHANGED
@@ -35,7 +35,7 @@ import wandb.sdk.verify.verify as wandb_verify
|
|
35
35
|
from wandb import Config, Error, env, util, wandb_agent, wandb_sdk
|
36
36
|
from wandb.apis import InternalApi, PublicApi
|
37
37
|
from wandb.apis.public import RunQueue
|
38
|
-
from wandb.errors import WandbCoreNotAvailableError
|
38
|
+
from wandb.errors import UsageError, WandbCoreNotAvailableError
|
39
39
|
from wandb.integration.magic import magic_install
|
40
40
|
from wandb.sdk.artifacts.artifact_file_cache import get_artifact_file_cache
|
41
41
|
from wandb.sdk.launch import utils as launch_utils
|
@@ -123,6 +123,9 @@ _api = None # caching api instance allows patching from unit tests
|
|
123
123
|
|
124
124
|
def _get_cling_api(reset=None):
|
125
125
|
"""Get a reference to the internal api with cling settings."""
|
126
|
+
# TODO: move CLI to wandb-core backend
|
127
|
+
wandb.require("legacy-service")
|
128
|
+
|
126
129
|
global _api
|
127
130
|
if reset:
|
128
131
|
_api = None
|
@@ -226,6 +229,9 @@ def projects(entity, display=True):
|
|
226
229
|
@click.option("--verify", default=False, is_flag=True, help="Verify login credentials")
|
227
230
|
@display_error
|
228
231
|
def login(key, host, cloud, relogin, anonymously, verify, no_offline=False):
|
232
|
+
# TODO: move CLI to wandb-core backend
|
233
|
+
wandb.require("legacy-service")
|
234
|
+
|
229
235
|
# TODO: handle no_offline
|
230
236
|
anon_mode = "must" if anonymously else "never"
|
231
237
|
|
@@ -433,8 +439,15 @@ def init(ctx, project, entity, reset, mode):
|
|
433
439
|
def beta():
|
434
440
|
"""Beta versions of wandb CLI commands. Requires wandb-core."""
|
435
441
|
# this is the future that requires wandb-core!
|
442
|
+
import wandb.env
|
443
|
+
|
436
444
|
wandb._sentry.configure_scope(process_context="wandb_beta")
|
437
|
-
|
445
|
+
|
446
|
+
if wandb.env.is_require_legacy_service():
|
447
|
+
raise UsageError(
|
448
|
+
"wandb beta commands can only be used with wandb-core. "
|
449
|
+
f"Please make sure that `{wandb.env._REQUIRE_LEGACY_SERVICE}` is not set."
|
450
|
+
)
|
438
451
|
|
439
452
|
try:
|
440
453
|
get_core_path()
|
@@ -2942,14 +2955,6 @@ def enabled(service):
|
|
2942
2955
|
)
|
2943
2956
|
|
2944
2957
|
|
2945
|
-
@cli.command("gc", hidden=True, context_settings={"ignore_unknown_options": True})
|
2946
|
-
@click.argument("args", nargs=-1)
|
2947
|
-
def gc(args):
|
2948
|
-
click.echo(
|
2949
|
-
"`wandb gc` command has been removed. Use `wandb sync --clean` to clean up synced runs."
|
2950
|
-
)
|
2951
|
-
|
2952
|
-
|
2953
2958
|
@cli.command(context_settings=CONTEXT, help="Verify your local instance")
|
2954
2959
|
@click.option("--host", default=None, help="Test a specific instance of W&B")
|
2955
2960
|
def verify(host):
|
wandb/data_types.py
CHANGED
@@ -1420,6 +1420,7 @@ class Graph(Media):
|
|
1420
1420
|
|
1421
1421
|
@classmethod
|
1422
1422
|
def from_keras(cls, model):
|
1423
|
+
# TODO: his method requires a refactor to work with the keras 3.
|
1423
1424
|
graph = cls()
|
1424
1425
|
# Shamelessly copied (then modified) from keras/keras/utils/layer_utils.py
|
1425
1426
|
sequential_like = cls._is_sequential(model)
|
wandb/env.py
CHANGED
@@ -90,7 +90,7 @@ _EXECUTABLE = "WANDB_EXECUTABLE"
|
|
90
90
|
LAUNCH_QUEUE_NAME = "WANDB_LAUNCH_QUEUE_NAME"
|
91
91
|
LAUNCH_QUEUE_ENTITY = "WANDB_LAUNCH_QUEUE_ENTITY"
|
92
92
|
LAUNCH_TRACE_ID = "WANDB_LAUNCH_TRACE_ID"
|
93
|
-
|
93
|
+
_REQUIRE_LEGACY_SERVICE = "WANDB__REQUIRE_LEGACY_SERVICE"
|
94
94
|
|
95
95
|
# For testing, to be removed in future version
|
96
96
|
USE_V1_ARTIFACTS = "_WANDB_USE_V1_ARTIFACTS"
|
@@ -153,8 +153,9 @@ def _env_as_bool(
|
|
153
153
|
return False
|
154
154
|
|
155
155
|
|
156
|
-
def
|
157
|
-
|
156
|
+
def is_require_legacy_service(env: Optional[Env] = None) -> bool:
|
157
|
+
"""Return whether wandb.require("legacy-service") was used."""
|
158
|
+
return _env_as_bool(_REQUIRE_LEGACY_SERVICE, default="False", env=env)
|
158
159
|
|
159
160
|
|
160
161
|
def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
|
@@ -1,7 +1,4 @@
|
|
1
|
-
"""Tools for integrating `wandb` with [`Keras`](https://keras.io/).
|
2
|
-
|
3
|
-
Keras is a deep learning API for [`TensorFlow`](https://www.tensorflow.org/).
|
4
|
-
"""
|
1
|
+
"""Tools for integrating `wandb` with [`Keras`](https://keras.io/)."""
|
5
2
|
|
6
3
|
__all__ = (
|
7
4
|
"WandbCallback",
|
@@ -11,4 +8,4 @@ __all__ = (
|
|
11
8
|
)
|
12
9
|
|
13
10
|
from .callbacks import WandbEvalCallback, WandbMetricsLogger, WandbModelCheckpoint
|
14
|
-
from .keras import WandbCallback #
|
11
|
+
from .keras import WandbCallback # TODO: legacy callback to be deprecated
|
@@ -2,7 +2,7 @@ import sys
|
|
2
2
|
from typing import Any, Dict, Optional, Union
|
3
3
|
|
4
4
|
import tensorflow as tf # type: ignore
|
5
|
-
from tensorflow.keras import callbacks
|
5
|
+
from tensorflow.keras import callbacks
|
6
6
|
|
7
7
|
import wandb
|
8
8
|
from wandb.integration.keras.keras import patch_tf_keras
|
@@ -86,14 +86,20 @@ class WandbMetricsLogger(callbacks.Callback):
|
|
86
86
|
wandb.define_metric("epoch/*", step_metric="epoch/epoch")
|
87
87
|
|
88
88
|
def _get_lr(self) -> Union[float, None]:
|
89
|
-
if isinstance(
|
89
|
+
if isinstance(
|
90
|
+
self.model.optimizer.learning_rate,
|
91
|
+
(tf.Variable, tf.Tensor),
|
92
|
+
) or (
|
93
|
+
hasattr(self.model.optimizer.learning_rate, "shape")
|
94
|
+
and self.model.optimizer.learning_rate.shape == ()
|
95
|
+
):
|
90
96
|
return float(self.model.optimizer.learning_rate.numpy().item())
|
91
97
|
try:
|
92
98
|
return float(
|
93
99
|
self.model.optimizer.learning_rate(step=self.global_step).numpy().item()
|
94
100
|
)
|
95
|
-
except Exception:
|
96
|
-
wandb.termerror("Unable to log learning rate
|
101
|
+
except Exception as e:
|
102
|
+
wandb.termerror(f"Unable to log learning rate: {e}", repeat=False)
|
97
103
|
return None
|
98
104
|
|
99
105
|
def on_epoch_end(self, epoch: int, logs: Optional[Dict[str, Any]] = None) -> None:
|
@@ -71,9 +71,6 @@ class WandbModelCheckpoint(callbacks.ModelCheckpoint):
|
|
71
71
|
Note that when monitoring validation metrics such as `val_acc` or `val_loss`,
|
72
72
|
save_freq must be set to "epoch" as those metrics are only available at the
|
73
73
|
end of an epoch.
|
74
|
-
options: (Optional[str]) Optional `tf.train.CheckpointOptions` object if
|
75
|
-
`save_weights_only` is true or optional `tf.saved_model.SaveOptions`
|
76
|
-
object if `save_weights_only` is false.
|
77
74
|
initial_value_threshold: (Optional[float]) Floating point initial "best" value of the metric
|
78
75
|
to be monitored.
|
79
76
|
"""
|
@@ -87,7 +84,6 @@ class WandbModelCheckpoint(callbacks.ModelCheckpoint):
|
|
87
84
|
save_weights_only: bool = False,
|
88
85
|
mode: Mode = "auto",
|
89
86
|
save_freq: Union[SaveStrategy, int] = "epoch",
|
90
|
-
options: Optional[str] = None,
|
91
87
|
initial_value_threshold: Optional[float] = None,
|
92
88
|
**kwargs: Any,
|
93
89
|
) -> None:
|
@@ -99,7 +95,6 @@ class WandbModelCheckpoint(callbacks.ModelCheckpoint):
|
|
99
95
|
save_weights_only=save_weights_only,
|
100
96
|
mode=mode,
|
101
97
|
save_freq=save_freq,
|
102
|
-
options=options,
|
103
98
|
initial_value_threshold=initial_value_threshold,
|
104
99
|
**kwargs,
|
105
100
|
)
|
wandb/integration/keras/keras.py
CHANGED
@@ -417,6 +417,17 @@ class WandbCallback(tf.keras.callbacks.Callback):
|
|
417
417
|
):
|
418
418
|
if wandb.run is None:
|
419
419
|
raise wandb.Error("You must call wandb.init() before WandbCallback()")
|
420
|
+
|
421
|
+
deprecate(
|
422
|
+
field_name=Deprecated.keras_callback,
|
423
|
+
warning_message=(
|
424
|
+
"WandbCallback is deprecated and will be removed in a future release. "
|
425
|
+
"Please use the WandbMetricsLogger, WandbModelCheckpoint, and WandbEvalCallback "
|
426
|
+
"callbacks instead. "
|
427
|
+
"See https://docs.wandb.ai/guides/integrations/keras for more information."
|
428
|
+
),
|
429
|
+
)
|
430
|
+
|
420
431
|
with wandb.wandb_lib.telemetry.context(run=wandb.run) as tel:
|
421
432
|
tel.feature.keras = True
|
422
433
|
self.validation_data = None
|
@@ -552,7 +563,7 @@ class WandbCallback(tf.keras.callbacks.Callback):
|
|
552
563
|
self.params = params
|
553
564
|
|
554
565
|
def set_model(self, model):
|
555
|
-
|
566
|
+
super().set_model(model)
|
556
567
|
if self.input_type == "auto" and len(model.inputs) == 1:
|
557
568
|
self.input_type = wandb.util.guess_data_type(
|
558
569
|
model.inputs[0].shape, risky=True
|