wandb 0.19.7__py3-none-win_amd64.whl → 0.19.9__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. wandb/__init__.py +5 -1
  2. wandb/__init__.pyi +43 -9
  3. wandb/_pydantic/__init__.py +23 -0
  4. wandb/_pydantic/base.py +113 -0
  5. wandb/_pydantic/v1_compat.py +262 -0
  6. wandb/apis/paginator.py +82 -38
  7. wandb/apis/public/api.py +10 -64
  8. wandb/apis/public/artifacts.py +73 -17
  9. wandb/apis/public/files.py +2 -2
  10. wandb/apis/public/projects.py +3 -2
  11. wandb/apis/public/reports.py +2 -2
  12. wandb/apis/public/runs.py +19 -11
  13. wandb/bin/gpu_stats.exe +0 -0
  14. wandb/bin/wandb-core +0 -0
  15. wandb/data_types.py +1 -1
  16. wandb/filesync/dir_watcher.py +2 -1
  17. wandb/integration/metaflow/metaflow.py +19 -17
  18. wandb/integration/sacred/__init__.py +1 -1
  19. wandb/jupyter.py +18 -15
  20. wandb/proto/v3/wandb_internal_pb2.py +7 -3
  21. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  22. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  23. wandb/proto/v4/wandb_internal_pb2.py +3 -3
  24. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  25. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  26. wandb/proto/v5/wandb_internal_pb2.py +3 -3
  27. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  28. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  29. wandb/proto/wandb_deprecated.py +2 -0
  30. wandb/sdk/artifacts/_graphql_fragments.py +18 -20
  31. wandb/sdk/artifacts/_validators.py +1 -0
  32. wandb/sdk/artifacts/artifact.py +81 -46
  33. wandb/sdk/artifacts/artifact_saver.py +16 -2
  34. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +23 -2
  35. wandb/sdk/backend/backend.py +16 -5
  36. wandb/sdk/data_types/audio.py +1 -3
  37. wandb/sdk/data_types/base_types/media.py +11 -4
  38. wandb/sdk/data_types/image.py +44 -25
  39. wandb/sdk/data_types/molecule.py +1 -5
  40. wandb/sdk/data_types/object_3d.py +2 -1
  41. wandb/sdk/data_types/saved_model.py +7 -9
  42. wandb/sdk/data_types/video.py +1 -4
  43. wandb/sdk/interface/interface.py +65 -43
  44. wandb/sdk/interface/interface_queue.py +0 -7
  45. wandb/sdk/interface/interface_relay.py +6 -16
  46. wandb/sdk/interface/interface_shared.py +47 -40
  47. wandb/sdk/interface/interface_sock.py +1 -8
  48. wandb/sdk/interface/router.py +22 -54
  49. wandb/sdk/interface/router_queue.py +11 -10
  50. wandb/sdk/interface/router_relay.py +24 -12
  51. wandb/sdk/interface/router_sock.py +6 -11
  52. wandb/{apis/public → sdk/internal}/_generated/__init__.py +0 -6
  53. wandb/sdk/internal/_generated/base.py +226 -0
  54. wandb/{apis/public → sdk/internal}/_generated/server_features_query.py +3 -3
  55. wandb/{apis/public → sdk/internal}/_generated/typing_compat.py +1 -1
  56. wandb/sdk/internal/internal_api.py +138 -47
  57. wandb/sdk/internal/sender.py +5 -1
  58. wandb/sdk/internal/sender_config.py +8 -11
  59. wandb/sdk/internal/settings_static.py +24 -2
  60. wandb/sdk/lib/apikey.py +15 -16
  61. wandb/sdk/lib/console_capture.py +172 -0
  62. wandb/sdk/lib/redirect.py +102 -76
  63. wandb/sdk/lib/run_moment.py +4 -6
  64. wandb/sdk/lib/service_connection.py +37 -17
  65. wandb/sdk/lib/sock_client.py +2 -52
  66. wandb/sdk/lib/wb_logging.py +161 -0
  67. wandb/sdk/mailbox/__init__.py +3 -3
  68. wandb/sdk/mailbox/mailbox.py +31 -17
  69. wandb/sdk/mailbox/mailbox_handle.py +127 -0
  70. wandb/sdk/mailbox/{handles.py → response_handle.py} +34 -66
  71. wandb/sdk/mailbox/wait_with_progress.py +16 -15
  72. wandb/sdk/service/server_sock.py +4 -2
  73. wandb/sdk/service/streams.py +10 -5
  74. wandb/sdk/wandb_config.py +44 -43
  75. wandb/sdk/wandb_init.py +151 -92
  76. wandb/sdk/wandb_metadata.py +107 -91
  77. wandb/sdk/wandb_run.py +160 -54
  78. wandb/sdk/wandb_settings.py +410 -202
  79. wandb/sdk/wandb_setup.py +3 -1
  80. wandb/sdk/wandb_sync.py +1 -7
  81. {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/METADATA +3 -3
  82. {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/RECORD +88 -84
  83. wandb/apis/public/_generated/base.py +0 -128
  84. wandb/sdk/interface/message_future.py +0 -27
  85. wandb/sdk/interface/message_future_poll.py +0 -50
  86. /wandb/{apis/public → sdk/internal}/_generated/enums.py +0 -0
  87. /wandb/{apis/public → sdk/internal}/_generated/input_types.py +0 -0
  88. /wandb/{apis/public → sdk/internal}/_generated/operations.py +0 -0
  89. {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/WHEEL +0 -0
  90. {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/entry_points.txt +0 -0
  91. {wandb-0.19.7.dist-info → wandb-0.19.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,24 +1,26 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
4
3
  from contextlib import contextmanager
5
4
  from datetime import datetime, timezone
6
- from typing import Any, Callable
5
+
6
+ # For backward compatibility with pydantic v1
7
+ from typing import Any, Callable, Dict, List, Optional
7
8
 
8
9
  from google.protobuf.timestamp_pb2 import Timestamp
9
- from pydantic import BaseModel, ConfigDict, Field, model_validator
10
+ from pydantic import BaseModel, ConfigDict, Field
11
+ from typing_extensions import Self
10
12
 
13
+ from wandb import termwarn
14
+ from wandb._pydantic import IS_PYDANTIC_V2
11
15
  from wandb.proto import wandb_internal_pb2
12
16
 
13
- if sys.version_info >= (3, 11):
14
- from typing import Self
15
- else:
16
- from typing_extensions import Self
17
+ if IS_PYDANTIC_V2:
18
+ from pydantic import model_validator
17
19
 
18
20
 
19
21
  class DiskInfo(BaseModel, validate_assignment=True):
20
- total: int | None = None
21
- used: int | None = None
22
+ total: Optional[int] = None
23
+ used: Optional[int] = None
22
24
 
23
25
  def to_proto(self) -> wandb_internal_pb2.DiskInfo:
24
26
  return wandb_internal_pb2.DiskInfo(
@@ -32,7 +34,7 @@ class DiskInfo(BaseModel, validate_assignment=True):
32
34
 
33
35
 
34
36
  class MemoryInfo(BaseModel, validate_assignment=True):
35
- total: int | None = None
37
+ total: Optional[int] = None
36
38
 
37
39
  def to_proto(self) -> wandb_internal_pb2.MemoryInfo:
38
40
  return wandb_internal_pb2.MemoryInfo(total=self.total or 0)
@@ -43,8 +45,8 @@ class MemoryInfo(BaseModel, validate_assignment=True):
43
45
 
44
46
 
45
47
  class CpuInfo(BaseModel, validate_assignment=True):
46
- count: int | None = None
47
- count_logical: int | None = None
48
+ count: Optional[int] = None
49
+ count_logical: Optional[int] = None
48
50
 
49
51
  def to_proto(self) -> wandb_internal_pb2.CpuInfo:
50
52
  return wandb_internal_pb2.CpuInfo(
@@ -58,13 +60,13 @@ class CpuInfo(BaseModel, validate_assignment=True):
58
60
 
59
61
 
60
62
  class AppleInfo(BaseModel, validate_assignment=True):
61
- name: str | None = None
62
- ecpu_cores: int | None = None
63
- pcpu_cores: int | None = None
64
- gpu_cores: int | None = None
65
- memory_gb: int | None = None
66
- swap_total_bytes: int | None = None
67
- ram_total_bytes: int | None = None
63
+ name: Optional[str] = None
64
+ ecpu_cores: Optional[int] = None
65
+ pcpu_cores: Optional[int] = None
66
+ gpu_cores: Optional[int] = None
67
+ memory_gb: Optional[int] = None
68
+ swap_total_bytes: Optional[int] = None
69
+ ram_total_bytes: Optional[int] = None
68
70
 
69
71
  def to_proto(self) -> wandb_internal_pb2.AppleInfo:
70
72
  return wandb_internal_pb2.AppleInfo(
@@ -91,11 +93,11 @@ class AppleInfo(BaseModel, validate_assignment=True):
91
93
 
92
94
 
93
95
  class GpuNvidiaInfo(BaseModel, validate_assignment=True):
94
- name: str | None = None
95
- memory_total: int | None = None
96
- cuda_cores: int | None = None
97
- architecture: str | None = None
98
- uuid: str | None = None
96
+ name: Optional[str] = None
97
+ memory_total: Optional[int] = None
98
+ cuda_cores: Optional[int] = None
99
+ architecture: Optional[str] = None
100
+ uuid: Optional[str] = None
99
101
 
100
102
  def to_proto(self) -> wandb_internal_pb2.GpuNvidiaInfo:
101
103
  return wandb_internal_pb2.GpuNvidiaInfo(
@@ -118,19 +120,19 @@ class GpuNvidiaInfo(BaseModel, validate_assignment=True):
118
120
 
119
121
 
120
122
  class GpuAmdInfo(BaseModel, validate_assignment=True):
121
- id: str | None = None
122
- unique_id: str | None = None
123
- vbios_version: str | None = None
124
- performance_level: str | None = None
125
- gpu_overdrive: str | None = None
126
- gpu_memory_overdrive: str | None = None
127
- max_power: str | None = None
128
- series: str | None = None
129
- model: str | None = None
130
- vendor: str | None = None
131
- sku: str | None = None
132
- sclk_range: str | None = None
133
- mclk_range: str | None = None
123
+ id: Optional[str] = None
124
+ unique_id: Optional[str] = None
125
+ vbios_version: Optional[str] = None
126
+ performance_level: Optional[str] = None
127
+ gpu_overdrive: Optional[str] = None
128
+ gpu_memory_overdrive: Optional[str] = None
129
+ max_power: Optional[str] = None
130
+ series: Optional[str] = None
131
+ model: Optional[str] = None
132
+ vendor: Optional[str] = None
133
+ sku: Optional[str] = None
134
+ sclk_range: Optional[str] = None
135
+ mclk_range: Optional[str] = None
134
136
 
135
137
  def to_proto(self) -> wandb_internal_pb2.GpuAmdInfo:
136
138
  return wandb_internal_pb2.GpuAmdInfo(
@@ -169,10 +171,10 @@ class GpuAmdInfo(BaseModel, validate_assignment=True):
169
171
 
170
172
 
171
173
  class TrainiumInfo(BaseModel, validate_assignment=True):
172
- name: str | None = None
173
- vendor: str | None = None
174
- neuron_device_count: int | None = None
175
- neuroncore_per_device_count: int | None = None
174
+ name: Optional[str] = None
175
+ vendor: Optional[str] = None
176
+ neuron_device_count: Optional[int] = None
177
+ neuroncore_per_device_count: Optional[int] = None
176
178
 
177
179
  def to_proto(self) -> wandb_internal_pb2.TrainiumInfo:
178
180
  return wandb_internal_pb2.TrainiumInfo(
@@ -193,10 +195,10 @@ class TrainiumInfo(BaseModel, validate_assignment=True):
193
195
 
194
196
 
195
197
  class TPUInfo(BaseModel, validate_assignment=True):
196
- name: str | None = None
197
- hbm_gib: int | None = None
198
- devices_per_chip: int | None = None
199
- count: int | None = None
198
+ name: Optional[str] = None
199
+ hbm_gib: Optional[int] = None
200
+ devices_per_chip: Optional[int] = None
201
+ count: Optional[int] = None
200
202
 
201
203
  def to_proto(self) -> wandb_internal_pb2.TPUInfo:
202
204
  return wandb_internal_pb2.TPUInfo(
@@ -217,8 +219,8 @@ class TPUInfo(BaseModel, validate_assignment=True):
217
219
 
218
220
 
219
221
  class GitRepoRecord(BaseModel, validate_assignment=True):
220
- remote_url: str | None = Field(None, alias="remote")
221
- commit: str | None = None
222
+ remote_url: Optional[str] = Field(None, alias="remote")
223
+ commit: Optional[str] = None
222
224
 
223
225
  def to_proto(self) -> wandb_internal_pb2.GitRepoRecord:
224
226
  return wandb_internal_pb2.GitRepoRecord(
@@ -270,128 +272,142 @@ class Metadata(BaseModel, validate_assignment=True):
270
272
  revalidate_instances="always",
271
273
  )
272
274
 
273
- os: str | None = None
275
+ os: Optional[str] = None
274
276
  """Operating system."""
275
277
 
276
- python: str | None = None
278
+ python: Optional[str] = None
277
279
  """Python version."""
278
280
 
279
- heartbeat_at: datetime | None = Field(default=None, alias="heartbeatAt")
281
+ heartbeat_at: Optional[datetime] = Field(default=None, alias="heartbeatAt")
280
282
  """Timestamp of last heartbeat."""
281
283
 
282
- started_at: datetime | None = Field(default=None, alias="startedAt")
284
+ started_at: Optional[datetime] = Field(default=None, alias="startedAt")
283
285
  """Timestamp of run start."""
284
286
 
285
- docker: str | None = None
287
+ docker: Optional[str] = None
286
288
  """Docker image."""
287
289
 
288
- cuda: str | None = None
290
+ cuda: Optional[str] = None
289
291
  """CUDA version."""
290
292
 
291
- args: list[str] = Field(default_factory=list)
293
+ args: List[str] = Field(default_factory=list)
292
294
  """Command-line arguments."""
293
295
 
294
- state: str | None = None
296
+ state: Optional[str] = None
295
297
  """Run state."""
296
298
 
297
- program: str | None = None
299
+ program: Optional[str] = None
298
300
  """Program name."""
299
301
 
300
- code_path: str | None = Field(default=None, alias="codePath")
302
+ code_path: Optional[str] = Field(default=None, alias="codePath")
301
303
  """Path to code."""
302
304
 
303
- git: GitRepoRecord | None = None
305
+ git: Optional[GitRepoRecord] = None
304
306
  """Git repository information."""
305
307
 
306
- email: str | None = None
308
+ email: Optional[str] = None
307
309
  """Email address."""
308
310
 
309
- root: str | None = None
311
+ root: Optional[str] = None
310
312
  """Root directory."""
311
313
 
312
- host: str | None = None
314
+ host: Optional[str] = None
313
315
  """Host name."""
314
316
 
315
- username: str | None = None
317
+ username: Optional[str] = None
316
318
  """Username."""
317
319
 
318
- executable: str | None = None
320
+ executable: Optional[str] = None
319
321
  """Python executable path."""
320
322
 
321
- code_path_local: str | None = Field(default=None, alias="codePathLocal")
323
+ code_path_local: Optional[str] = Field(default=None, alias="codePathLocal")
322
324
  """Local code path."""
323
325
 
324
- colab: str | None = None
326
+ colab: Optional[str] = None
325
327
  """Colab URL."""
326
328
 
327
- cpu_count: int | None = Field(default=None, alias="cpuCount")
329
+ cpu_count: Optional[int] = Field(default=None, alias="cpuCount")
328
330
  """CPU count."""
329
331
 
330
- cpu_count_logical: int | None = Field(default=None, alias="cpuCountLogical")
332
+ cpu_count_logical: Optional[int] = Field(default=None, alias="cpuCountLogical")
331
333
  """Logical CPU count."""
332
334
 
333
- gpu_type: str | None = Field(default=None, alias="gpuType")
335
+ gpu_type: Optional[str] = Field(default=None, alias="gpuType")
334
336
  """GPU type."""
335
337
 
336
- gpu_count: int | None = Field(default=None, alias="gpuCount")
338
+ gpu_count: Optional[int] = Field(default=None, alias="gpuCount")
337
339
  """GPU count."""
338
340
 
339
- disk: dict[str, DiskInfo] = Field(default_factory=dict)
341
+ disk: Dict[str, DiskInfo] = Field(default_factory=dict)
340
342
  """Disk information."""
341
343
 
342
- memory: MemoryInfo | None = None
344
+ memory: Optional[MemoryInfo] = None
343
345
  """Memory information."""
344
346
 
345
- cpu: CpuInfo | None = None
347
+ cpu: Optional[CpuInfo] = None
346
348
  """CPU information."""
347
349
 
348
- apple: AppleInfo | None = None
350
+ apple: Optional[AppleInfo] = None
349
351
  """Apple silicon information."""
350
352
 
351
- gpu_nvidia: list[GpuNvidiaInfo] = Field(default_factory=list, alias="gpuNvidia")
353
+ gpu_nvidia: List[GpuNvidiaInfo] = Field(default_factory=list, alias="gpuNvidia")
352
354
  """NVIDIA GPU information."""
353
355
 
354
- gpu_amd: list[GpuAmdInfo] = Field(default_factory=list, alias="gpuAmd")
356
+ gpu_amd: List[GpuAmdInfo] = Field(default_factory=list, alias="gpuAmd")
355
357
  """AMD GPU information."""
356
358
 
357
- slurm: dict[str, str] = Field(default_factory=dict)
359
+ slurm: Dict[str, str] = Field(default_factory=dict)
358
360
  """Slurm environment information."""
359
361
 
360
- cuda_version: str | None = Field(default=None, alias="cudaVersion")
362
+ cuda_version: Optional[str] = Field(default=None, alias="cudaVersion")
361
363
  """CUDA version."""
362
364
 
363
- trainium: TrainiumInfo | None = None
365
+ trainium: Optional[TrainiumInfo] = None
364
366
  """Trainium information."""
365
367
 
366
- tpu: TPUInfo | None = None
368
+ tpu: Optional[TPUInfo] = None
367
369
  """TPU information."""
368
370
 
369
371
  def __init__(self, **data):
370
372
  super().__init__(**data)
371
373
 
374
+ if not IS_PYDANTIC_V2:
375
+ termwarn(
376
+ "Metadata is read-only when using pydantic v1.",
377
+ repeat=False,
378
+ )
379
+ return
380
+
372
381
  # Callback for post-update. This is used in the Run object to trigger
373
382
  # a metadata update after the object is modified.
374
- self._post_update_callback: Callable | None = None # type: ignore
383
+ self._post_update_callback: Optional[Callable] = None # type: ignore
375
384
 
376
385
  def _set_callback(self, callback: Callable) -> None:
386
+ if not IS_PYDANTIC_V2:
387
+ return
377
388
  self._post_update_callback = callback
378
389
 
379
390
  @contextmanager
380
391
  def disable_callback(self):
381
392
  """Temporarily disable callback."""
382
- original_callback = self._post_update_callback
383
- self._post_update_callback = None
384
- try:
393
+ if not IS_PYDANTIC_V2:
385
394
  yield
386
- finally:
387
- self._post_update_callback = original_callback
395
+ else:
396
+ original_callback = self._post_update_callback
397
+ self._post_update_callback = None
398
+ try:
399
+ yield
400
+ finally:
401
+ self._post_update_callback = original_callback
402
+
403
+ if IS_PYDANTIC_V2:
388
404
 
389
- @model_validator(mode="after")
390
- def _callback(self) -> Self:
391
- if getattr(self, "_post_update_callback", None) is not None:
392
- self._post_update_callback(self.to_proto()) # type: ignore
405
+ @model_validator(mode="after")
406
+ def _callback(self) -> Self:
407
+ if getattr(self, "_post_update_callback", None) is not None:
408
+ self._post_update_callback(self.to_proto()) # type: ignore
393
409
 
394
- return self
410
+ return self
395
411
 
396
412
  @classmethod
397
413
  def _datetime_to_timestamp(cls, dt: datetime | None) -> Timestamp | None:
@@ -513,7 +529,7 @@ class Metadata(BaseModel, validate_assignment=True):
513
529
  proto (wandb_internal_pb2.MetadataRequest): The protobuf message.
514
530
  skip_existing (bool, optional): Skip updating fields that are already set.
515
531
  """
516
- data: dict[str, Any] = {}
532
+ data: Dict[str, Any] = {}
517
533
 
518
534
  # Handle all scalar fields.
519
535
  if proto.os: