wandb 0.20.2rc20250616__py3-none-win_amd64.whl → 0.21.1__py3-none-win_amd64.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.
Files changed (140) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +450 -472
  3. wandb/agents/pyagent.py +41 -12
  4. wandb/analytics/sentry.py +7 -2
  5. wandb/apis/importers/mlflow.py +1 -1
  6. wandb/apis/internal.py +3 -0
  7. wandb/apis/paginator.py +17 -4
  8. wandb/apis/public/__init__.py +1 -1
  9. wandb/apis/public/api.py +606 -359
  10. wandb/apis/public/artifacts.py +214 -16
  11. wandb/apis/public/automations.py +19 -3
  12. wandb/apis/public/files.py +177 -38
  13. wandb/apis/public/history.py +67 -15
  14. wandb/apis/public/integrations.py +25 -2
  15. wandb/apis/public/jobs.py +90 -2
  16. wandb/apis/public/projects.py +161 -69
  17. wandb/apis/public/query_generator.py +11 -1
  18. wandb/apis/public/registries/registries_search.py +7 -15
  19. wandb/apis/public/reports.py +147 -13
  20. wandb/apis/public/runs.py +315 -128
  21. wandb/apis/public/sweeps.py +222 -22
  22. wandb/apis/public/teams.py +41 -4
  23. wandb/apis/public/users.py +45 -4
  24. wandb/automations/__init__.py +10 -10
  25. wandb/automations/_filters/run_metrics.py +0 -2
  26. wandb/automations/_utils.py +0 -2
  27. wandb/automations/actions.py +0 -2
  28. wandb/automations/automations.py +0 -2
  29. wandb/automations/events.py +0 -2
  30. wandb/beta/workflows.py +66 -30
  31. wandb/bin/gpu_stats.exe +0 -0
  32. wandb/bin/wandb-core +0 -0
  33. wandb/cli/cli.py +80 -1
  34. wandb/env.py +8 -0
  35. wandb/errors/errors.py +4 -1
  36. wandb/integration/catboost/catboost.py +6 -2
  37. wandb/integration/kfp/kfp_patch.py +3 -1
  38. wandb/integration/lightning/fabric/logger.py +3 -4
  39. wandb/integration/metaflow/__init__.py +6 -0
  40. wandb/integration/metaflow/data_pandas.py +74 -0
  41. wandb/integration/metaflow/errors.py +13 -0
  42. wandb/integration/metaflow/metaflow.py +205 -190
  43. wandb/integration/openai/fine_tuning.py +1 -2
  44. wandb/integration/sb3/sb3.py +3 -3
  45. wandb/integration/ultralytics/callback.py +6 -2
  46. wandb/jupyter.py +5 -5
  47. wandb/plot/__init__.py +2 -0
  48. wandb/plot/bar.py +30 -29
  49. wandb/plot/confusion_matrix.py +75 -71
  50. wandb/plot/custom_chart.py +30 -7
  51. wandb/plot/histogram.py +26 -25
  52. wandb/plot/line.py +33 -32
  53. wandb/plot/line_series.py +100 -103
  54. wandb/plot/pr_curve.py +33 -32
  55. wandb/plot/roc_curve.py +38 -38
  56. wandb/plot/scatter.py +27 -27
  57. wandb/proto/v3/wandb_internal_pb2.py +366 -385
  58. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  59. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  60. wandb/proto/v4/wandb_internal_pb2.py +352 -356
  61. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  62. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  63. wandb/proto/v5/wandb_internal_pb2.py +352 -356
  64. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  65. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  66. wandb/proto/v6/wandb_internal_pb2.py +352 -356
  67. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  68. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  69. wandb/proto/wandb_deprecated.py +6 -0
  70. wandb/sdk/artifacts/_generated/__init__.py +12 -1
  71. wandb/sdk/artifacts/_generated/input_types.py +20 -2
  72. wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
  73. wandb/sdk/artifacts/_generated/operations.py +9 -0
  74. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  75. wandb/sdk/artifacts/_validators.py +48 -2
  76. wandb/sdk/artifacts/artifact.py +269 -96
  77. wandb/sdk/data_types/audio.py +38 -10
  78. wandb/sdk/data_types/base_types/media.py +15 -63
  79. wandb/sdk/data_types/base_types/wb_value.py +6 -6
  80. wandb/sdk/data_types/graph.py +48 -14
  81. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  82. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  83. wandb/sdk/data_types/histogram.py +34 -21
  84. wandb/sdk/data_types/html.py +35 -12
  85. wandb/sdk/data_types/image.py +104 -68
  86. wandb/sdk/data_types/molecule.py +32 -19
  87. wandb/sdk/data_types/object_3d.py +36 -17
  88. wandb/sdk/data_types/plotly.py +18 -5
  89. wandb/sdk/data_types/saved_model.py +7 -9
  90. wandb/sdk/data_types/table.py +99 -70
  91. wandb/sdk/data_types/trace_tree.py +12 -12
  92. wandb/sdk/data_types/video.py +53 -26
  93. wandb/sdk/integration_utils/auto_logging.py +2 -2
  94. wandb/sdk/interface/interface.py +8 -19
  95. wandb/sdk/interface/interface_shared.py +7 -16
  96. wandb/sdk/internal/datastore.py +18 -18
  97. wandb/sdk/internal/handler.py +3 -5
  98. wandb/sdk/internal/internal_api.py +60 -0
  99. wandb/sdk/internal/job_builder.py +6 -0
  100. wandb/sdk/internal/sender.py +23 -3
  101. wandb/sdk/internal/sender_config.py +9 -0
  102. wandb/sdk/launch/_project_spec.py +3 -3
  103. wandb/sdk/launch/agent/agent.py +11 -4
  104. wandb/sdk/launch/agent/job_status_tracker.py +3 -1
  105. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  106. wandb/sdk/launch/create_job.py +3 -1
  107. wandb/sdk/launch/inputs/internal.py +3 -4
  108. wandb/sdk/launch/inputs/schema.py +1 -0
  109. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  110. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  111. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  112. wandb/sdk/launch/utils.py +3 -3
  113. wandb/sdk/lib/asyncio_compat.py +3 -0
  114. wandb/sdk/lib/console_capture.py +66 -19
  115. wandb/sdk/lib/deprecate.py +1 -7
  116. wandb/sdk/lib/disabled.py +1 -1
  117. wandb/sdk/lib/hashutil.py +14 -1
  118. wandb/sdk/lib/module.py +7 -13
  119. wandb/sdk/lib/progress.py +0 -19
  120. wandb/sdk/lib/sock_client.py +0 -4
  121. wandb/sdk/wandb_init.py +67 -93
  122. wandb/sdk/wandb_login.py +18 -14
  123. wandb/sdk/wandb_metric.py +2 -0
  124. wandb/sdk/wandb_require.py +0 -1
  125. wandb/sdk/wandb_run.py +429 -527
  126. wandb/sdk/wandb_settings.py +364 -74
  127. wandb/sdk/wandb_setup.py +28 -28
  128. wandb/sdk/wandb_sweep.py +14 -13
  129. wandb/sdk/wandb_watch.py +4 -6
  130. wandb/sync/sync.py +10 -0
  131. wandb/util.py +57 -0
  132. wandb/wandb_run.py +1 -2
  133. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  134. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/RECORD +137 -137
  135. wandb/sdk/wandb_metadata.py +0 -623
  136. wandb/vendor/pynvml/__init__.py +0 -0
  137. wandb/vendor/pynvml/pynvml.py +0 -4779
  138. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  139. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  140. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/lib/hashutil.py CHANGED
@@ -2,8 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  import base64
4
4
  import hashlib
5
+ import logging
5
6
  import mmap
6
7
  import sys
8
+ import time
7
9
  from typing import TYPE_CHECKING, NewType
8
10
 
9
11
  from wandb.sdk.lib.paths import StrPath
@@ -15,6 +17,8 @@ ETag = NewType("ETag", str)
15
17
  HexMD5 = NewType("HexMD5", str)
16
18
  B64MD5 = NewType("B64MD5", str)
17
19
 
20
+ logger = logging.getLogger(__name__)
21
+
18
22
 
19
23
  def _md5(data: bytes = b"") -> _hashlib.HASH:
20
24
  """Allow FIPS-compliant md5 hash when supported."""
@@ -44,7 +48,16 @@ def hex_to_b64_id(encoded_string: str | bytes) -> B64MD5:
44
48
 
45
49
 
46
50
  def md5_file_b64(*paths: StrPath) -> B64MD5:
47
- return _b64_from_hasher(_md5_file_hasher(*paths))
51
+ start_time = time.monotonic()
52
+ digest = _b64_from_hasher(_md5_file_hasher(*paths))
53
+ hash_time_seconds = time.monotonic() - start_time
54
+ if hash_time_seconds > 1.0:
55
+ logger.debug(
56
+ "Computed MD5 hash for file. paths=%s, hashTimeMs=%d",
57
+ paths,
58
+ int(hash_time_seconds * 1000),
59
+ )
60
+ return digest
48
61
 
49
62
 
50
63
  def md5_file_hex(*paths: StrPath) -> HexMD5:
wandb/sdk/lib/module.py CHANGED
@@ -57,22 +57,16 @@ def unset_globals():
57
57
  wandb.run = None
58
58
  wandb.config = preinit.PreInitObject("wandb.config")
59
59
  wandb.summary = preinit.PreInitObject("wandb.summary")
60
- wandb.log = preinit.PreInitCallable("wandb.log", wandb.wandb_sdk.wandb_run.Run.log)
61
- wandb.watch = preinit.PreInitCallable(
62
- "wandb.watch", wandb.wandb_sdk.wandb_run.Run.watch
63
- )
64
- wandb.unwatch = preinit.PreInitCallable(
65
- "wandb.unwatch", wandb.wandb_sdk.wandb_run.Run.unwatch
66
- )
67
- wandb.save = preinit.PreInitCallable(
68
- "wandb.save", wandb.wandb_sdk.wandb_run.Run.save
69
- )
60
+ wandb.log = preinit.PreInitCallable("wandb.log", wandb.Run.log)
61
+ wandb.watch = preinit.PreInitCallable("wandb.watch", wandb.Run.watch)
62
+ wandb.unwatch = preinit.PreInitCallable("wandb.unwatch", wandb.Run.unwatch)
63
+ wandb.save = preinit.PreInitCallable("wandb.save", wandb.Run.save)
70
64
  wandb.use_artifact = preinit.PreInitCallable(
71
- "wandb.use_artifact", wandb.wandb_sdk.wandb_run.Run.use_artifact
65
+ "wandb.use_artifact", wandb.Run.use_artifact
72
66
  )
73
67
  wandb.log_artifact = preinit.PreInitCallable(
74
- "wandb.log_artifact", wandb.wandb_sdk.wandb_run.Run.log_artifact
68
+ "wandb.log_artifact", wandb.Run.log_artifact
75
69
  )
76
70
  wandb.define_metric = preinit.PreInitCallable(
77
- "wandb.define_metric", wandb.wandb_sdk.wandb_run.Run.define_metric
71
+ "wandb.define_metric", wandb.Run.define_metric
78
72
  )
wandb/sdk/lib/progress.py CHANGED
@@ -14,25 +14,6 @@ from wandb.sdk.lib import asyncio_compat
14
14
  from . import printer as p
15
15
 
16
16
 
17
- def print_sync_dedupe_stats(
18
- printer: p.Printer,
19
- final_result: pb.PollExitResponse,
20
- ) -> None:
21
- """Print how much W&B sync reduced the amount of uploaded data.
22
-
23
- Args:
24
- final_result: The final PollExit result.
25
- """
26
- deduped_bytes = final_result.pusher_stats.deduped_bytes
27
- total_bytes = final_result.pusher_stats.total_bytes
28
-
29
- if total_bytes <= 0 or deduped_bytes <= 0:
30
- return
31
-
32
- frac = deduped_bytes / total_bytes
33
- printer.display(f"W&B sync reduced upload amount by {frac:.1%}")
34
-
35
-
36
17
  async def loop_printing_operation_stats(
37
18
  progress: ProgressPrinter,
38
19
  interface: interface.InterfaceBase,
@@ -110,10 +110,6 @@ class SockClient:
110
110
  def shutdown(self, val: int) -> None:
111
111
  self._sock.shutdown(val)
112
112
 
113
- def set_socket(self, sock: socket.socket) -> None:
114
- self._sock = sock
115
- self._detect_bufsize()
116
-
117
113
  def _sendall_with_error_handle(self, data: bytes) -> None:
118
114
  # This is a helper function for sending data in a retry fashion.
119
115
  # Similar to the sendall() function in the socket module, but with
wandb/sdk/wandb_init.py CHANGED
@@ -340,7 +340,7 @@ class _WandbInit:
340
340
  def _load_autoresume_run_id(self, resume_file: pathlib.Path) -> str | None:
341
341
  """Returns the run_id stored in the auto-resume file, if any.
342
342
 
343
- Returns None if the file does not exist or is not in a valid format.
343
+ Returns `None` if the file does not exist or is not in a valid format.
344
344
 
345
345
  Args:
346
346
  resume_file: The file path to use for resume='auto' mode.
@@ -740,7 +740,6 @@ class _WandbInit:
740
740
  drun._config.update(config.sweep_no_artifacts)
741
741
  drun._config.update(config.base_no_artifacts)
742
742
  drun.summary = SummaryDisabled() # type: ignore
743
- drun._Run__metadata = wandb.sdk.wandb_metadata.Metadata()
744
743
 
745
744
  # methods
746
745
  drun.log = lambda data, *_, **__: drun.summary.update(data) # type: ignore[method-assign]
@@ -1259,7 +1258,7 @@ def init( # noqa: C901
1259
1258
  allow_val_change: bool | None = None,
1260
1259
  group: str | None = None,
1261
1260
  job_type: str | None = None,
1262
- mode: Literal["online", "offline", "disabled"] | None = None,
1261
+ mode: Literal["online", "offline", "disabled", "shared"] | None = None,
1263
1262
  force: bool | None = None,
1264
1263
  anonymous: Literal["never", "allow", "must"] | None = None,
1265
1264
  reinit: (
@@ -1289,53 +1288,17 @@ def init( # noqa: C901
1289
1288
 
1290
1289
  `wandb.init()` spawns a new background process to log data to a run, and it
1291
1290
  also syncs data to https://wandb.ai by default, so you can see your results
1292
- in real-time.
1291
+ in real-time. When you're done logging data, call `wandb.Run.finish()` to end the run.
1292
+ If you don't call `run.finish()`, the run will end when your script exits.
1293
1293
 
1294
- Call `wandb.init()` to start a run before logging data with `wandb.log()`.
1295
- When you're done logging data, call `wandb.finish()` to end the run. If you
1296
- don't call `wandb.finish()`, the run will end when your script exits.
1297
-
1298
- For more on using `wandb.init()`, including detailed examples, check out our
1299
- [guide and FAQs](https://docs.wandb.ai/guides/track/launch).
1300
-
1301
- Examples:
1302
- ### Explicitly set the entity and project and choose a name for the run:
1303
-
1304
- ```python
1305
- import wandb
1306
-
1307
- run = wandb.init(
1308
- entity="geoff",
1309
- project="capsules",
1310
- name="experiment-2021-10-31",
1311
- )
1312
-
1313
- # ... your training code here ...
1314
-
1315
- run.finish()
1316
- ```
1317
-
1318
- ### Add metadata about the run using the `config` argument:
1319
-
1320
- ```python
1321
- import wandb
1322
-
1323
- config = {"lr": 0.01, "batch_size": 32}
1324
- with wandb.init(config=config) as run:
1325
- run.config.update({"architecture": "resnet", "depth": 34})
1326
-
1327
- # ... your training code here ...
1328
- ```
1329
-
1330
- Note that you can use `wandb.init()` as a context manager to automatically
1331
- call `wandb.finish()` at the end of the block.
1294
+ Run IDs must not contain any of the following special characters `/ \ # ? % :`
1332
1295
 
1333
1296
  Args:
1334
- entity: The username or team name under which the runs will be logged.
1335
- The entity must already exist, so ensure you’ve created your account
1297
+ entity: The username or team name the runs are logged to.
1298
+ The entity must already exist, so ensure you create your account
1336
1299
  or team in the UI before starting to log runs. If not specified, the
1337
1300
  run will default your default entity. To change the default entity,
1338
- go to [your settings](https://wandb.ai/settings) and update the
1301
+ go to your settings and update the
1339
1302
  "Default location to create new projects" under "Default team".
1340
1303
  project: The name of the project under which this run will be logged.
1341
1304
  If not specified, we use a heuristic to infer the project name based
@@ -1347,9 +1310,8 @@ def init( # noqa: C901
1347
1310
  to the `./wandb` directory. Note that this does not affect the
1348
1311
  location where artifacts are stored when calling `download()`.
1349
1312
  id: A unique identifier for this run, used for resuming. It must be unique
1350
- within the project and cannot be reused once a run is deleted. The
1351
- identifier must not contain any of the following special characters:
1352
- `/ \ # ? % :`. For a short descriptive name, use the `name` field,
1313
+ within the project and cannot be reused once a run is deleted. For
1314
+ a short descriptive name, use the `name` field,
1353
1315
  or for saving hyperparameters to compare across runs, use `config`.
1354
1316
  name: A short display name for this run, which appears in the UI to help
1355
1317
  you identify it. By default, we generate a random two-word name
@@ -1365,7 +1327,7 @@ def init( # noqa: C901
1365
1327
  the UI.
1366
1328
  If resuming a run, the tags provided here will replace any existing
1367
1329
  tags. To add tags to a resumed run without overwriting the current
1368
- tags, use `run.tags += ["new_tag"]` after calling `run = wandb.init()`.
1330
+ tags, use `run.tags += ("new_tag",)` after calling `run = wandb.init()`.
1369
1331
  config: Sets `wandb.config`, a dictionary-like object for storing input
1370
1332
  parameters to your run, such as model hyperparameters or data
1371
1333
  preprocessing settings.
@@ -1390,54 +1352,56 @@ def init( # noqa: C901
1390
1352
  multiple jobs that train and evaluate a model on different test sets.
1391
1353
  Grouping allows you to manage related runs collectively in the UI,
1392
1354
  making it easy to toggle and review results as a unified experiment.
1393
- For more information, refer to our
1394
- [guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
1395
1355
  job_type: Specify the type of run, especially helpful when organizing runs
1396
1356
  within a group as part of a larger experiment. For example, in a group,
1397
1357
  you might label runs with job types such as "train" and "eval".
1398
1358
  Defining job types enables you to easily filter and group similar runs
1399
1359
  in the UI, facilitating direct comparisons.
1400
1360
  mode: Specifies how run data is managed, with the following options:
1401
- - `"online"` (default): Enables live syncing with W&B when a network
1402
- connection is available, with real-time updates to visualizations.
1403
- - `"offline"`: Suitable for air-gapped or offline environments; data
1404
- is saved locally and can be synced later. Ensure the run folder
1405
- is preserved to enable future syncing.
1406
- - `"disabled"`: Disables all W&B functionality, making the run’s methods
1407
- no-ops. Typically used in testing to bypass W&B operations.
1361
+ - `"online"` (default): Enables live syncing with W&B when a network
1362
+ connection is available, with real-time updates to visualizations.
1363
+ - `"offline"`: Suitable for air-gapped or offline environments; data
1364
+ is saved locally and can be synced later. Ensure the run folder
1365
+ is preserved to enable future syncing.
1366
+ - `"disabled"`: Disables all W&B functionality, making the run’s methods
1367
+ no-ops. Typically used in testing to bypass W&B operations.
1368
+ - `"shared"`: (This is an experimental feature). Allows multiple processes,
1369
+ possibly on different machines, to simultaneously log to the same run.
1370
+ In this approach you use a primary node and one or more worker nodes
1371
+ to log data to the same run. Within the primary node you
1372
+ initialize a run. For each worker node, initialize a run
1373
+ using the run ID used by the primary node.
1408
1374
  force: Determines if a W&B login is required to run the script. If `True`,
1409
1375
  the user must be logged in to W&B; otherwise, the script will not
1410
1376
  proceed. If `False` (default), the script can proceed without a login,
1411
1377
  switching to offline mode if the user is not logged in.
1412
1378
  anonymous: Specifies the level of control over anonymous data logging.
1413
1379
  Available options are:
1414
- - `"never"` (default): Requires you to link your W&B account before
1415
- tracking the run. This prevents unintentional creation of anonymous
1416
- runs by ensuring each run is associated with an account.
1417
- - `"allow"`: Enables a logged-in user to track runs with their account,
1418
- but also allows someone running the script without a W&B account
1419
- to view the charts and data in the UI.
1420
- - `"must"`: Forces the run to be logged to an anonymous account, even
1421
- if the user is logged in.
1380
+ - `"never"` (default): Requires you to link your W&B account before
1381
+ tracking the run. This prevents unintentional creation of anonymous
1382
+ runs by ensuring each run is associated with an account.
1383
+ - `"allow"`: Enables a logged-in user to track runs with their account,
1384
+ but also allows someone running the script without a W&B account
1385
+ to view the charts and data in the UI.
1386
+ - `"must"`: Forces the run to be logged to an anonymous account, even
1387
+ if the user is logged in.
1422
1388
  reinit: Shorthand for the "reinit" setting. Determines the behavior of
1423
1389
  `wandb.init()` when a run is active.
1424
1390
  resume: Controls the behavior when resuming a run with the specified `id`.
1425
1391
  Available options are:
1426
- - `"allow"`: If a run with the specified `id` exists, it will resume
1427
- from the last step; otherwise, a new run will be created.
1428
- - `"never"`: If a run with the specified `id` exists, an error will
1429
- be raised. If no such run is found, a new run will be created.
1430
- - `"must"`: If a run with the specified `id` exists, it will resume
1431
- from the last step. If no run is found, an error will be raised.
1432
- - `"auto"`: Automatically resumes the previous run if it crashed on
1433
- this machine; otherwise, starts a new run.
1434
- - `True`: Deprecated. Use `"auto"` instead.
1435
- - `False`: Deprecated. Use the default behavior (leaving `resume`
1436
- unset) to always start a new run.
1437
- Note: If `resume` is set, `fork_from` and `resume_from` cannot be
1392
+ - `"allow"`: If a run with the specified `id` exists, it will resume
1393
+ from the last step; otherwise, a new run will be created.
1394
+ - `"never"`: If a run with the specified `id` exists, an error will
1395
+ be raised. If no such run is found, a new run will be created.
1396
+ - `"must"`: If a run with the specified `id` exists, it will resume
1397
+ from the last step. If no run is found, an error will be raised.
1398
+ - `"auto"`: Automatically resumes the previous run if it crashed on
1399
+ this machine; otherwise, starts a new run.
1400
+ - `True`: Deprecated. Use `"auto"` instead.
1401
+ - `False`: Deprecated. Use the default behavior (leaving `resume`
1402
+ unset) to always start a new run.
1403
+ If `resume` is set, `fork_from` and `resume_from` cannot be
1438
1404
  used. When `resume` is unset, the system will always start a new run.
1439
- For more details, see our
1440
- [guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
1441
1405
  resume_from: Specifies a moment in a previous run to resume a run from,
1442
1406
  using the format `{run_id}?_step={step}`. This allows users to truncate
1443
1407
  the history logged to a run at an intermediate step and resume logging
@@ -1446,7 +1410,7 @@ def init( # noqa: C901
1446
1410
  take precedence.
1447
1411
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1448
1412
  one of them can be used at a time.
1449
- Note: This feature is in beta and may change in the future.
1413
+ Note that this feature is in beta and may change in the future.
1450
1414
  fork_from: Specifies a point in a previous run from which to fork a new
1451
1415
  run, using the format `{id}?_step={step}`. This creates a new run that
1452
1416
  resumes logging from the specified step in the target run’s history.
@@ -1455,35 +1419,45 @@ def init( # noqa: C901
1455
1419
  `fork_from` argument, an error will be raised if they are the same.
1456
1420
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1457
1421
  one of them can be used at a time.
1458
- Note: This feature is in beta and may change in the future.
1422
+ Note that this feature is in beta and may change in the future.
1459
1423
  save_code: Enables saving the main script or notebook to W&B, aiding in
1460
1424
  experiment reproducibility and allowing code comparisons across runs in
1461
1425
  the UI. By default, this is disabled, but you can change the default to
1462
- enable on your [settings page](https://wandb.ai/settings).
1426
+ enable on your settings page.
1463
1427
  tensorboard: Deprecated. Use `sync_tensorboard` instead.
1464
1428
  sync_tensorboard: Enables automatic syncing of W&B logs from TensorBoard
1465
1429
  or TensorBoardX, saving relevant event files for viewing in the W&B UI.
1466
1430
  saving relevant event files for viewing in the W&B UI. (Default: `False`)
1467
1431
  monitor_gym: Enables automatic logging of videos of the environment when
1468
- using OpenAI Gym. For additional details, see our
1469
- [guide for gym integration](https://docs.wandb.com/guides/integrations/openai-gym).
1432
+ using OpenAI Gym.
1470
1433
  settings: Specifies a dictionary or `wandb.Settings` object with advanced
1471
1434
  settings for the run.
1472
1435
 
1473
1436
  Returns:
1474
- A `Run` object, which is a handle to the current run. Use this object
1475
- to perform operations like logging data, saving files, and finishing
1476
- the run. See the [Run API](https://docs.wandb.ai/ref/python/run) for
1477
- more details.
1437
+ A `Run` object.
1478
1438
 
1479
1439
  Raises:
1480
1440
  Error: If some unknown or internal error happened during the run
1481
1441
  initialization.
1482
1442
  AuthenticationError: If the user failed to provide valid credentials.
1483
- CommError: If there was a problem communicating with the W&B server.
1484
- UsageError: If the user provided invalid arguments to the function.
1485
- KeyboardInterrupt: If the user interrupts the run initialization process.
1486
- If the user interrupts the run initialization process.
1443
+ CommError: If there was a problem communicating with the WandB server.
1444
+ UsageError: If the user provided invalid arguments.
1445
+ KeyboardInterrupt: If user interrupts the run.
1446
+
1447
+ Examples:
1448
+ `wandb.init()` returns a `Run` object. Use the run object to log data,
1449
+ save artifacts, and manage the run lifecycle.
1450
+
1451
+ ```python
1452
+ import wandb
1453
+
1454
+ config = {"lr": 0.01, "batch_size": 32}
1455
+ with wandb.init(config=config) as run:
1456
+ # Log accuracy and loss to the run
1457
+ acc = 0.95 # Example accuracy
1458
+ loss = 0.05 # Example loss
1459
+ run.log({"accuracy": acc, "loss": loss})
1460
+ ```
1487
1461
  """
1488
1462
  wandb._assert_is_user_process() # type: ignore
1489
1463
 
wandb/sdk/wandb_login.py CHANGED
@@ -55,25 +55,26 @@ def login(
55
55
  `verify=True`.
56
56
 
57
57
  Args:
58
- anonymous: (string, optional) Can be "must", "allow", or "never".
58
+ anonymous: Set to "must", "allow", or "never".
59
59
  If set to "must", always log a user in anonymously. If set to
60
60
  "allow", only create an anonymous user if the user
61
61
  isn't already logged in. If set to "never", never log a
62
- user anonymously. Default set to "never".
63
- key: (string, optional) The API key to use.
64
- relogin: (bool, optional) If true, will re-prompt for API key.
65
- host: (string, optional) The host to connect to.
66
- force: (bool, optional) If true, will force a relogin.
67
- timeout: (int, optional) Number of seconds to wait for user input.
68
- verify: (bool) Verify the credentials with the W&B server.
69
- referrer: (string, optional) The referrer to use in the URL login request.
62
+ user anonymously. Default set to "never". Defaults to `None`.
63
+ key: The API key to use.
64
+ relogin: If true, will re-prompt for API key.
65
+ host: The host to connect to.
66
+ force: If true, will force a relogin.
67
+ timeout: Number of seconds to wait for user input.
68
+ verify: Verify the credentials with the W&B server.
69
+ referrer: The referrer to use in the URL login request.
70
+
70
71
 
71
72
  Returns:
72
- bool: if key is configured
73
+ bool: If `key` is configured.
73
74
 
74
75
  Raises:
75
- AuthenticationError - if api_key fails verification with the server
76
- UsageError - if api_key cannot be configured and no tty
76
+ AuthenticationError: If `api_key` fails verification with the server.
77
+ UsageError: If `api_key` cannot be configured and no tty.
77
78
  """
78
79
  _handle_host_wandb_setting(host)
79
80
  return _login(
@@ -258,7 +259,8 @@ class _WandbLogin:
258
259
 
259
260
  if not is_api_key_valid:
260
261
  raise AuthenticationError(
261
- "API key verification failed. Make sure your API key is valid."
262
+ f"API key verification failed for host {self._settings.base_url}."
263
+ " Make sure your API key is valid."
262
264
  )
263
265
 
264
266
 
@@ -272,6 +274,7 @@ def _login(
272
274
  timeout: Optional[int] = None,
273
275
  verify: bool = False,
274
276
  referrer: str = "models",
277
+ update_api_key: bool = True,
275
278
  _silent: Optional[bool] = None,
276
279
  _disable_warning: Optional[bool] = None,
277
280
  ) -> bool:
@@ -318,7 +321,8 @@ def _login(
318
321
  wlogin._verify_login(key)
319
322
 
320
323
  if not key_is_pre_configured:
321
- wlogin.try_save_api_key(key)
324
+ if update_api_key:
325
+ wlogin.try_save_api_key(key)
322
326
  wlogin.update_session(key, status=key_status)
323
327
  wlogin._update_global_anonymous_setting()
324
328
 
wandb/sdk/wandb_metric.py CHANGED
@@ -100,6 +100,8 @@ class Metric:
100
100
  m.summary.none = True
101
101
  if "best" in summary_set:
102
102
  m.summary.best = True
103
+ if "first" in summary_set:
104
+ m.summary.first = True
103
105
  if self._goal == "min":
104
106
  m.goal = m.GOAL_MINIMIZE
105
107
  if self._goal == "max":
@@ -60,7 +60,6 @@ class _Requires:
60
60
  func()
61
61
 
62
62
  if last_message:
63
- wandb.termwarn("Supported requirements are: `legacy-service`, `service`.")
64
63
  raise UnsupportedError(last_message)
65
64
 
66
65