wandb 0.19.0rc1__py3-none-macosx_10_13_x86_64.whl → 0.19.1rc1__py3-none-macosx_10_13_x86_64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +211 -209
  3. wandb/apis/attrs.py +15 -4
  4. wandb/apis/public/api.py +8 -4
  5. wandb/apis/public/files.py +65 -12
  6. wandb/apis/public/runs.py +52 -7
  7. wandb/apis/public/sweeps.py +1 -1
  8. wandb/bin/gpu_stats +0 -0
  9. wandb/bin/wandb-core +0 -0
  10. wandb/cli/cli.py +2 -1
  11. wandb/env.py +1 -1
  12. wandb/errors/term.py +60 -1
  13. wandb/integration/keras/callbacks/tables_builder.py +3 -1
  14. wandb/integration/kfp/kfp_patch.py +25 -15
  15. wandb/integration/lightning/fabric/logger.py +3 -1
  16. wandb/integration/tensorboard/monkeypatch.py +3 -2
  17. wandb/jupyter.py +4 -5
  18. wandb/plot/bar.py +5 -6
  19. wandb/plot/histogram.py +1 -1
  20. wandb/plot/line_series.py +3 -3
  21. wandb/plot/pr_curve.py +7 -3
  22. wandb/plot/scatter.py +2 -1
  23. wandb/proto/v3/wandb_settings_pb2.py +25 -15
  24. wandb/proto/v4/wandb_settings_pb2.py +17 -15
  25. wandb/proto/v5/wandb_settings_pb2.py +17 -15
  26. wandb/sdk/artifacts/_validators.py +1 -3
  27. wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
  28. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +12 -2
  29. wandb/sdk/data_types/helper_types/image_mask.py +8 -2
  30. wandb/sdk/data_types/histogram.py +3 -3
  31. wandb/sdk/data_types/image.py +3 -1
  32. wandb/sdk/interface/interface.py +34 -5
  33. wandb/sdk/interface/interface_sock.py +2 -2
  34. wandb/sdk/internal/file_stream.py +4 -1
  35. wandb/sdk/internal/sender.py +4 -1
  36. wandb/sdk/internal/settings_static.py +17 -4
  37. wandb/sdk/launch/utils.py +1 -0
  38. wandb/sdk/lib/ipython.py +5 -27
  39. wandb/sdk/lib/printer.py +33 -20
  40. wandb/sdk/lib/sparkline.py +1 -2
  41. wandb/sdk/wandb_config.py +2 -2
  42. wandb/sdk/wandb_init.py +236 -243
  43. wandb/sdk/wandb_run.py +172 -231
  44. wandb/sdk/wandb_settings.py +103 -14
  45. {wandb-0.19.0rc1.dist-info → wandb-0.19.1rc1.dist-info}/METADATA +1 -1
  46. {wandb-0.19.0rc1.dist-info → wandb-0.19.1rc1.dist-info}/RECORD +49 -49
  47. {wandb-0.19.0rc1.dist-info → wandb-0.19.1rc1.dist-info}/WHEEL +0 -0
  48. {wandb-0.19.0rc1.dist-info → wandb-0.19.1rc1.dist-info}/entry_points.txt +0 -0
  49. {wandb-0.19.0rc1.dist-info → wandb-0.19.1rc1.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py CHANGED
@@ -10,7 +10,7 @@ For reference documentation, see https://docs.wandb.com/ref/python.
10
10
  """
11
11
  from __future__ import annotations
12
12
 
13
- __version__ = "0.19.0rc1"
13
+ __version__ = "0.19.1rc1"
14
14
 
15
15
 
16
16
  from wandb.errors import Error
wandb/__init__.pyi CHANGED
@@ -103,7 +103,7 @@ if TYPE_CHECKING:
103
103
  import wandb
104
104
  from wandb.plot import CustomChart
105
105
 
106
- __version__: str = "0.19.0rc1"
106
+ __version__: str = "0.19.1rc1"
107
107
 
108
108
  run: Run | None
109
109
  config: wandb_config.Config
@@ -140,13 +140,11 @@ def setup(
140
140
 
141
141
  import wandb
142
142
 
143
-
144
143
  def run_experiment(params):
145
144
  with wandb.init(config=params):
146
145
  # Run experiment
147
146
  pass
148
147
 
149
-
150
148
  if __name__ == "__main__":
151
149
  # Start backend and set global config
152
150
  wandb.setup(settings={"project": "my_project"})
@@ -188,237 +186,239 @@ def teardown(exit_code: int | None = None) -> None:
188
186
  ...
189
187
 
190
188
  def init(
191
- job_type: str | None = None,
192
- dir: StrPath | None = None,
193
- config: dict | str | None = None,
194
- project: str | None = None,
195
189
  entity: str | None = None,
196
- reinit: bool | None = None,
197
- tags: Sequence[str] | None = None,
198
- group: str | None = None,
190
+ project: str | None = None,
191
+ dir: StrPath | None = None,
192
+ id: str | None = None,
199
193
  name: str | None = None,
200
194
  notes: str | None = None,
195
+ tags: Sequence[str] | None = None,
196
+ config: dict[str, Any] | str | None = None,
201
197
  config_exclude_keys: list[str] | None = None,
202
198
  config_include_keys: list[str] | None = None,
203
- anonymous: str | None = None,
204
- mode: str | None = None,
205
199
  allow_val_change: bool | None = None,
206
- resume: bool | str | None = None,
200
+ group: str | None = None,
201
+ job_type: str | None = None,
202
+ mode: Literal["online", "offline", "disabled"] | None = None,
207
203
  force: bool | None = None,
208
- tensorboard: bool | None = None, # alias for sync_tensorboard
204
+ anonymous: Literal["never", "allow", "must"] | None = None,
205
+ reinit: bool | None = None,
206
+ resume: bool | Literal["allow", "never", "must", "auto"] | None = None,
207
+ resume_from: str | None = None,
208
+ fork_from: str | None = None,
209
+ save_code: bool | None = None,
210
+ tensorboard: bool | None = None,
209
211
  sync_tensorboard: bool | None = None,
210
212
  monitor_gym: bool | None = None,
211
- save_code: bool | None = None,
212
- id: str | None = None,
213
- fork_from: str | None = None,
214
- resume_from: str | None = None,
215
213
  settings: Settings | dict[str, Any] | None = None,
216
214
  ) -> Run:
217
215
  r"""Start a new run to track and log to W&B.
218
216
 
219
- In an ML training pipeline, you could add `wandb.init()`
220
- to the beginning of your training script as well as your evaluation
221
- script, and each piece would be tracked as a run in W&B.
217
+ In an ML training pipeline, you could add `wandb.init()` to the beginning of
218
+ your training script as well as your evaluation script, and each piece would
219
+ be tracked as a run in W&B.
222
220
 
223
221
  `wandb.init()` spawns a new background process to log data to a run, and it
224
- also syncs data to wandb.ai by default, so you can see live visualizations.
225
-
226
- Call `wandb.init()` to start a run before logging data with `wandb.log()`:
227
- <!--yeadoc-test:init-method-log-->
228
- ```python
229
- import wandb
222
+ also syncs data to https://wandb.ai by default, so you can see your results
223
+ in real-time.
230
224
 
231
- wandb.init()
232
- # ... calculate metrics, generate media
233
- wandb.log({"accuracy": 0.9})
234
- ```
225
+ Call `wandb.init()` to start a run before logging data with `wandb.log()`.
226
+ When you're done logging data, call `wandb.finish()` to end the run. If you
227
+ don't call `wandb.finish()`, the run will end when your script exits.
235
228
 
236
- `wandb.init()` returns a run object, and you can also access the run object
237
- via `wandb.run`:
238
- <!--yeadoc-test:init-and-assert-global-->
239
- ```python
240
- import wandb
229
+ For more on using `wandb.init()`, including detailed examples, check out our
230
+ [guide and FAQs](https://docs.wandb.ai/guides/track/launch).
241
231
 
242
- run = wandb.init()
232
+ Examples:
233
+ ### Explicitly set the entity and project and choose a name for the run:
243
234
 
244
- assert run is wandb.run
245
- ```
235
+ ```python
236
+ import wandb
246
237
 
247
- At the end of your script, we will automatically call `wandb.finish` to
248
- finalize and cleanup the run. However, if you call `wandb.init` from a
249
- child process, you must explicitly call `wandb.finish` at the end of the
250
- child process.
238
+ run = wandb.init(
239
+ entity="geoff",
240
+ project="capsules",
241
+ name="experiment-2021-10-31",
242
+ )
251
243
 
252
- For more on using `wandb.init()`, including detailed examples, check out our
253
- [guide and FAQs](https://docs.wandb.ai/guides/track/launch).
244
+ # ... your training code here ...
254
245
 
255
- Args:
256
- project: (str, optional) The name of the project where you're sending
257
- the new run. If the project is not specified, we will try to infer
258
- the project name from git root or the current program file. If we
259
- can't infer the project name, we will default to `"uncategorized"`.
260
- entity: (str, optional) An entity is a username or team name where
261
- you're sending runs. This entity must exist before you can send runs
262
- there, so make sure to create your account or team in the UI before
263
- starting to log runs.
264
- If you don't specify an entity, the run will be sent to your default
265
- entity. Change your default entity
266
- in [your settings](https://wandb.ai/settings) under "default location
267
- to create new projects".
268
- config: (dict, argparse, absl.flags, str, optional)
269
- This sets `wandb.config`, a dictionary-like object for saving inputs
270
- to your job, like hyperparameters for a model or settings for a data
271
- preprocessing job. The config will show up in a table in the UI that
272
- you can use to group, filter, and sort runs. Keys should not contain
273
- `.` in their names, and values should be under 10 MB.
274
- If dict, argparse or absl.flags: will load the key value pairs into
275
- the `wandb.config` object.
276
- If str: will look for a yaml file by that name, and load config from
277
- that file into the `wandb.config` object.
278
- save_code: (bool, optional) Turn this on to save the main script or
279
- notebook to W&B. This is valuable for improving experiment
280
- reproducibility and to diff code across experiments in the UI. By
281
- default this is off, but you can flip the default behavior to on
282
- in [your settings page](https://wandb.ai/settings).
283
- group: (str, optional) Specify a group to organize individual runs into
284
- a larger experiment. For example, you might be doing cross
285
- validation, or you might have multiple jobs that train and evaluate
286
- a model against different test sets. Group gives you a way to
287
- organize runs together into a larger whole, and you can toggle this
288
- on and off in the UI. For more details, see our
289
- [guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
290
- job_type: (str, optional) Specify the type of run, which is useful when
291
- you're grouping runs together into larger experiments using group.
292
- For example, you might have multiple jobs in a group, with job types
293
- like train and eval. Setting this makes it easy to filter and group
294
- similar runs together in the UI so you can compare apples to apples.
295
- tags: (list, optional) A list of strings, which will populate the list
296
- of tags on this run in the UI. Tags are useful for organizing runs
297
- together, or applying temporary labels like "baseline" or
298
- "production". It's easy to add and remove tags in the UI, or filter
299
- down to just runs with a specific tag.
300
- If you are resuming a run, its tags will be overwritten by the tags
301
- you pass to `wandb.init()`. If you want to add tags to a resumed run
302
- without overwriting its existing tags, use `run.tags += ["new_tag"]`
303
- after `wandb.init()`.
304
- name: (str, optional) A short display name for this run, which is how
305
- you'll identify this run in the UI. By default, we generate a random
306
- two-word name that lets you easily cross-reference runs from the
307
- table to charts. Keeping these run names short makes the chart
308
- legends and tables easier to read. If you're looking for a place to
309
- save your hyperparameters, we recommend saving those in config.
310
- notes: (str, optional) A longer description of the run, like a `-m` commit
311
- message in git. This helps you remember what you were doing when you
312
- ran this run.
313
- dir: (str or pathlib.Path, optional) An absolute path to a directory where
314
- metadata will be stored. When you call `download()` on an artifact,
315
- this is the directory where downloaded files will be saved. By default,
316
- this is the `./wandb` directory.
317
- resume: (bool, str, optional) Sets the resuming behavior. Options:
318
- `"allow"`, `"must"`, `"never"`, `"auto"` or `None`. Defaults to `None`.
319
- Cases:
320
- - `None` (default): If the new run has the same ID as a previous run,
321
- this run overwrites that data.
322
- - `"auto"` (or `True`): if the previous run on this machine crashed,
323
- automatically resume it. Otherwise, start a new run.
324
- - `"allow"`: if id is set with `init(id="UNIQUE_ID")` or
325
- `WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
326
- wandb will automatically resume the run with that id. Otherwise,
327
- wandb will start a new run.
328
- - `"never"`: if id is set with `init(id="UNIQUE_ID")` or
329
- `WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
330
- wandb will crash.
331
- - `"must"`: if id is set with `init(id="UNIQUE_ID")` or
332
- `WANDB_RUN_ID="UNIQUE_ID"` and it is identical to a previous run,
333
- wandb will automatically resume the run with the id. Otherwise,
334
- wandb will crash.
335
- See [our guide to resuming runs](https://docs.wandb.com/guides/runs/resuming)
336
- for more.
337
- reinit: (bool, optional) Allow multiple `wandb.init()` calls in the same
338
- process. (default: `False`)
339
- config_exclude_keys: (list, optional) string keys to exclude from
340
- `wandb.config`.
341
- config_include_keys: (list, optional) string keys to include in
342
- `wandb.config`.
343
- anonymous: (str, optional) Controls anonymous data logging. Options:
344
- - `"never"` (default): requires you to link your W&B account before
345
- tracking the run, so you don't accidentally create an anonymous
346
- run.
347
- - `"allow"`: lets a logged-in user track runs with their account, but
348
- lets someone who is running the script without a W&B account see
349
- the charts in the UI.
350
- - `"must"`: sends the run to an anonymous account instead of to a
351
- signed-up user account.
352
- mode: (str, optional) Can be `"online"`, `"offline"` or `"disabled"`. Defaults to
353
- online.
354
- allow_val_change: (bool, optional) Whether to allow config values to
355
- change after setting the keys once. By default, we throw an exception
356
- if a config value is overwritten. If you want to track something
357
- like a varying learning rate at multiple times during training, use
358
- `wandb.log()` instead. (default: `False` in scripts, `True` in Jupyter)
359
- force: (bool, optional) If `True`, this crashes the script if a user isn't
360
- logged in to W&B. If `False`, this will let the script run in offline
361
- mode if a user isn't logged in to W&B. (default: `False`)
362
- sync_tensorboard: (bool, optional) Synchronize wandb logs from tensorboard or
363
- tensorboardX and save the relevant events file. (default: `False`)
364
- tensorboard: (bool, optional) Alias for `sync_tensorboard`, deprecated.
365
- monitor_gym: (bool, optional) Automatically log videos of environment when
366
- using OpenAI Gym. (default: `False`)
367
- See [our guide to this integration](https://docs.wandb.com/guides/integrations/openai-gym).
368
- id: (str, optional) A unique ID for this run, used for resuming. It must
369
- be unique in the project, and if you delete a run you can't reuse
370
- the ID. Use the `name` field for a short descriptive name, or `config`
371
- for saving hyperparameters to compare across runs. The ID cannot
372
- contain the following special characters: `/\#?%:`.
373
- See [our guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
374
- fork_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
375
- a moment in a previous run to fork a new run from. Creates a new run that picks up
376
- logging history from the specified run at the specified moment. The target run must
377
- be in the current project. Example: `fork_from="my-run-id?_step=1234"`.
378
- resume_from: (str, optional) A string with the format `{run_id}?_step={step}` describing
379
- a moment in a previous run to resume a run from. This allows users to truncate
380
- the history logged to a run at an intermediate step and resume logging from that step.
381
- It uses run forking under the hood. The target run must be in the
382
- current project. Example: `resume_from="my-run-id?_step=1234"`.
383
- settings: (dict, wandb.Settings, optional) Settings to use for this run. (default: None)
246
+ run.finish()
247
+ ```
384
248
 
385
- Examples:
386
- ### Set where the run is logged
249
+ ### Add metadata about the run using the `config` argument:
387
250
 
388
- You can change where the run is logged, just like changing
389
- the organization, repository, and branch in git:
390
- ```python
391
- import wandb
251
+ ```python
252
+ import wandb
392
253
 
393
- user = "geoff"
394
- project = "capsules"
395
- display_name = "experiment-2021-10-31"
254
+ config = {"lr": 0.01, "batch_size": 32}
255
+ with wandb.init(config=config) as run:
256
+ run.config.update({"architecture": "resnet", "depth": 34})
396
257
 
397
- wandb.init(entity=user, project=project, name=display_name)
398
- ```
258
+ # ... your training code here ...
259
+ ```
399
260
 
400
- ### Add metadata about the run to the config
261
+ Note that you can use `wandb.init()` as a context manager to automatically
262
+ call `wandb.finish()` at the end of the block.
401
263
 
402
- Pass a dictionary-style object as the `config` keyword argument to add
403
- metadata, like hyperparameters, to your run.
404
- <!--yeadoc-test:init-set-config-->
405
- ```python
406
- import wandb
264
+ Args:
265
+ entity: The username or team name under which the runs will be logged.
266
+ The entity must already exist, so ensure you’ve created your account
267
+ or team in the UI before starting to log runs. If not specified, the
268
+ run will default your defualt entity. To change the default entity,
269
+ go to [your settings](https://wandb.ai/settings) and update the
270
+ "Default location to create new projects" under "Default team".
271
+ project: The name of the project under which this run will be logged.
272
+ If not specified, we use a heuristic to infer the project name based
273
+ on the system, such as checking the git root or the current program
274
+ file. If we can't infer the project name, the project will default to
275
+ `"uncategorized"`.
276
+ dir: An absolute path to the directory where metadata and downloaded
277
+ files will be stored. When calling `download()` on an artifact, files
278
+ will be saved to this directory. If not specified, this defaults to
279
+ the `./wandb` directory.
280
+ id: A unique identifier for this run, used for resuming. It must be unique
281
+ within the project and cannot be reused once a run is deleted. The
282
+ identifier must not contain any of the following special characters:
283
+ `/ \ # ? % :`. For a short descriptive name, use the `name` field,
284
+ or for saving hyperparameters to compare across runs, use `config`.
285
+ name: A short display name for this run, which appears in the UI to help
286
+ you identify it. By default, we generate a random two-word name
287
+ allowing easy cross-reference runs from table to charts. Keeping these
288
+ run names brief enhances readability in chart legends and tables. For
289
+ saving hyperparameters, we recommend using the `config` field.
290
+ notes: A detailed description of the run, similar to a commit message in
291
+ Git. Use this argument to capture any context or details that may
292
+ help you recall the purpose or setup of this run in the future.
293
+ tags: A list of tags to label this run in the UI. Tags are helpful for
294
+ organizing runs or adding temporary identifiers like "baseline" or
295
+ "production." You can easily add, remove tags, or filter by tags in
296
+ the UI.
297
+ If resuming a run, the tags provided here will replace any existing
298
+ tags. To add tags to a resumed run without overwriting the current
299
+ tags, use `run.tags += ["new_tag"]` after calling `run = wandb.init()`.
300
+ config: Sets `wandb.config`, a dictionary-like object for storing input
301
+ parameters to your run, such as model hyperparameters or data
302
+ preprocessing settings.
303
+ The config appears in the UI in an overview page, allowing you to
304
+ group, filter, and sort runs based on these parameters.
305
+ Keys should not contain periods (`.`), and values should be
306
+ smaller than 10 MB.
307
+ If a dictionary, `argparse.Namespace`, or `absl.flags.FLAGS` is
308
+ provided, the key-value pairs will be loaded directly into
309
+ `wandb.config`.
310
+ If a string is provided, it is interpreted as a path to a YAML file,
311
+ from which configuration values will be loaded into `wandb.config`.
312
+ config_exclude_keys: A list of specific keys to exclude from `wandb.config`.
313
+ config_include_keys: A list of specific keys to include in `wandb.config`.
314
+ allow_val_change: Controls whether config values can be modified after their
315
+ initial set. By default, an exception is raised if a config value is
316
+ overwritten. For tracking variables that change during training, such as
317
+ a learning rate, consider using `wandb.log()` instead. By default, this
318
+ is `False` in scripts and `True` in Notebook environments.
319
+ group: Specify a group name to organize individual runs as part of a larger
320
+ experiment. This is useful for cases like cross-validation or running
321
+ multiple jobs that train and evaluate a model on different test sets.
322
+ Grouping allows you to manage related runs collectively in the UI,
323
+ making it easy to toggle and review results as a unified experiment.
324
+ For more information, refer to our
325
+ [guide to grouping runs](https://docs.wandb.com/guides/runs/grouping).
326
+ job_type: Specify the type of run, especially helpful when organizing runs
327
+ within a group as part of a larger experiment. For example, in a group,
328
+ you might label runs with job types such as "train" and "eval".
329
+ Defining job types enables you to easily filter and group similar runs
330
+ in the UI, facilitating direct comparisons.
331
+ mode: Specifies how run data is managed, with the following options:
332
+ - `"online"` (default): Enables live syncing with W&B when a network
333
+ connection is available, with real-time updates to visualizations.
334
+ - `"offline"`: Suitable for air-gapped or offline environments; data
335
+ is saved locally and can be synced later. Ensure the run folder
336
+ is preserved to enable future syncing.
337
+ - `"disabled"`: Disables all W&B functionality, making the run’s methods
338
+ no-ops. Typically used in testing to bypass W&B operations.
339
+ force: Determines if a W&B login is required to run the script. If `True`,
340
+ the user must be logged in to W&B; otherwise, the script will not
341
+ proceed. If `False` (default), the script can proceed without a login,
342
+ switching to offline mode if the user is not logged in.
343
+ anonymous: Specifies the level of control over anonymous data logging.
344
+ Available options are:
345
+ - `"never"` (default): Requires you to link your W&B account before
346
+ tracking the run. This prevents unintentional creation of anonymous
347
+ runs by ensuring each run is associated with an account.
348
+ - `"allow"`: Enables a logged-in user to track runs with their account,
349
+ but also allows someone running the script without a W&B account
350
+ to view the charts and data in the UI.
351
+ - `"must"`: Forces the run to be logged to an anonymous account, even
352
+ if the user is logged in.
353
+ reinit: Determines if multiple `wandb.init()` calls can start new runs
354
+ within the same process. By default (`False`), if an active run
355
+ exists, calling `wandb.init()` returns the existing run instead of
356
+ creating a new one. When `reinit=True`, the active run is finished
357
+ before a new run is initialized. In notebook environments, runs are
358
+ reinitialized by default unless `reinit` is explicitly set to `False`.
359
+ resume: Controls the behavior when resuming a run with the specified `id`.
360
+ Available options are:
361
+ - `"allow"`: If a run with the specified `id` exists, it will resume
362
+ from the last step; otherwise, a new run will be created.
363
+ - `"never"`: If a run with the specified `id` exists, an error will
364
+ be raised. If no such run is found, a new run will be created.
365
+ - `"must"`: If a run with the specified `id` exists, it will resume
366
+ from the last step. If no run is found, an error will be raised.
367
+ - `"auto"`: Automatically resumes the previous run if it crashed on
368
+ this machine; otherwise, starts a new run.
369
+ - `True`: Deprecated. Use `"auto"` instead.
370
+ - `False`: Deprecated. Use the default behavior (leaving `resume`
371
+ unset) to always start a new run.
372
+ Note: If `resume` is set, `fork_from` and `resume_from` cannot be
373
+ used. When `resume` is unset, the system will always start a new run.
374
+ For more details, see our
375
+ [guide to resuming runs](https://docs.wandb.com/guides/runs/resuming).
376
+ resume_from: Specifies a moment in a previous run to resume a run from,
377
+ using the format `{run_id}?_step={step}`. This allows users to truncate
378
+ the history logged to a run at an intermediate step and resume logging
379
+ from that step. The target run must be in the same project.
380
+ If an `id` argument is also provided, the `resume_from` argument will
381
+ take precedence.
382
+ `resume`, `resume_from` and `fork_from` cannot be used together, only
383
+ one of them can be used at a time.
384
+ Note: This feature is in beta and may change in the future.
385
+ fork_from: Specifies a point in a previous run from which to fork a new
386
+ run, using the format `{id}?_step={step}`. This creates a new run that
387
+ resumes logging from the specified step in the target run’s history.
388
+ The target run must be part of the current project.
389
+ If an `id` argument is also provided, it must be different from the
390
+ `fork_from` argument, an error will be raised if they are the same.
391
+ `resume`, `resume_from` and `fork_from` cannot be used together, only
392
+ one of them can be used at a time.
393
+ Note: This feature is in beta and may change in the future.
394
+ save_code: Enables saving the main script or notebook to W&B, aiding in
395
+ experiment reproducibility and allowing code comparisons across runs in
396
+ the UI. By default, this is disabled, but you can change the default to
397
+ enable on your [settings page](https://wandb.ai/settings).
398
+ tensorboard: Deprecated. Use `sync_tensorboard` instead.
399
+ sync_tensorboard: Enables automatic syncing of W&B logs from TensorBoard
400
+ or TensorBoardX, saving relevant event files for viewing in the W&B UI.
401
+ saving relevant event files for viewing in the W&B UI. (Default: `False`)
402
+ monitor_gym: Enables automatic logging of videos of the environment when
403
+ using OpenAI Gym. For additional details, see our
404
+ [guide for gym integration](https://docs.wandb.com/guides/integrations/openai-gym).
405
+ settings: Specifies a dictionary or `wandb.Settings` object with advanced
406
+ settings for the run.
407
407
 
408
- config = {"lr": 3e-4, "batch_size": 32}
409
- config.update({"architecture": "resnet", "depth": 34})
410
- wandb.init(config=config)
411
- ```
408
+ Returns:
409
+ A `Run` object, which is a handle to the current run. Use this object
410
+ to perform operations like logging data, saving files, and finishing
411
+ the run. See the [Run API](https://docs.wandb.ai/ref/python/run) for
412
+ more details.
412
413
 
413
414
  Raises:
414
- Error: if some unknown or internal error happened during the run initialization.
415
- AuthenticationError: if the user failed to provide valid credentials.
416
- CommError: if there was a problem communicating with the WandB server.
417
- UsageError: if the user provided invalid arguments.
418
- KeyboardInterrupt: if user interrupts the run.
419
-
420
- Returns:
421
- A `Run` object.
415
+ Error: If some unknown or internal error happened during the run
416
+ initialization.
417
+ AuthenticationError: If the user failed to provide valid credentials.
418
+ CommError: If there was a problem communicating with the W&B server.
419
+ UsageError: If the user provided invalid arguments to the function.
420
+ KeyboardInterrupt: If the user interrupts the run initialization process.
421
+ If the user interrupts the run initialization process.
422
422
  """
423
423
  ...
424
424
 
@@ -520,12 +520,14 @@ def log(
520
520
  the following results in two sections named "train" and "validate":
521
521
 
522
522
  ```
523
- run.log({
524
- "train/accuracy": 0.9,
525
- "train/loss": 30,
526
- "validate/accuracy": 0.8,
527
- "validate/loss": 20,
528
- })
523
+ run.log(
524
+ {
525
+ "train/accuracy": 0.9,
526
+ "train/loss": 30,
527
+ "validate/accuracy": 0.8,
528
+ "validate/loss": 20,
529
+ }
530
+ )
529
531
  ```
530
532
 
531
533
  Only one level of nesting is supported; `run.log({"a/b/c": 1})`
wandb/apis/attrs.py CHANGED
@@ -1,7 +1,8 @@
1
1
  from typing import Any, MutableMapping
2
2
 
3
3
  import wandb
4
- from wandb.sdk.lib import ipython
4
+
5
+ from ..sdk.lib import ipython
5
6
 
6
7
 
7
8
  class Attrs:
@@ -14,14 +15,24 @@ class Attrs:
14
15
 
15
16
  def display(self, height=420, hidden=False) -> bool:
16
17
  """Display this object in jupyter."""
18
+ if wandb.run and wandb.run._settings.silent:
19
+ return False
20
+
21
+ if not ipython.in_jupyter():
22
+ return False
23
+
17
24
  html = self.to_html(height, hidden)
18
25
  if html is None:
19
26
  wandb.termwarn("This object does not support `.display()`")
20
27
  return False
21
- if ipython.in_jupyter():
22
- ipython.display_html(html)
28
+
29
+ try:
30
+ from IPython import display
31
+
32
+ display.display(display.HTML(html))
23
33
  return True
24
- else:
34
+
35
+ except ImportError:
25
36
  wandb.termwarn(".display() only works in jupyter environments")
26
37
  return False
27
38
 
wandb/apis/public/api.py CHANGED
@@ -912,7 +912,12 @@ class Api:
912
912
  ```
913
913
  api.runs(
914
914
  path="my_entity/my_project",
915
- filters={"$or": [{"config.experiment_name": "foo"}, {"config.experiment_name": "bar"}]}
915
+ filters={
916
+ "$or": [
917
+ {"config.experiment_name": "foo"},
918
+ {"config.experiment_name": "bar"},
919
+ ]
920
+ },
916
921
  )
917
922
  ```
918
923
 
@@ -920,15 +925,14 @@ class Api:
920
925
  ```
921
926
  api.runs(
922
927
  path="my_entity/my_project",
923
- filters={"config.experiment_name": {"$regex": "b.*"}}
928
+ filters={"config.experiment_name": {"$regex": "b.*"}},
924
929
  )
925
930
  ```
926
931
 
927
932
  Find runs in my_project where the run name matches a regex (anchors are not supported)
928
933
  ```
929
934
  api.runs(
930
- path="my_entity/my_project",
931
- filters={"display_name": {"$regex": "^foo.*"}}
935
+ path="my_entity/my_project", filters={"display_name": {"$regex": "^foo.*"}}
932
936
  )
933
937
  ```
934
938