wandb 0.17.8rc1__py3-none-win32.whl → 0.17.9__py3-none-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
- package_readme.md +47 -53
- wandb/__init__.py +12 -6
- wandb/__init__.pyi +112 -2
- wandb/bin/wandb-core +0 -0
- wandb/data_types.py +1 -0
- wandb/env.py +13 -0
- 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 -1
- wandb/proto/v3/wandb_internal_pb2.py +31 -21
- 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 +23 -21
- 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 +23 -21
- 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/artifact.py +9 -11
- wandb/sdk/artifacts/artifact_manifest_entry.py +10 -2
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +31 -0
- wandb/sdk/internal/system/assets/trainium.py +2 -1
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/lib/_settings_toposort_generated.py +5 -3
- wandb/sdk/service/service.py +7 -2
- wandb/sdk/wandb_init.py +5 -1
- wandb/sdk/wandb_manager.py +0 -3
- wandb/sdk/wandb_require.py +22 -1
- wandb/sdk/wandb_run.py +14 -4
- wandb/sdk/wandb_settings.py +32 -10
- wandb/sdk/wandb_setup.py +3 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.17.9.dist-info}/METADATA +48 -54
- {wandb-0.17.8rc1.dist-info → wandb-0.17.9.dist-info}/RECORD +42 -43
- wandb/testing/relay.py +0 -874
- /wandb/{viz.py → sdk/lib/viz.py} +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.17.9.dist-info}/WHEEL +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.17.9.dist-info}/entry_points.txt +0 -0
- {wandb-0.17.8rc1.dist-info → wandb-0.17.9.dist-info}/licenses/LICENSE +0 -0
package_readme.md
CHANGED
@@ -4,92 +4,86 @@
|
|
4
4
|
|
5
5
|
# Weights and Biases [![PyPI](https://img.shields.io/pypi/v/wandb)](https://pypi.python.org/pypi/wandb) [![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/wandb)](https://anaconda.org/conda-forge/wandb) [![CircleCI](https://img.shields.io/circleci/build/github/wandb/wandb/main)](https://circleci.com/gh/wandb/wandb) [![Codecov](https://img.shields.io/codecov/c/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
|
-
[![Watch the video](https://i.imgur.com/PW0Ejlc.png)](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://i.imgur.com/loKLiez.png)](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.17.
|
11
|
+
__version__ = "0.17.9"
|
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,18 @@ 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
|
+
|
208
209
|
# turn on wandb-core for dev versions
|
209
|
-
|
210
|
+
if not wandb.env.is_require_legacy_service():
|
211
|
+
os.environ[wandb.env._REQUIRE_CORE] = os.environ.get(
|
212
|
+
wandb.env._REQUIRE_CORE, "true")
|
210
213
|
|
211
214
|
_sentry = _Sentry()
|
212
215
|
_sentry.setup()
|
@@ -215,6 +218,7 @@ _sentry.setup()
|
|
215
218
|
__all__ = (
|
216
219
|
"__version__",
|
217
220
|
"init",
|
221
|
+
"finish",
|
218
222
|
"setup",
|
219
223
|
"save",
|
220
224
|
"sweep",
|
@@ -237,6 +241,8 @@ __all__ = (
|
|
237
241
|
"Molecule",
|
238
242
|
"Histogram",
|
239
243
|
"ArtifactTTL",
|
244
|
+
"log_artifact",
|
245
|
+
"use_artifact",
|
240
246
|
"log_model",
|
241
247
|
"use_model",
|
242
248
|
"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.17.
|
82
|
+
__version__: str = "0.17.9"
|
79
83
|
|
80
84
|
run: Optional[Run] = None
|
81
85
|
config = wandb_config.Config
|
@@ -393,6 +397,54 @@ def init(
|
|
393
397
|
"""
|
394
398
|
...
|
395
399
|
|
400
|
+
def finish(exit_code: Optional[int] = None, quiet: Optional[bool] = None) -> None:
|
401
|
+
"""Mark a run as finished, and finish uploading all data.
|
402
|
+
|
403
|
+
This is used when creating multiple runs in the same process.
|
404
|
+
We automatically call this method when your script exits.
|
405
|
+
|
406
|
+
Arguments:
|
407
|
+
exit_code: Set to something other than 0 to mark a run as failed
|
408
|
+
quiet: Set to true to minimize log output
|
409
|
+
"""
|
410
|
+
...
|
411
|
+
|
412
|
+
def login(
|
413
|
+
anonymous: Optional[Literal["must", "allow", "never"]] = None,
|
414
|
+
key: Optional[str] = None,
|
415
|
+
relogin: Optional[bool] = None,
|
416
|
+
host: Optional[str] = None,
|
417
|
+
force: Optional[bool] = None,
|
418
|
+
timeout: Optional[int] = None,
|
419
|
+
verify: bool = False,
|
420
|
+
) -> bool:
|
421
|
+
"""Set up W&B login credentials.
|
422
|
+
|
423
|
+
By default, this will only store credentials locally without
|
424
|
+
verifying them with the W&B server. To verify credentials, pass
|
425
|
+
`verify=True`.
|
426
|
+
|
427
|
+
Arguments:
|
428
|
+
anonymous: (string, optional) Can be "must", "allow", or "never".
|
429
|
+
If set to "must", always log a user in anonymously. If set to
|
430
|
+
"allow", only create an anonymous user if the user
|
431
|
+
isn't already logged in. If set to "never", never log a
|
432
|
+
user anonymously. Default set to "never".
|
433
|
+
relogin: (bool, optional) If true, will re-prompt for API key.
|
434
|
+
host: (string, optional) The host to connect to.
|
435
|
+
force: (bool, optional) If true, will force a relogin.
|
436
|
+
timeout: (int, optional) Number of seconds to wait for user input.
|
437
|
+
verify: (bool) Verify the credentials with the W&B server.
|
438
|
+
|
439
|
+
Returns:
|
440
|
+
bool: if key is configured
|
441
|
+
|
442
|
+
Raises:
|
443
|
+
AuthenticationError - if api_key fails verification with the server
|
444
|
+
UsageError - if api_key cannot be configured and no tty
|
445
|
+
"""
|
446
|
+
...
|
447
|
+
|
396
448
|
def log(
|
397
449
|
data: Dict[str, Any],
|
398
450
|
step: Optional[int] = None,
|
@@ -805,6 +857,64 @@ def define_metric(
|
|
805
857
|
"""
|
806
858
|
...
|
807
859
|
|
860
|
+
def log_artifact(
|
861
|
+
artifact_or_path: Union[Artifact, StrPath],
|
862
|
+
name: Optional[str] = None,
|
863
|
+
type: Optional[str] = None,
|
864
|
+
aliases: Optional[List[str]] = None,
|
865
|
+
) -> Artifact:
|
866
|
+
"""Declare an artifact as an output of a run.
|
867
|
+
|
868
|
+
Arguments:
|
869
|
+
artifact_or_path: (str or Artifact) A path to the contents of this artifact,
|
870
|
+
can be in the following forms:
|
871
|
+
- `/local/directory`
|
872
|
+
- `/local/directory/file.txt`
|
873
|
+
- `s3://bucket/path`
|
874
|
+
You can also pass an Artifact object created by calling
|
875
|
+
`wandb.Artifact`.
|
876
|
+
name: (str, optional) An artifact name. Valid names can be in the following forms:
|
877
|
+
- name:version
|
878
|
+
- name:alias
|
879
|
+
- digest
|
880
|
+
This will default to the basename of the path prepended with the current
|
881
|
+
run id if not specified.
|
882
|
+
type: (str) The type of artifact to log, examples include `dataset`, `model`
|
883
|
+
aliases: (list, optional) Aliases to apply to this artifact,
|
884
|
+
defaults to `["latest"]`
|
885
|
+
|
886
|
+
Returns:
|
887
|
+
An `Artifact` object.
|
888
|
+
"""
|
889
|
+
...
|
890
|
+
|
891
|
+
def use_artifact(
|
892
|
+
artifact_or_name: Union[str, Artifact],
|
893
|
+
type: Optional[str] = None,
|
894
|
+
aliases: Optional[List[str]] = None,
|
895
|
+
use_as: Optional[str] = None,
|
896
|
+
) -> Artifact:
|
897
|
+
"""Declare an artifact as an input to a run.
|
898
|
+
|
899
|
+
Call `download` or `file` on the returned object to get the contents locally.
|
900
|
+
|
901
|
+
Arguments:
|
902
|
+
artifact_or_name: (str or Artifact) An artifact name.
|
903
|
+
May be prefixed with entity/project/. Valid names
|
904
|
+
can be in the following forms:
|
905
|
+
- name:version
|
906
|
+
- name:alias
|
907
|
+
You can also pass an Artifact object created by calling `wandb.Artifact`
|
908
|
+
type: (str, optional) The type of artifact to use.
|
909
|
+
aliases: (list, optional) Aliases to apply to this artifact
|
910
|
+
use_as: (string, optional) Optional string indicating what purpose the artifact was used with.
|
911
|
+
Will be shown in UI.
|
912
|
+
|
913
|
+
Returns:
|
914
|
+
An `Artifact` object.
|
915
|
+
"""
|
916
|
+
...
|
917
|
+
|
808
918
|
def log_model(
|
809
919
|
path: StrPath,
|
810
920
|
name: Optional[str] = None,
|
wandb/bin/wandb-core
CHANGED
Binary file
|
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
@@ -91,6 +91,7 @@ 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_CORE = "WANDB__REQUIRE_CORE"
|
94
|
+
_REQUIRE_LEGACY_SERVICE = "WANDB__REQUIRE_LEGACY_SERVICE"
|
94
95
|
|
95
96
|
# For testing, to be removed in future version
|
96
97
|
USE_V1_ARTIFACTS = "_WANDB_USE_V1_ARTIFACTS"
|
@@ -154,9 +155,21 @@ def _env_as_bool(
|
|
154
155
|
|
155
156
|
|
156
157
|
def is_require_core(env: Optional[Env] = None) -> bool:
|
158
|
+
"""Return whether wandb.require("core") was used.
|
159
|
+
|
160
|
+
Note that this may contradict wandb.require("legacy-service").
|
161
|
+
"""
|
157
162
|
return _env_as_bool(_REQUIRE_CORE, default="False", env=env)
|
158
163
|
|
159
164
|
|
165
|
+
def is_require_legacy_service(env: Optional[Env] = None) -> bool:
|
166
|
+
"""Return whether wandb.require("legacy-service") was used.
|
167
|
+
|
168
|
+
Note that this may contradict wandb.require("core").
|
169
|
+
"""
|
170
|
+
return _env_as_bool(_REQUIRE_LEGACY_SERVICE, default="False", env=env)
|
171
|
+
|
172
|
+
|
160
173
|
def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
|
161
174
|
return _env_as_bool(DEBUG, default=default, env=env)
|
162
175
|
|
@@ -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
|
@@ -37,23 +37,23 @@ from openai.types.fine_tuning.fine_tuning_job import ( # noqa: E402
|
|
37
37
|
np = util.get_module(
|
38
38
|
name="numpy",
|
39
39
|
required="`numpy` not installed >> This integration requires numpy! To fix, please `pip install numpy`",
|
40
|
-
lazy=
|
40
|
+
lazy=False,
|
41
41
|
)
|
42
42
|
|
43
43
|
pd = util.get_module(
|
44
44
|
name="pandas",
|
45
45
|
required="`pandas` not installed >> This integration requires pandas! To fix, please `pip install pandas`",
|
46
|
-
lazy=
|
46
|
+
lazy=False,
|
47
47
|
)
|
48
48
|
|
49
49
|
|
50
50
|
class WandbLogger:
|
51
51
|
"""Log OpenAI fine-tunes to [Weights & Biases](https://wandb.me/openai-docs)."""
|
52
52
|
|
53
|
-
_wandb_api: wandb.Api = None
|
53
|
+
_wandb_api: Optional[wandb.Api] = None
|
54
54
|
_logged_in: bool = False
|
55
|
-
openai_client: OpenAI = None
|
56
|
-
_run: Run = None
|
55
|
+
openai_client: Optional[OpenAI] = None
|
56
|
+
_run: Optional[Run] = None
|
57
57
|
|
58
58
|
@classmethod
|
59
59
|
def sync(
|
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
|
6
6
|
import wandb
|
7
7
|
import wandb.util
|
8
8
|
from wandb.sdk.lib import telemetry
|
9
|
-
from wandb.viz import custom_chart
|
9
|
+
from wandb.sdk.lib.viz import custom_chart
|
10
10
|
|
11
11
|
if TYPE_CHECKING:
|
12
12
|
import numpy as np
|