wandb 0.21.0__py3-none-win_amd64.whl → 0.21.2__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 (153) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +427 -450
  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/public/__init__.py +1 -1
  7. wandb/apis/public/api.py +525 -360
  8. wandb/apis/public/artifacts.py +207 -13
  9. wandb/apis/public/automations.py +19 -3
  10. wandb/apis/public/files.py +172 -33
  11. wandb/apis/public/history.py +67 -15
  12. wandb/apis/public/integrations.py +25 -2
  13. wandb/apis/public/jobs.py +90 -2
  14. wandb/apis/public/projects.py +130 -79
  15. wandb/apis/public/query_generator.py +11 -1
  16. wandb/apis/public/registries/_utils.py +14 -16
  17. wandb/apis/public/registries/registries_search.py +183 -304
  18. wandb/apis/public/reports.py +96 -15
  19. wandb/apis/public/runs.py +299 -105
  20. wandb/apis/public/sweeps.py +222 -22
  21. wandb/apis/public/teams.py +41 -4
  22. wandb/apis/public/users.py +45 -4
  23. wandb/automations/_generated/delete_automation.py +1 -3
  24. wandb/automations/_generated/enums.py +13 -11
  25. wandb/beta/workflows.py +66 -30
  26. wandb/bin/gpu_stats.exe +0 -0
  27. wandb/bin/wandb-core +0 -0
  28. wandb/cli/cli.py +127 -3
  29. wandb/env.py +8 -0
  30. wandb/errors/errors.py +4 -1
  31. wandb/integration/lightning/fabric/logger.py +3 -4
  32. wandb/integration/metaflow/__init__.py +6 -0
  33. wandb/integration/metaflow/data_pandas.py +74 -0
  34. wandb/integration/metaflow/data_pytorch.py +75 -0
  35. wandb/integration/metaflow/data_sklearn.py +76 -0
  36. wandb/integration/metaflow/errors.py +13 -0
  37. wandb/integration/metaflow/metaflow.py +167 -223
  38. wandb/integration/openai/fine_tuning.py +1 -2
  39. wandb/integration/weave/__init__.py +6 -0
  40. wandb/integration/weave/interface.py +49 -0
  41. wandb/integration/weave/weave.py +63 -0
  42. wandb/jupyter.py +5 -5
  43. wandb/plot/custom_chart.py +30 -7
  44. wandb/proto/v3/wandb_internal_pb2.py +281 -280
  45. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  46. wandb/proto/v4/wandb_internal_pb2.py +280 -280
  47. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  48. wandb/proto/v5/wandb_internal_pb2.py +280 -280
  49. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  50. wandb/proto/v6/wandb_internal_pb2.py +280 -280
  51. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  52. wandb/proto/wandb_deprecated.py +6 -0
  53. wandb/sdk/artifacts/_factories.py +17 -0
  54. wandb/sdk/artifacts/_generated/__init__.py +221 -13
  55. wandb/sdk/artifacts/_generated/artifact_by_id.py +17 -0
  56. wandb/sdk/artifacts/_generated/artifact_by_name.py +22 -0
  57. wandb/sdk/artifacts/_generated/artifact_collection_membership_file_urls.py +43 -0
  58. wandb/sdk/artifacts/_generated/artifact_created_by.py +47 -0
  59. wandb/sdk/artifacts/_generated/artifact_file_urls.py +22 -0
  60. wandb/sdk/artifacts/_generated/artifact_type.py +31 -0
  61. wandb/sdk/artifacts/_generated/artifact_used_by.py +43 -0
  62. wandb/sdk/artifacts/_generated/artifact_via_membership_by_name.py +26 -0
  63. wandb/sdk/artifacts/_generated/delete_artifact.py +28 -0
  64. wandb/sdk/artifacts/_generated/enums.py +5 -0
  65. wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py +38 -0
  66. wandb/sdk/artifacts/_generated/fetch_registries.py +32 -0
  67. wandb/sdk/artifacts/_generated/fragments.py +279 -41
  68. wandb/sdk/artifacts/_generated/link_artifact.py +6 -0
  69. wandb/sdk/artifacts/_generated/operations.py +654 -51
  70. wandb/sdk/artifacts/_generated/registry_collections.py +34 -0
  71. wandb/sdk/artifacts/_generated/registry_versions.py +34 -0
  72. wandb/sdk/artifacts/_generated/unlink_artifact.py +25 -0
  73. wandb/sdk/artifacts/_graphql_fragments.py +3 -86
  74. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  75. wandb/sdk/artifacts/_validators.py +14 -4
  76. wandb/sdk/artifacts/artifact.py +512 -618
  77. wandb/sdk/artifacts/artifact_file_cache.py +10 -6
  78. wandb/sdk/artifacts/artifact_manifest.py +10 -9
  79. wandb/sdk/artifacts/artifact_manifest_entry.py +9 -10
  80. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +5 -3
  81. wandb/sdk/artifacts/storage_handlers/http_handler.py +1 -1
  82. wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
  83. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +1 -1
  84. wandb/sdk/data_types/audio.py +38 -10
  85. wandb/sdk/data_types/base_types/media.py +6 -56
  86. wandb/sdk/data_types/graph.py +48 -14
  87. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  88. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  89. wandb/sdk/data_types/histogram.py +34 -21
  90. wandb/sdk/data_types/html.py +35 -12
  91. wandb/sdk/data_types/image.py +104 -68
  92. wandb/sdk/data_types/molecule.py +32 -19
  93. wandb/sdk/data_types/object_3d.py +36 -17
  94. wandb/sdk/data_types/plotly.py +18 -5
  95. wandb/sdk/data_types/saved_model.py +4 -6
  96. wandb/sdk/data_types/table.py +59 -30
  97. wandb/sdk/data_types/video.py +53 -26
  98. wandb/sdk/integration_utils/auto_logging.py +2 -2
  99. wandb/sdk/interface/interface_queue.py +1 -4
  100. wandb/sdk/interface/interface_shared.py +26 -37
  101. wandb/sdk/interface/interface_sock.py +24 -14
  102. wandb/sdk/internal/internal_api.py +6 -0
  103. wandb/sdk/internal/job_builder.py +6 -0
  104. wandb/sdk/internal/settings_static.py +2 -3
  105. wandb/sdk/launch/agent/agent.py +8 -1
  106. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  107. wandb/sdk/launch/create_job.py +15 -2
  108. wandb/sdk/launch/inputs/internal.py +3 -4
  109. wandb/sdk/launch/inputs/schema.py +1 -0
  110. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  111. wandb/sdk/launch/runner/kubernetes_runner.py +323 -1
  112. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  113. wandb/sdk/lib/asyncio_compat.py +19 -16
  114. wandb/sdk/lib/asyncio_manager.py +252 -0
  115. wandb/sdk/lib/deprecate.py +1 -7
  116. wandb/sdk/lib/disabled.py +1 -1
  117. wandb/sdk/lib/hashutil.py +27 -5
  118. wandb/sdk/lib/module.py +7 -13
  119. wandb/sdk/lib/printer.py +2 -2
  120. wandb/sdk/lib/printer_asyncio.py +3 -1
  121. wandb/sdk/lib/progress.py +0 -19
  122. wandb/sdk/lib/retry.py +185 -78
  123. wandb/sdk/lib/service/service_client.py +106 -0
  124. wandb/sdk/lib/service/service_connection.py +20 -26
  125. wandb/sdk/lib/service/service_token.py +30 -13
  126. wandb/sdk/mailbox/mailbox.py +13 -5
  127. wandb/sdk/mailbox/mailbox_handle.py +22 -13
  128. wandb/sdk/mailbox/response_handle.py +42 -106
  129. wandb/sdk/mailbox/wait_with_progress.py +7 -42
  130. wandb/sdk/wandb_init.py +77 -116
  131. wandb/sdk/wandb_login.py +19 -15
  132. wandb/sdk/wandb_metric.py +2 -0
  133. wandb/sdk/wandb_run.py +497 -469
  134. wandb/sdk/wandb_settings.py +145 -4
  135. wandb/sdk/wandb_setup.py +204 -124
  136. wandb/sdk/wandb_sweep.py +14 -13
  137. wandb/sdk/wandb_watch.py +4 -6
  138. wandb/sync/sync.py +10 -0
  139. wandb/util.py +58 -1
  140. wandb/wandb_run.py +1 -2
  141. {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/METADATA +1 -1
  142. {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/RECORD +145 -129
  143. wandb/sdk/interface/interface_relay.py +0 -38
  144. wandb/sdk/interface/router.py +0 -89
  145. wandb/sdk/interface/router_queue.py +0 -43
  146. wandb/sdk/interface/router_relay.py +0 -50
  147. wandb/sdk/interface/router_sock.py +0 -32
  148. wandb/sdk/lib/sock_client.py +0 -236
  149. wandb/vendor/pynvml/__init__.py +0 -0
  150. wandb/vendor/pynvml/pynvml.py +0 -4779
  151. {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/WHEEL +0 -0
  152. {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/entry_points.txt +0 -0
  153. {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_init.py CHANGED
@@ -11,7 +11,6 @@ For more on using `wandb.init()`, including code snippets, check out our
11
11
  from __future__ import annotations
12
12
 
13
13
  import contextlib
14
- import copy
15
14
  import dataclasses
16
15
  import json
17
16
  import logging
@@ -31,7 +30,7 @@ from wandb import env, trigger
31
30
  from wandb.errors import CommError, Error, UsageError
32
31
  from wandb.errors.links import url_registry
33
32
  from wandb.errors.util import ProtobufErrorHandler
34
- from wandb.integration import sagemaker
33
+ from wandb.integration import sagemaker, weave
35
34
  from wandb.proto.wandb_deprecated import Deprecated
36
35
  from wandb.sdk.lib import ipython as wb_ipython
37
36
  from wandb.sdk.lib import progress, runid, wb_logging
@@ -202,23 +201,7 @@ class _WandbInit:
202
201
  Returns:
203
202
  A callback to print any generated warnings.
204
203
  """
205
- exclude_env_vars = {"WANDB_SERVICE", "WANDB_KUBEFLOW_URL"}
206
- # check if environment variables have changed
207
- singleton_env = {
208
- k: v
209
- for k, v in wandb_setup.singleton()._environ.items()
210
- if k.startswith("WANDB_") and k not in exclude_env_vars
211
- }
212
- os_env = {
213
- k: v
214
- for k, v in os.environ.items()
215
- if k.startswith("WANDB_") and k not in exclude_env_vars
216
- }
217
-
218
- if (
219
- set(singleton_env.keys()) == set(os_env.keys()) #
220
- and set(singleton_env.values()) == set(os_env.values())
221
- ):
204
+ if not self._wl.did_environment_change():
222
205
  return _noop_printer_callback()
223
206
 
224
207
  def print_warning(run_printer: printer.Printer) -> None:
@@ -340,7 +323,7 @@ class _WandbInit:
340
323
  def _load_autoresume_run_id(self, resume_file: pathlib.Path) -> str | None:
341
324
  """Returns the run_id stored in the auto-resume file, if any.
342
325
 
343
- Returns None if the file does not exist or is not in a valid format.
326
+ Returns `None` if the file does not exist or is not in a valid format.
344
327
 
345
328
  Args:
346
329
  resume_file: The file path to use for resume='auto' mode.
@@ -475,9 +458,9 @@ class _WandbInit:
475
458
  )
476
459
  self._telemetry.feature.sagemaker = True
477
460
 
478
- if self._wl._config:
461
+ if self._wl.config:
479
462
  self._split_artifacts_from_config(
480
- self._wl._config,
463
+ self._wl.config,
481
464
  config_target=result.base_no_artifacts,
482
465
  artifacts=result.artifacts,
483
466
  )
@@ -996,7 +979,6 @@ class _WandbInit:
996
979
  result = wait_with_progress(
997
980
  run_init_handle,
998
981
  timeout=timeout,
999
- progress_after=1,
1000
982
  display_progress=display_init_message,
1001
983
  )
1002
984
 
@@ -1112,8 +1094,7 @@ def _attach(
1112
1094
  except Exception as e:
1113
1095
  raise UsageError(f"Unable to attach to run {attach_id}") from e
1114
1096
 
1115
- settings: Settings = copy.copy(_wl._settings)
1116
-
1097
+ settings = _wl.settings.model_copy()
1117
1098
  settings.update_from_dict(
1118
1099
  {
1119
1100
  "run_id": attach_id,
@@ -1258,7 +1239,7 @@ def init( # noqa: C901
1258
1239
  allow_val_change: bool | None = None,
1259
1240
  group: str | None = None,
1260
1241
  job_type: str | None = None,
1261
- mode: Literal["online", "offline", "disabled"] | None = None,
1242
+ mode: Literal["online", "offline", "disabled", "shared"] | None = None,
1262
1243
  force: bool | None = None,
1263
1244
  anonymous: Literal["never", "allow", "must"] | None = None,
1264
1245
  reinit: (
@@ -1288,53 +1269,17 @@ def init( # noqa: C901
1288
1269
 
1289
1270
  `wandb.init()` spawns a new background process to log data to a run, and it
1290
1271
  also syncs data to https://wandb.ai by default, so you can see your results
1291
- in real-time.
1272
+ in real-time. When you're done logging data, call `wandb.Run.finish()` to end the run.
1273
+ If you don't call `run.finish()`, the run will end when your script exits.
1292
1274
 
1293
- Call `wandb.init()` to start a run before logging data with `wandb.log()`.
1294
- When you're done logging data, call `wandb.finish()` to end the run. If you
1295
- don't call `wandb.finish()`, the run will end when your script exits.
1296
-
1297
- For more on using `wandb.init()`, including detailed examples, check out our
1298
- [guide and FAQs](https://docs.wandb.ai/guides/track/launch).
1299
-
1300
- Examples:
1301
- ### Explicitly set the entity and project and choose a name for the run:
1302
-
1303
- ```python
1304
- import wandb
1305
-
1306
- run = wandb.init(
1307
- entity="geoff",
1308
- project="capsules",
1309
- name="experiment-2021-10-31",
1310
- )
1311
-
1312
- # ... your training code here ...
1313
-
1314
- run.finish()
1315
- ```
1316
-
1317
- ### Add metadata about the run using the `config` argument:
1318
-
1319
- ```python
1320
- import wandb
1321
-
1322
- config = {"lr": 0.01, "batch_size": 32}
1323
- with wandb.init(config=config) as run:
1324
- run.config.update({"architecture": "resnet", "depth": 34})
1325
-
1326
- # ... your training code here ...
1327
- ```
1328
-
1329
- Note that you can use `wandb.init()` as a context manager to automatically
1330
- call `wandb.finish()` at the end of the block.
1275
+ Run IDs must not contain any of the following special characters `/ \ # ? % :`
1331
1276
 
1332
1277
  Args:
1333
- entity: The username or team name under which the runs will be logged.
1334
- The entity must already exist, so ensure you’ve created your account
1278
+ entity: The username or team name the runs are logged to.
1279
+ The entity must already exist, so ensure you create your account
1335
1280
  or team in the UI before starting to log runs. If not specified, the
1336
1281
  run will default your default entity. To change the default entity,
1337
- go to [your settings](https://wandb.ai/settings) and update the
1282
+ go to your settings and update the
1338
1283
  "Default location to create new projects" under "Default team".
1339
1284
  project: The name of the project under which this run will be logged.
1340
1285
  If not specified, we use a heuristic to infer the project name based
@@ -1346,9 +1291,8 @@ def init( # noqa: C901
1346
1291
  to the `./wandb` directory. Note that this does not affect the
1347
1292
  location where artifacts are stored when calling `download()`.
1348
1293
  id: A unique identifier for this run, used for resuming. It must be unique
1349
- within the project and cannot be reused once a run is deleted. The
1350
- identifier must not contain any of the following special characters:
1351
- `/ \ # ? % :`. For a short descriptive name, use the `name` field,
1294
+ within the project and cannot be reused once a run is deleted. For
1295
+ a short descriptive name, use the `name` field,
1352
1296
  or for saving hyperparameters to compare across runs, use `config`.
1353
1297
  name: A short display name for this run, which appears in the UI to help
1354
1298
  you identify it. By default, we generate a random two-word name
@@ -1389,54 +1333,56 @@ def init( # noqa: C901
1389
1333
  multiple jobs that train and evaluate a model on different test sets.
1390
1334
  Grouping allows you to manage related runs collectively in the UI,
1391
1335
  making it easy to toggle and review results as a unified experiment.
1392
- For more information, refer to our
1393
- [guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
1394
1336
  job_type: Specify the type of run, especially helpful when organizing runs
1395
1337
  within a group as part of a larger experiment. For example, in a group,
1396
1338
  you might label runs with job types such as "train" and "eval".
1397
1339
  Defining job types enables you to easily filter and group similar runs
1398
1340
  in the UI, facilitating direct comparisons.
1399
1341
  mode: Specifies how run data is managed, with the following options:
1400
- - `"online"` (default): Enables live syncing with W&B when a network
1401
- connection is available, with real-time updates to visualizations.
1402
- - `"offline"`: Suitable for air-gapped or offline environments; data
1403
- is saved locally and can be synced later. Ensure the run folder
1404
- is preserved to enable future syncing.
1405
- - `"disabled"`: Disables all W&B functionality, making the run’s methods
1406
- no-ops. Typically used in testing to bypass W&B operations.
1342
+ - `"online"` (default): Enables live syncing with W&B when a network
1343
+ connection is available, with real-time updates to visualizations.
1344
+ - `"offline"`: Suitable for air-gapped or offline environments; data
1345
+ is saved locally and can be synced later. Ensure the run folder
1346
+ is preserved to enable future syncing.
1347
+ - `"disabled"`: Disables all W&B functionality, making the run’s methods
1348
+ no-ops. Typically used in testing to bypass W&B operations.
1349
+ - `"shared"`: (This is an experimental feature). Allows multiple processes,
1350
+ possibly on different machines, to simultaneously log to the same run.
1351
+ In this approach you use a primary node and one or more worker nodes
1352
+ to log data to the same run. Within the primary node you
1353
+ initialize a run. For each worker node, initialize a run
1354
+ using the run ID used by the primary node.
1407
1355
  force: Determines if a W&B login is required to run the script. If `True`,
1408
1356
  the user must be logged in to W&B; otherwise, the script will not
1409
1357
  proceed. If `False` (default), the script can proceed without a login,
1410
1358
  switching to offline mode if the user is not logged in.
1411
1359
  anonymous: Specifies the level of control over anonymous data logging.
1412
1360
  Available options are:
1413
- - `"never"` (default): Requires you to link your W&B account before
1414
- tracking the run. This prevents unintentional creation of anonymous
1415
- runs by ensuring each run is associated with an account.
1416
- - `"allow"`: Enables a logged-in user to track runs with their account,
1417
- but also allows someone running the script without a W&B account
1418
- to view the charts and data in the UI.
1419
- - `"must"`: Forces the run to be logged to an anonymous account, even
1420
- if the user is logged in.
1361
+ - `"never"` (default): Requires you to link your W&B account before
1362
+ tracking the run. This prevents unintentional creation of anonymous
1363
+ runs by ensuring each run is associated with an account.
1364
+ - `"allow"`: Enables a logged-in user to track runs with their account,
1365
+ but also allows someone running the script without a W&B account
1366
+ to view the charts and data in the UI.
1367
+ - `"must"`: Forces the run to be logged to an anonymous account, even
1368
+ if the user is logged in.
1421
1369
  reinit: Shorthand for the "reinit" setting. Determines the behavior of
1422
1370
  `wandb.init()` when a run is active.
1423
1371
  resume: Controls the behavior when resuming a run with the specified `id`.
1424
1372
  Available options are:
1425
- - `"allow"`: If a run with the specified `id` exists, it will resume
1426
- from the last step; otherwise, a new run will be created.
1427
- - `"never"`: If a run with the specified `id` exists, an error will
1428
- be raised. If no such run is found, a new run will be created.
1429
- - `"must"`: If a run with the specified `id` exists, it will resume
1430
- from the last step. If no run is found, an error will be raised.
1431
- - `"auto"`: Automatically resumes the previous run if it crashed on
1432
- this machine; otherwise, starts a new run.
1433
- - `True`: Deprecated. Use `"auto"` instead.
1434
- - `False`: Deprecated. Use the default behavior (leaving `resume`
1435
- unset) to always start a new run.
1436
- Note: If `resume` is set, `fork_from` and `resume_from` cannot be
1373
+ - `"allow"`: If a run with the specified `id` exists, it will resume
1374
+ from the last step; otherwise, a new run will be created.
1375
+ - `"never"`: If a run with the specified `id` exists, an error will
1376
+ be raised. If no such run is found, a new run will be created.
1377
+ - `"must"`: If a run with the specified `id` exists, it will resume
1378
+ from the last step. If no run is found, an error will be raised.
1379
+ - `"auto"`: Automatically resumes the previous run if it crashed on
1380
+ this machine; otherwise, starts a new run.
1381
+ - `True`: Deprecated. Use `"auto"` instead.
1382
+ - `False`: Deprecated. Use the default behavior (leaving `resume`
1383
+ unset) to always start a new run.
1384
+ If `resume` is set, `fork_from` and `resume_from` cannot be
1437
1385
  used. When `resume` is unset, the system will always start a new run.
1438
- For more details, see our
1439
- [guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
1440
1386
  resume_from: Specifies a moment in a previous run to resume a run from,
1441
1387
  using the format `{run_id}?_step={step}`. This allows users to truncate
1442
1388
  the history logged to a run at an intermediate step and resume logging
@@ -1445,7 +1391,7 @@ def init( # noqa: C901
1445
1391
  take precedence.
1446
1392
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1447
1393
  one of them can be used at a time.
1448
- Note: This feature is in beta and may change in the future.
1394
+ Note that this feature is in beta and may change in the future.
1449
1395
  fork_from: Specifies a point in a previous run from which to fork a new
1450
1396
  run, using the format `{id}?_step={step}`. This creates a new run that
1451
1397
  resumes logging from the specified step in the target run’s history.
@@ -1454,35 +1400,45 @@ def init( # noqa: C901
1454
1400
  `fork_from` argument, an error will be raised if they are the same.
1455
1401
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1456
1402
  one of them can be used at a time.
1457
- Note: This feature is in beta and may change in the future.
1403
+ Note that this feature is in beta and may change in the future.
1458
1404
  save_code: Enables saving the main script or notebook to W&B, aiding in
1459
1405
  experiment reproducibility and allowing code comparisons across runs in
1460
1406
  the UI. By default, this is disabled, but you can change the default to
1461
- enable on your [settings page](https://wandb.ai/settings).
1407
+ enable on your settings page.
1462
1408
  tensorboard: Deprecated. Use `sync_tensorboard` instead.
1463
1409
  sync_tensorboard: Enables automatic syncing of W&B logs from TensorBoard
1464
1410
  or TensorBoardX, saving relevant event files for viewing in the W&B UI.
1465
1411
  saving relevant event files for viewing in the W&B UI. (Default: `False`)
1466
1412
  monitor_gym: Enables automatic logging of videos of the environment when
1467
- using OpenAI Gym. For additional details, see our
1468
- [guide for gym integration](https://docs.wandb.com/guides/integrations/openai-gym).
1413
+ using OpenAI Gym.
1469
1414
  settings: Specifies a dictionary or `wandb.Settings` object with advanced
1470
1415
  settings for the run.
1471
1416
 
1472
1417
  Returns:
1473
- A `Run` object, which is a handle to the current run. Use this object
1474
- to perform operations like logging data, saving files, and finishing
1475
- the run. See the [Run API](https://docs.wandb.ai/ref/python/run) for
1476
- more details.
1418
+ A `Run` object.
1477
1419
 
1478
1420
  Raises:
1479
1421
  Error: If some unknown or internal error happened during the run
1480
1422
  initialization.
1481
1423
  AuthenticationError: If the user failed to provide valid credentials.
1482
- CommError: If there was a problem communicating with the W&B server.
1483
- UsageError: If the user provided invalid arguments to the function.
1484
- KeyboardInterrupt: If the user interrupts the run initialization process.
1485
- If the user interrupts the run initialization process.
1424
+ CommError: If there was a problem communicating with the WandB server.
1425
+ UsageError: If the user provided invalid arguments.
1426
+ KeyboardInterrupt: If user interrupts the run.
1427
+
1428
+ Examples:
1429
+ `wandb.init()` returns a `Run` object. Use the run object to log data,
1430
+ save artifacts, and manage the run lifecycle.
1431
+
1432
+ ```python
1433
+ import wandb
1434
+
1435
+ config = {"lr": 0.01, "batch_size": 32}
1436
+ with wandb.init(config=config) as run:
1437
+ # Log accuracy and loss to the run
1438
+ acc = 0.95 # Example accuracy
1439
+ loss = 0.05 # Example loss
1440
+ run.log({"accuracy": acc, "loss": loss})
1441
+ ```
1486
1442
  """
1487
1443
  wandb._assert_is_user_process() # type: ignore
1488
1444
 
@@ -1603,7 +1559,12 @@ def init( # noqa: C901
1603
1559
  if run_settings.x_server_side_derived_summary:
1604
1560
  init_telemetry.feature.server_side_derived_summary = True
1605
1561
 
1606
- return wi.init(run_settings, run_config, run_printer)
1562
+ run = wi.init(run_settings, run_config, run_printer)
1563
+
1564
+ # Set up automatic Weave integration if Weave is installed
1565
+ weave.setup(run_settings.entity, run_settings.project)
1566
+
1567
+ return run
1607
1568
 
1608
1569
  except KeyboardInterrupt as e:
1609
1570
  if wl:
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(
@@ -201,7 +202,7 @@ class _WandbLogin:
201
202
  # Whenever the key changes, make sure to pull in user settings
202
203
  # from server.
203
204
  if not self._wandb_setup.settings._offline:
204
- self._wandb_setup._update_user_settings()
205
+ self._wandb_setup.update_user_settings()
205
206
 
206
207
  def _prompt_api_key(
207
208
  self, referrer: Optional[str] = None
@@ -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":