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.
- wandb/__init__.py +16 -14
- wandb/__init__.pyi +427 -450
- wandb/agents/pyagent.py +41 -12
- wandb/analytics/sentry.py +7 -2
- wandb/apis/importers/mlflow.py +1 -1
- wandb/apis/public/__init__.py +1 -1
- wandb/apis/public/api.py +525 -360
- wandb/apis/public/artifacts.py +207 -13
- wandb/apis/public/automations.py +19 -3
- wandb/apis/public/files.py +172 -33
- wandb/apis/public/history.py +67 -15
- wandb/apis/public/integrations.py +25 -2
- wandb/apis/public/jobs.py +90 -2
- wandb/apis/public/projects.py +130 -79
- wandb/apis/public/query_generator.py +11 -1
- wandb/apis/public/registries/_utils.py +14 -16
- wandb/apis/public/registries/registries_search.py +183 -304
- wandb/apis/public/reports.py +96 -15
- wandb/apis/public/runs.py +299 -105
- wandb/apis/public/sweeps.py +222 -22
- wandb/apis/public/teams.py +41 -4
- wandb/apis/public/users.py +45 -4
- wandb/automations/_generated/delete_automation.py +1 -3
- wandb/automations/_generated/enums.py +13 -11
- wandb/beta/workflows.py +66 -30
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +127 -3
- wandb/env.py +8 -0
- wandb/errors/errors.py +4 -1
- wandb/integration/lightning/fabric/logger.py +3 -4
- wandb/integration/metaflow/__init__.py +6 -0
- wandb/integration/metaflow/data_pandas.py +74 -0
- wandb/integration/metaflow/data_pytorch.py +75 -0
- wandb/integration/metaflow/data_sklearn.py +76 -0
- wandb/integration/metaflow/errors.py +13 -0
- wandb/integration/metaflow/metaflow.py +167 -223
- wandb/integration/openai/fine_tuning.py +1 -2
- wandb/integration/weave/__init__.py +6 -0
- wandb/integration/weave/interface.py +49 -0
- wandb/integration/weave/weave.py +63 -0
- wandb/jupyter.py +5 -5
- wandb/plot/custom_chart.py +30 -7
- wandb/proto/v3/wandb_internal_pb2.py +281 -280
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_internal_pb2.py +280 -280
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_internal_pb2.py +280 -280
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v6/wandb_internal_pb2.py +280 -280
- wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +6 -0
- wandb/sdk/artifacts/_factories.py +17 -0
- wandb/sdk/artifacts/_generated/__init__.py +221 -13
- wandb/sdk/artifacts/_generated/artifact_by_id.py +17 -0
- wandb/sdk/artifacts/_generated/artifact_by_name.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_collection_membership_file_urls.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_created_by.py +47 -0
- wandb/sdk/artifacts/_generated/artifact_file_urls.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_type.py +31 -0
- wandb/sdk/artifacts/_generated/artifact_used_by.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_via_membership_by_name.py +26 -0
- wandb/sdk/artifacts/_generated/delete_artifact.py +28 -0
- wandb/sdk/artifacts/_generated/enums.py +5 -0
- wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py +38 -0
- wandb/sdk/artifacts/_generated/fetch_registries.py +32 -0
- wandb/sdk/artifacts/_generated/fragments.py +279 -41
- wandb/sdk/artifacts/_generated/link_artifact.py +6 -0
- wandb/sdk/artifacts/_generated/operations.py +654 -51
- wandb/sdk/artifacts/_generated/registry_collections.py +34 -0
- wandb/sdk/artifacts/_generated/registry_versions.py +34 -0
- wandb/sdk/artifacts/_generated/unlink_artifact.py +25 -0
- wandb/sdk/artifacts/_graphql_fragments.py +3 -86
- wandb/sdk/artifacts/_internal_artifact.py +19 -8
- wandb/sdk/artifacts/_validators.py +14 -4
- wandb/sdk/artifacts/artifact.py +512 -618
- wandb/sdk/artifacts/artifact_file_cache.py +10 -6
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +9 -10
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +5 -3
- wandb/sdk/artifacts/storage_handlers/http_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +1 -1
- wandb/sdk/data_types/audio.py +38 -10
- wandb/sdk/data_types/base_types/media.py +6 -56
- wandb/sdk/data_types/graph.py +48 -14
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
- wandb/sdk/data_types/helper_types/image_mask.py +1 -3
- wandb/sdk/data_types/histogram.py +34 -21
- wandb/sdk/data_types/html.py +35 -12
- wandb/sdk/data_types/image.py +104 -68
- wandb/sdk/data_types/molecule.py +32 -19
- wandb/sdk/data_types/object_3d.py +36 -17
- wandb/sdk/data_types/plotly.py +18 -5
- wandb/sdk/data_types/saved_model.py +4 -6
- wandb/sdk/data_types/table.py +59 -30
- wandb/sdk/data_types/video.py +53 -26
- wandb/sdk/integration_utils/auto_logging.py +2 -2
- wandb/sdk/interface/interface_queue.py +1 -4
- wandb/sdk/interface/interface_shared.py +26 -37
- wandb/sdk/interface/interface_sock.py +24 -14
- wandb/sdk/internal/internal_api.py +6 -0
- wandb/sdk/internal/job_builder.py +6 -0
- wandb/sdk/internal/settings_static.py +2 -3
- wandb/sdk/launch/agent/agent.py +8 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
- wandb/sdk/launch/create_job.py +15 -2
- wandb/sdk/launch/inputs/internal.py +3 -4
- wandb/sdk/launch/inputs/schema.py +1 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +323 -1
- wandb/sdk/launch/sweeps/scheduler.py +2 -3
- wandb/sdk/lib/asyncio_compat.py +19 -16
- wandb/sdk/lib/asyncio_manager.py +252 -0
- wandb/sdk/lib/deprecate.py +1 -7
- wandb/sdk/lib/disabled.py +1 -1
- wandb/sdk/lib/hashutil.py +27 -5
- wandb/sdk/lib/module.py +7 -13
- wandb/sdk/lib/printer.py +2 -2
- wandb/sdk/lib/printer_asyncio.py +3 -1
- wandb/sdk/lib/progress.py +0 -19
- wandb/sdk/lib/retry.py +185 -78
- wandb/sdk/lib/service/service_client.py +106 -0
- wandb/sdk/lib/service/service_connection.py +20 -26
- wandb/sdk/lib/service/service_token.py +30 -13
- wandb/sdk/mailbox/mailbox.py +13 -5
- wandb/sdk/mailbox/mailbox_handle.py +22 -13
- wandb/sdk/mailbox/response_handle.py +42 -106
- wandb/sdk/mailbox/wait_with_progress.py +7 -42
- wandb/sdk/wandb_init.py +77 -116
- wandb/sdk/wandb_login.py +19 -15
- wandb/sdk/wandb_metric.py +2 -0
- wandb/sdk/wandb_run.py +497 -469
- wandb/sdk/wandb_settings.py +145 -4
- wandb/sdk/wandb_setup.py +204 -124
- wandb/sdk/wandb_sweep.py +14 -13
- wandb/sdk/wandb_watch.py +4 -6
- wandb/sync/sync.py +10 -0
- wandb/util.py +58 -1
- wandb/wandb_run.py +1 -2
- {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/METADATA +1 -1
- {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/RECORD +145 -129
- wandb/sdk/interface/interface_relay.py +0 -38
- wandb/sdk/interface/router.py +0 -89
- wandb/sdk/interface/router_queue.py +0 -43
- wandb/sdk/interface/router_relay.py +0 -50
- wandb/sdk/interface/router_sock.py +0 -32
- wandb/sdk/lib/sock_client.py +0 -236
- wandb/vendor/pynvml/__init__.py +0 -0
- wandb/vendor/pynvml/pynvml.py +0 -4779
- {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/WHEEL +0 -0
- {wandb-0.21.0.dist-info → wandb-0.21.2.dist-info}/entry_points.txt +0 -0
- {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
|
-
|
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.
|
461
|
+
if self._wl.config:
|
479
462
|
self._split_artifacts_from_config(
|
480
|
-
self._wl.
|
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
|
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
|
-
|
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
|
1334
|
-
The entity must already exist, so ensure you
|
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
|
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.
|
1350
|
-
|
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
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
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
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
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
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
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
|
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
|
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
|
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.
|
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
|
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
|
1483
|
-
UsageError: If the user provided invalid arguments
|
1484
|
-
KeyboardInterrupt: If
|
1485
|
-
|
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
|
-
|
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:
|
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:
|
64
|
-
relogin:
|
65
|
-
host:
|
66
|
-
force:
|
67
|
-
timeout:
|
68
|
-
verify:
|
69
|
-
referrer:
|
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:
|
73
|
+
bool: If `key` is configured.
|
73
74
|
|
74
75
|
Raises:
|
75
|
-
AuthenticationError
|
76
|
-
UsageError
|
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.
|
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
|
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
|
-
|
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