wandb 0.19.1__py3-none-any.whl → 0.19.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +3 -5
  3. wandb/agents/pyagent.py +1 -1
  4. wandb/apis/importers/wandb.py +1 -1
  5. wandb/apis/public/files.py +1 -1
  6. wandb/apis/public/jobs.py +1 -1
  7. wandb/apis/public/runs.py +2 -7
  8. wandb/apis/reports/v1/__init__.py +1 -1
  9. wandb/apis/reports/v2/__init__.py +1 -1
  10. wandb/apis/workspaces/__init__.py +1 -1
  11. wandb/bin/gpu_stats +0 -0
  12. wandb/cli/beta.py +7 -4
  13. wandb/cli/cli.py +5 -7
  14. wandb/docker/__init__.py +4 -4
  15. wandb/integration/fastai/__init__.py +4 -6
  16. wandb/integration/keras/keras.py +5 -3
  17. wandb/integration/metaflow/metaflow.py +7 -7
  18. wandb/integration/prodigy/prodigy.py +3 -11
  19. wandb/integration/sagemaker/__init__.py +5 -3
  20. wandb/integration/sagemaker/config.py +17 -8
  21. wandb/integration/sagemaker/files.py +0 -1
  22. wandb/integration/sagemaker/resources.py +47 -18
  23. wandb/integration/torch/wandb_torch.py +1 -1
  24. wandb/proto/v3/wandb_internal_pb2.py +273 -235
  25. wandb/proto/v4/wandb_internal_pb2.py +222 -214
  26. wandb/proto/v5/wandb_internal_pb2.py +222 -214
  27. wandb/sdk/artifacts/artifact.py +3 -9
  28. wandb/sdk/backend/backend.py +1 -1
  29. wandb/sdk/data_types/base_types/wb_value.py +1 -1
  30. wandb/sdk/data_types/graph.py +2 -2
  31. wandb/sdk/data_types/saved_model.py +1 -1
  32. wandb/sdk/data_types/video.py +1 -1
  33. wandb/sdk/interface/interface.py +25 -25
  34. wandb/sdk/interface/interface_shared.py +21 -5
  35. wandb/sdk/internal/handler.py +19 -1
  36. wandb/sdk/internal/internal.py +1 -1
  37. wandb/sdk/internal/internal_api.py +4 -5
  38. wandb/sdk/internal/sample.py +2 -2
  39. wandb/sdk/internal/sender.py +1 -2
  40. wandb/sdk/internal/settings_static.py +3 -1
  41. wandb/sdk/internal/system/assets/disk.py +4 -4
  42. wandb/sdk/internal/system/assets/gpu.py +1 -1
  43. wandb/sdk/internal/system/assets/memory.py +1 -1
  44. wandb/sdk/internal/system/system_info.py +1 -1
  45. wandb/sdk/internal/system/system_monitor.py +3 -1
  46. wandb/sdk/internal/tb_watcher.py +1 -1
  47. wandb/sdk/launch/_project_spec.py +3 -3
  48. wandb/sdk/launch/builder/abstract.py +1 -1
  49. wandb/sdk/lib/apikey.py +2 -3
  50. wandb/sdk/lib/fsm.py +1 -1
  51. wandb/sdk/lib/gitlib.py +1 -1
  52. wandb/sdk/lib/gql_request.py +1 -1
  53. wandb/sdk/lib/interrupt.py +37 -0
  54. wandb/sdk/lib/lazyloader.py +1 -1
  55. wandb/sdk/lib/service_connection.py +1 -1
  56. wandb/sdk/lib/telemetry.py +1 -1
  57. wandb/sdk/service/_startup_debug.py +1 -1
  58. wandb/sdk/service/server_sock.py +3 -2
  59. wandb/sdk/service/service.py +1 -1
  60. wandb/sdk/service/streams.py +19 -17
  61. wandb/sdk/verify/verify.py +13 -13
  62. wandb/sdk/wandb_init.py +95 -104
  63. wandb/sdk/wandb_login.py +1 -1
  64. wandb/sdk/wandb_metadata.py +547 -0
  65. wandb/sdk/wandb_run.py +127 -35
  66. wandb/sdk/wandb_settings.py +5 -36
  67. wandb/sdk/wandb_setup.py +83 -82
  68. wandb/sdk/wandb_sweep.py +2 -2
  69. wandb/sdk/wandb_sync.py +15 -18
  70. wandb/sync/sync.py +10 -10
  71. wandb/util.py +11 -3
  72. wandb/wandb_agent.py +11 -16
  73. wandb/wandb_controller.py +7 -7
  74. {wandb-0.19.1.dist-info → wandb-0.19.2.dist-info}/METADATA +5 -3
  75. {wandb-0.19.1.dist-info → wandb-0.19.2.dist-info}/RECORD +78 -76
  76. {wandb-0.19.1.dist-info → wandb-0.19.2.dist-info}/WHEEL +1 -1
  77. {wandb-0.19.1.dist-info → wandb-0.19.2.dist-info}/entry_points.txt +0 -0
  78. {wandb-0.19.1.dist-info → wandb-0.19.2.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_sync.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import pathlib
2
2
  from typing import TYPE_CHECKING, Optional
3
3
 
4
+ from wandb import util
4
5
  from wandb.errors.term import termerror, termlog
5
6
 
6
7
  from . import wandb_setup
@@ -21,26 +22,31 @@ def _sync(
21
22
  append: Optional[bool] = None,
22
23
  skip_console: Optional[bool] = None,
23
24
  ) -> "wandb_internal_pb2.SyncResponse":
24
- p = pathlib.Path(path)
25
-
26
25
  wl = wandb_setup.setup()
27
26
  assert wl is not None
28
27
 
29
28
  stream_id = generate_id()
30
29
 
31
30
  settings = wl.settings.to_proto()
31
+ p = pathlib.Path(path)
32
+
32
33
  # update sync_file setting to point to the passed path
33
34
  settings.sync_file.value = str(p.absolute())
34
35
  settings.sync_dir.value = str(p.parent.absolute())
35
36
  settings.files_dir.value = str(p.parent.absolute() / "files")
36
- settings._sync.value = True
37
- settings.run_id.value = stream_id # TODO: remove this
37
+ settings.x_sync.value = True
38
+ if run_id:
39
+ settings.run_id.value = run_id
40
+ if entity:
41
+ settings.entity.value = entity
42
+ if project:
43
+ settings.project.value = project
44
+ if skip_console:
45
+ settings.console.value = "off"
38
46
  if append:
39
47
  settings.resume.value = "allow"
40
48
 
41
- service = wl.service
42
- assert service
43
-
49
+ service = wl.ensure_service()
44
50
  service.inform_init(settings=settings, run_id=stream_id)
45
51
 
46
52
  mailbox = Mailbox()
@@ -55,21 +61,12 @@ def _sync(
55
61
  backend.interface._stream_id = stream_id # type: ignore
56
62
 
57
63
  mailbox.enable_keepalive()
58
-
59
- # TODO: let's add extra sync messages here so we get the url in the beginning
60
- handle = backend.interface.deliver_sync(
61
- start_offset=0,
62
- final_offset=-1,
63
- entity=entity,
64
- project=project,
65
- run_id=run_id,
66
- skip_output_raw=skip_console,
67
- )
64
+ handle = backend.interface.deliver_finish_sync()
68
65
  result = handle.wait(timeout=-1)
69
66
  assert result and result.response
70
67
  response = result.response.sync_response
71
68
  if response.url:
72
- termlog(f"Synced {p} to {response.url}")
69
+ termlog(f"Synced {p} to {util.app_url(response.url)}")
73
70
  # create a .synced file in the directory if mark_synced is true
74
71
  if mark_synced:
75
72
  with open(f"{p}.synced", "w"):
wandb/sync/sync.py CHANGED
@@ -81,9 +81,9 @@ class SyncThread(threading.Thread):
81
81
  record_type = pb.WhichOneof("record_type")
82
82
  if self._view:
83
83
  if self._verbose:
84
- print("Record:", pb)
84
+ print("Record:", pb) # noqa: T201
85
85
  else:
86
- print("Record:", record_type)
86
+ print("Record:", record_type) # noqa: T201
87
87
  return pb, exit_pb, True
88
88
  if record_type == "run":
89
89
  if self._run_id:
@@ -137,7 +137,7 @@ class SyncThread(threading.Thread):
137
137
  if tb_event_files > 0 and sync_item.endswith(WANDB_SUFFIX):
138
138
  wandb.termwarn("Found .wandb file, not streaming tensorboard metrics.")
139
139
  else:
140
- print(f"Found {tb_event_files} tfevent files in {tb_root}")
140
+ print(f"Found {tb_event_files} tfevent files in {tb_root}") # noqa: T201
141
141
  if len(tb_logdirs) > 3:
142
142
  wandb.termwarn(
143
143
  f"Found {len(tb_logdirs)} directories containing tfevent files. "
@@ -163,7 +163,7 @@ class SyncThread(threading.Thread):
163
163
  url_quote(proto_run.project),
164
164
  url_quote(proto_run.run_id),
165
165
  )
166
- print("Syncing: {} ...".format(url))
166
+ print("Syncing: {} ...".format(url)) # noqa: T201
167
167
  sys.stdout.flush()
168
168
  # using a handler here automatically handles the step
169
169
  # logic, adds summaries to the run, and handles different
@@ -245,7 +245,7 @@ class SyncThread(threading.Thread):
245
245
 
246
246
  def run(self):
247
247
  if self._log_path is not None:
248
- print(f"Find logs at: {self._log_path}")
248
+ print(f"Find logs at: {self._log_path}") # noqa: T201
249
249
  for sync_item in self._sync_list:
250
250
  tb_event_files, tb_logdirs, tb_root = self._find_tfevent_files(sync_item)
251
251
  if os.path.isdir(sync_item):
@@ -254,7 +254,7 @@ class SyncThread(threading.Thread):
254
254
  if tb_root is None and (
255
255
  check_and_warn_old(files) or len(filtered_files) != 1
256
256
  ):
257
- print(f"Skipping directory: {sync_item}")
257
+ print(f"Skipping directory: {sync_item}") # noqa: T201
258
258
  continue
259
259
  if len(filtered_files) > 0:
260
260
  sync_item = os.path.join(sync_item, filtered_files[0])
@@ -265,7 +265,7 @@ class SyncThread(threading.Thread):
265
265
  root_dir = self._tmp_dir.name if sync_tb else os.path.dirname(sync_item)
266
266
 
267
267
  # When appending we are allowing a possible resume, ie the run
268
- # doesnt have to exist already
268
+ # does not have to exist already
269
269
  resume = "allow" if self._append else None
270
270
 
271
271
  sm = sender.SendManager.setup(root_dir, resume=resume)
@@ -277,7 +277,7 @@ class SyncThread(threading.Thread):
277
277
  try:
278
278
  ds.open_for_scan(sync_item)
279
279
  except AssertionError as e:
280
- print(f".wandb file is empty ({e}), skipping: {sync_item}")
280
+ print(f".wandb file is empty ({e}), skipping: {sync_item}") # noqa: T201
281
281
  continue
282
282
 
283
283
  # save exit for final send
@@ -311,7 +311,7 @@ class SyncThread(threading.Thread):
311
311
  url_quote(r.project),
312
312
  url_quote(r.run_id),
313
313
  )
314
- print("Syncing: {} ... ".format(url), end="")
314
+ print("Syncing: {} ... ".format(url), end="") # noqa: T201
315
315
  sys.stdout.flush()
316
316
  shown = True
317
317
  sm.finish()
@@ -320,7 +320,7 @@ class SyncThread(threading.Thread):
320
320
  synced_file = f"{sync_item}{SYNCED_SUFFIX}"
321
321
  with open(synced_file, "w"):
322
322
  pass
323
- print("done.")
323
+ print("done.") # noqa: T201
324
324
 
325
325
 
326
326
  class SyncManager:
wandb/util.py CHANGED
@@ -1717,9 +1717,17 @@ def _get_max_cli_version() -> Union[str, None]:
1717
1717
 
1718
1718
 
1719
1719
  def _is_offline() -> bool:
1720
- return ( # type: ignore[no-any-return]
1721
- wandb.run is not None and wandb.run.settings._offline
1722
- ) or wandb.setup().settings._offline # type: ignore
1720
+ """Returns true if wandb is configured to be offline.
1721
+
1722
+ If there is an active run, returns whether the run is offline.
1723
+ Otherwise, returns the default mode, which is affected by explicit settings
1724
+ passed to `wandb.setup()`, environment variables, and W&B configuration
1725
+ files.
1726
+ """
1727
+ if wandb.run:
1728
+ return wandb.run.settings._offline
1729
+ else:
1730
+ return wandb.setup().settings._offline
1723
1731
 
1724
1732
 
1725
1733
  def ensure_text(
wandb/wandb_agent.py CHANGED
@@ -62,10 +62,10 @@ class AgentProcess:
62
62
  os.environ[k] = v
63
63
 
64
64
  # call user function
65
- print("wandb: Agent Started Run:", run_id)
65
+ wandb.termlog(f"Agent Started Run: {run_id}")
66
66
  if function:
67
67
  function()
68
- print("wandb: Agent Finished Run:", run_id, "\n")
68
+ wandb.termlog(f"Agent Finished Run: {run_id}\n")
69
69
 
70
70
  # complete the run
71
71
  run = wandb.run
@@ -92,7 +92,7 @@ class AgentProcess:
92
92
 
93
93
  def wait(self):
94
94
  if self._popen:
95
- # if on windows, wait() will block and we wont be able to interrupt
95
+ # if on windows, wait() will block and we won't be able to interrupt
96
96
  if platform.system() == "Windows":
97
97
  try:
98
98
  while True:
@@ -353,15 +353,10 @@ class Agent:
353
353
  )
354
354
  )
355
355
  if self._in_jupyter:
356
- print(
357
- "wandb: Agent Starting Run: {} with config:\n".format(
358
- command.get("run_id")
359
- )
356
+ wandb.termlog(
357
+ f"Agent Starting Run: {command.get('run_id')} with config:\n"
360
358
  + "\n".join(
361
- [
362
- "\t{}: {}".format(k, v["value"])
363
- for k, v in command["args"].items()
364
- ]
359
+ [f"\t{k}: {v['value']}" for k, v in command["args"].items()]
365
360
  )
366
361
  )
367
362
 
@@ -397,7 +392,7 @@ class Agent:
397
392
 
398
393
  if self._function:
399
394
  # make sure that each run regenerates setup singleton
400
- wandb_sdk.wandb_setup._setup(_reset=True)
395
+ wandb.teardown()
401
396
  proc = AgentProcess(
402
397
  function=self._function,
403
398
  env=env,
@@ -477,12 +472,12 @@ class AgentApi:
477
472
  command["resp_queue"] = resp_queue
478
473
  self._queue.put(command)
479
474
  result = resp_queue.get()
480
- print("result:", result)
475
+ print("result:", result) # noqa: T201
481
476
  if "exception" in result:
482
- print("Exception occurred while running command")
477
+ print("Exception occurred while running command") # noqa: T201
483
478
  for line in result["traceback"]:
484
- print(line.strip())
485
- print(result["exception"])
479
+ print(line.strip()) # noqa: T201
480
+ print(result["exception"]) # noqa: T201
486
481
  return result
487
482
 
488
483
 
wandb/wandb_controller.py CHANGED
@@ -353,19 +353,19 @@ class _WandbController:
353
353
  self._logged += 1
354
354
 
355
355
  def _error(self, s: str) -> None:
356
- print("ERROR:", s)
356
+ print("ERROR:", s) # noqa: T201
357
357
  self._log()
358
358
 
359
359
  def _warn(self, s: str) -> None:
360
- print("WARN:", s)
360
+ print("WARN:", s) # noqa: T201
361
361
  self._log()
362
362
 
363
363
  def _info(self, s: str) -> None:
364
- print("INFO:", s)
364
+ print("INFO:", s) # noqa: T201
365
365
  self._log()
366
366
 
367
367
  def _debug(self, s: str) -> None:
368
- print("DEBUG:", s)
368
+ print("DEBUG:", s) # noqa: T201
369
369
  self._log()
370
370
 
371
371
  def _configure_check(self) -> None:
@@ -396,10 +396,10 @@ class _WandbController:
396
396
  sweep_id, warnings = self._api.upsert_sweep(self._create)
397
397
  handle_sweep_config_violations(warnings)
398
398
 
399
- print("Create sweep with ID:", sweep_id)
399
+ print("Create sweep with ID:", sweep_id) # noqa: T201
400
400
  sweep_url = wandb_sweep._get_sweep_url(self._api, sweep_id)
401
401
  if sweep_url:
402
- print("Sweep URL:", sweep_url)
402
+ print("Sweep URL:", sweep_url) # noqa: T201
403
403
  self._sweep_id = sweep_id
404
404
  self._defer_sweep_creation = False
405
405
  return sweep_id
@@ -636,7 +636,7 @@ class _WandbController:
636
636
  def print_status(self) -> None:
637
637
  status = _sweep_status(self._sweep_obj, self._sweep_config, self._sweep_runs)
638
638
  if self._laststatus != status or self._logged:
639
- print(status)
639
+ print(status) # noqa: T201
640
640
  self._laststatus = status
641
641
  self._logged = 0
642
642
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: wandb
3
- Version: 0.19.1
3
+ Version: 0.19.2
4
4
  Summary: A CLI and library for interacting with the Weights & Biases API.
5
5
  Project-URL: Source, https://github.com/wandb/wandb
6
6
  Project-URL: Bug Reports, https://github.com/wandb/wandb/issues
@@ -27,6 +27,7 @@ License: MIT License
27
27
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
28
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
29
  SOFTWARE.
30
+ License-File: LICENSE
30
31
  Classifier: Development Status :: 5 - Production/Stable
31
32
  Classifier: Intended Audience :: Developers
32
33
  Classifier: Intended Audience :: Science/Research
@@ -65,6 +66,7 @@ Requires-Dist: setuptools
65
66
  Requires-Dist: typing-extensions<5,>=4.4; python_version < '3.12'
66
67
  Provides-Extra: aws
67
68
  Requires-Dist: boto3; extra == 'aws'
69
+ Requires-Dist: botocore>=1.5.76; extra == 'aws'
68
70
  Provides-Extra: azure
69
71
  Requires-Dist: azure-identity; extra == 'azure'
70
72
  Requires-Dist: azure-storage-blob; extra == 'azure'
@@ -87,7 +89,7 @@ Requires-Dist: azure-containerregistry; extra == 'launch'
87
89
  Requires-Dist: azure-identity; extra == 'launch'
88
90
  Requires-Dist: azure-storage-blob; extra == 'launch'
89
91
  Requires-Dist: boto3; extra == 'launch'
90
- Requires-Dist: botocore; extra == 'launch'
92
+ Requires-Dist: botocore>=1.5.76; extra == 'launch'
91
93
  Requires-Dist: chardet; extra == 'launch'
92
94
  Requires-Dist: google-auth; extra == 'launch'
93
95
  Requires-Dist: google-cloud-aiplatform; extra == 'launch'