wandb 0.21.0__py3-none-macosx_11_0_arm64.whl → 0.21.1__py3-none-macosx_11_0_arm64.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 (97) 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 +526 -360
  8. wandb/apis/public/artifacts.py +204 -8
  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/registries_search.py +7 -15
  17. wandb/apis/public/reports.py +83 -5
  18. wandb/apis/public/runs.py +299 -105
  19. wandb/apis/public/sweeps.py +222 -22
  20. wandb/apis/public/teams.py +41 -4
  21. wandb/apis/public/users.py +45 -4
  22. wandb/beta/workflows.py +66 -30
  23. wandb/bin/gpu_stats +0 -0
  24. wandb/bin/wandb-core +0 -0
  25. wandb/cli/cli.py +80 -1
  26. wandb/env.py +8 -0
  27. wandb/errors/errors.py +4 -1
  28. wandb/integration/lightning/fabric/logger.py +3 -4
  29. wandb/integration/metaflow/__init__.py +6 -0
  30. wandb/integration/metaflow/data_pandas.py +74 -0
  31. wandb/integration/metaflow/errors.py +13 -0
  32. wandb/integration/metaflow/metaflow.py +205 -190
  33. wandb/integration/openai/fine_tuning.py +1 -2
  34. wandb/jupyter.py +5 -5
  35. wandb/plot/custom_chart.py +30 -7
  36. wandb/proto/v3/wandb_internal_pb2.py +280 -280
  37. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  38. wandb/proto/v4/wandb_internal_pb2.py +280 -280
  39. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  40. wandb/proto/v5/wandb_internal_pb2.py +280 -280
  41. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  42. wandb/proto/v6/wandb_internal_pb2.py +280 -280
  43. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  44. wandb/proto/wandb_deprecated.py +6 -0
  45. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  46. wandb/sdk/artifacts/_validators.py +8 -0
  47. wandb/sdk/artifacts/artifact.py +106 -75
  48. wandb/sdk/data_types/audio.py +38 -10
  49. wandb/sdk/data_types/base_types/media.py +6 -56
  50. wandb/sdk/data_types/graph.py +48 -14
  51. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  52. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  53. wandb/sdk/data_types/histogram.py +34 -21
  54. wandb/sdk/data_types/html.py +35 -12
  55. wandb/sdk/data_types/image.py +104 -68
  56. wandb/sdk/data_types/molecule.py +32 -19
  57. wandb/sdk/data_types/object_3d.py +36 -17
  58. wandb/sdk/data_types/plotly.py +18 -5
  59. wandb/sdk/data_types/saved_model.py +4 -6
  60. wandb/sdk/data_types/table.py +59 -30
  61. wandb/sdk/data_types/video.py +53 -26
  62. wandb/sdk/integration_utils/auto_logging.py +2 -2
  63. wandb/sdk/internal/internal_api.py +6 -0
  64. wandb/sdk/internal/job_builder.py +6 -0
  65. wandb/sdk/launch/agent/agent.py +8 -1
  66. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  67. wandb/sdk/launch/create_job.py +3 -1
  68. wandb/sdk/launch/inputs/internal.py +3 -4
  69. wandb/sdk/launch/inputs/schema.py +1 -0
  70. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  71. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  72. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  73. wandb/sdk/lib/asyncio_compat.py +3 -0
  74. wandb/sdk/lib/deprecate.py +1 -7
  75. wandb/sdk/lib/disabled.py +1 -1
  76. wandb/sdk/lib/hashutil.py +14 -1
  77. wandb/sdk/lib/module.py +7 -13
  78. wandb/sdk/lib/progress.py +0 -19
  79. wandb/sdk/lib/sock_client.py +0 -4
  80. wandb/sdk/wandb_init.py +66 -91
  81. wandb/sdk/wandb_login.py +18 -14
  82. wandb/sdk/wandb_metric.py +2 -0
  83. wandb/sdk/wandb_run.py +406 -414
  84. wandb/sdk/wandb_settings.py +130 -2
  85. wandb/sdk/wandb_setup.py +28 -28
  86. wandb/sdk/wandb_sweep.py +14 -13
  87. wandb/sdk/wandb_watch.py +4 -6
  88. wandb/sync/sync.py +10 -0
  89. wandb/util.py +57 -0
  90. wandb/wandb_run.py +1 -2
  91. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  92. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/RECORD +95 -95
  93. wandb/vendor/pynvml/__init__.py +0 -0
  94. wandb/vendor/pynvml/pynvml.py +0 -4779
  95. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  96. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  97. {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
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.
@@ -1258,7 +1258,7 @@ def init( # noqa: C901
1258
1258
  allow_val_change: bool | None = None,
1259
1259
  group: str | None = None,
1260
1260
  job_type: str | None = None,
1261
- mode: Literal["online", "offline", "disabled"] | None = None,
1261
+ mode: Literal["online", "offline", "disabled", "shared"] | None = None,
1262
1262
  force: bool | None = None,
1263
1263
  anonymous: Literal["never", "allow", "must"] | None = None,
1264
1264
  reinit: (
@@ -1288,53 +1288,17 @@ def init( # noqa: C901
1288
1288
 
1289
1289
  `wandb.init()` spawns a new background process to log data to a run, and it
1290
1290
  also syncs data to https://wandb.ai by default, so you can see your results
1291
- 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.
1292
1293
 
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.
1294
+ Run IDs must not contain any of the following special characters `/ \ # ? % :`
1331
1295
 
1332
1296
  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
1297
+ entity: The username or team name the runs are logged to.
1298
+ The entity must already exist, so ensure you create your account
1335
1299
  or team in the UI before starting to log runs. If not specified, the
1336
1300
  run will default your default entity. To change the default entity,
1337
- go to [your settings](https://wandb.ai/settings) and update the
1301
+ go to your settings and update the
1338
1302
  "Default location to create new projects" under "Default team".
1339
1303
  project: The name of the project under which this run will be logged.
1340
1304
  If not specified, we use a heuristic to infer the project name based
@@ -1346,9 +1310,8 @@ def init( # noqa: C901
1346
1310
  to the `./wandb` directory. Note that this does not affect the
1347
1311
  location where artifacts are stored when calling `download()`.
1348
1312
  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,
1313
+ within the project and cannot be reused once a run is deleted. For
1314
+ a short descriptive name, use the `name` field,
1352
1315
  or for saving hyperparameters to compare across runs, use `config`.
1353
1316
  name: A short display name for this run, which appears in the UI to help
1354
1317
  you identify it. By default, we generate a random two-word name
@@ -1389,54 +1352,56 @@ def init( # noqa: C901
1389
1352
  multiple jobs that train and evaluate a model on different test sets.
1390
1353
  Grouping allows you to manage related runs collectively in the UI,
1391
1354
  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
1355
  job_type: Specify the type of run, especially helpful when organizing runs
1395
1356
  within a group as part of a larger experiment. For example, in a group,
1396
1357
  you might label runs with job types such as "train" and "eval".
1397
1358
  Defining job types enables you to easily filter and group similar runs
1398
1359
  in the UI, facilitating direct comparisons.
1399
1360
  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.
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.
1407
1374
  force: Determines if a W&B login is required to run the script. If `True`,
1408
1375
  the user must be logged in to W&B; otherwise, the script will not
1409
1376
  proceed. If `False` (default), the script can proceed without a login,
1410
1377
  switching to offline mode if the user is not logged in.
1411
1378
  anonymous: Specifies the level of control over anonymous data logging.
1412
1379
  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.
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.
1421
1388
  reinit: Shorthand for the "reinit" setting. Determines the behavior of
1422
1389
  `wandb.init()` when a run is active.
1423
1390
  resume: Controls the behavior when resuming a run with the specified `id`.
1424
1391
  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
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
1437
1404
  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
1405
  resume_from: Specifies a moment in a previous run to resume a run from,
1441
1406
  using the format `{run_id}?_step={step}`. This allows users to truncate
1442
1407
  the history logged to a run at an intermediate step and resume logging
@@ -1445,7 +1410,7 @@ def init( # noqa: C901
1445
1410
  take precedence.
1446
1411
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1447
1412
  one of them can be used at a time.
1448
- 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.
1449
1414
  fork_from: Specifies a point in a previous run from which to fork a new
1450
1415
  run, using the format `{id}?_step={step}`. This creates a new run that
1451
1416
  resumes logging from the specified step in the target run’s history.
@@ -1454,35 +1419,45 @@ def init( # noqa: C901
1454
1419
  `fork_from` argument, an error will be raised if they are the same.
1455
1420
  `resume`, `resume_from` and `fork_from` cannot be used together, only
1456
1421
  one of them can be used at a time.
1457
- 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.
1458
1423
  save_code: Enables saving the main script or notebook to W&B, aiding in
1459
1424
  experiment reproducibility and allowing code comparisons across runs in
1460
1425
  the UI. By default, this is disabled, but you can change the default to
1461
- enable on your [settings page](https://wandb.ai/settings).
1426
+ enable on your settings page.
1462
1427
  tensorboard: Deprecated. Use `sync_tensorboard` instead.
1463
1428
  sync_tensorboard: Enables automatic syncing of W&B logs from TensorBoard
1464
1429
  or TensorBoardX, saving relevant event files for viewing in the W&B UI.
1465
1430
  saving relevant event files for viewing in the W&B UI. (Default: `False`)
1466
1431
  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).
1432
+ using OpenAI Gym.
1469
1433
  settings: Specifies a dictionary or `wandb.Settings` object with advanced
1470
1434
  settings for the run.
1471
1435
 
1472
1436
  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.
1437
+ A `Run` object.
1477
1438
 
1478
1439
  Raises:
1479
1440
  Error: If some unknown or internal error happened during the run
1480
1441
  initialization.
1481
1442
  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.
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
+ ```
1486
1461
  """
1487
1462
  wandb._assert_is_user_process() # type: ignore
1488
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":