wandb 0.20.0__py3-none-macosx_11_0_arm64.whl → 0.20.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.
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.20.0"
13
+ __version__ = "0.20.1"
14
14
 
15
15
 
16
16
  from wandb.errors import Error
wandb/__init__.pyi CHANGED
@@ -106,7 +106,7 @@ if TYPE_CHECKING:
106
106
  import wandb
107
107
  from wandb.plot import CustomChart
108
108
 
109
- __version__: str = "0.20.0"
109
+ __version__: str = "0.20.1"
110
110
 
111
111
  run: Run | None
112
112
  config: wandb_config.Config
wandb/bin/wandb-core CHANGED
Binary file
@@ -58,25 +58,39 @@ def _warn_on_invalid_data_range(
58
58
  )
59
59
 
60
60
 
61
- def _normalize(data: "np.ndarray") -> "np.ndarray":
62
- """Normalizes and converts image pixel values to uint8 in the range [0, 255]."""
63
- np = util.get_module(
64
- "numpy",
65
- required="wandb.Image requires numpy if not supplying PIL Images: pip install numpy",
66
- )
61
+ def _guess_and_rescale_to_0_255(data: "np.ndarray") -> "np.ndarray":
62
+ """Guess the image's format and rescale its values to the range [0, 255].
63
+
64
+ This is an unfortunate design flaw carried forward for backward
65
+ compatibility. A better design would have been to document the expected
66
+ data format and not mangle the data provided by the user.
67
+
68
+ If given data in the range [0, 1], we multiply all values by 255
69
+ and round down to get integers.
70
+
71
+ If given data in the range [-1, 1], we rescale it by mapping -1 to 0 and
72
+ 1 to 255, then round down to get integers.
73
+
74
+ We clip and round all other data.
75
+ """
76
+ try:
77
+ import numpy as np
78
+ except ImportError:
79
+ raise wandb.Error(
80
+ "wandb.Image requires numpy if not supplying PIL images: pip install numpy"
81
+ ) from None
67
82
 
68
- # if an image has negative values, set all values to be in the range [0, 1]
69
- # This can lead to inconsistent behavior when an image has only a single negative value
70
- if np.min(data) < 0:
71
- data = data - np.min(data)
83
+ data_min: float = data.min()
84
+ data_max: float = data.max()
72
85
 
73
- if np.ptp(data) != 0:
74
- data = data / np.ptp(data)
86
+ if 0 <= data_min and data_max <= 1:
87
+ return (data * 255).astype(np.uint8)
75
88
 
76
- if np.max(data) <= 1.0:
77
- data = (255 * data).astype(np.int32)
89
+ elif -1 <= data_min and data_max <= 1:
90
+ return (255 * 0.5 * (data + 1)).astype(np.uint8)
78
91
 
79
- return data.clip(0, 255)
92
+ else:
93
+ return data.clip(0, 255).astype(np.uint8)
80
94
 
81
95
 
82
96
  def _convert_to_uint8(data: "np.ndarray") -> "np.ndarray":
@@ -393,7 +407,7 @@ class Image(BatchableMedia):
393
407
 
394
408
  _warn_on_invalid_data_range(data, normalize)
395
409
 
396
- data = _normalize(data) if normalize else data # type: ignore [arg-type]
410
+ data = _guess_and_rescale_to_0_255(data) if normalize else data # type: ignore [arg-type]
397
411
  data = _convert_to_uint8(data)
398
412
 
399
413
  if data.ndim > 2:
@@ -413,7 +427,7 @@ class Image(BatchableMedia):
413
427
  _warn_on_invalid_data_range(data, normalize) # type: ignore [arg-type]
414
428
 
415
429
  mode = mode or self.guess_mode(data, file_type)
416
- data = _normalize(data) if normalize else data # type: ignore [arg-type]
430
+ data = _guess_and_rescale_to_0_255(data) if normalize else data # type: ignore [arg-type]
417
431
  data = _convert_to_uint8(data) # type: ignore [arg-type]
418
432
  self._image = pil_image.fromarray(
419
433
  data,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wandb
3
- Version: 0.20.0
3
+ Version: 0.20.1
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
@@ -1,15 +1,15 @@
1
1
  package_readme.md,sha256=U9047nyMDICgctm1HLm4HfXwFnFKsEn2m77hsYPUZ1I,4298
2
- wandb-0.20.0.dist-info/RECORD,,
3
- wandb-0.20.0.dist-info/WHEEL,sha256=B_HTF0nESsbkeA2UeB8YgKrtPrxyKFORYURx7Qxu8Xw,101
4
- wandb-0.20.0.dist-info/entry_points.txt,sha256=v4FCOZ9gW7Pc6KLsmgQqpCiKTrA1wh2XHmNf-NUP1-I,67
5
- wandb-0.20.0.dist-info/METADATA,sha256=54GhP4I8qsLq7vu3FjlR_sxav0qC3_sCSraynNk2kSg,10307
6
- wandb-0.20.0.dist-info/licenses/LICENSE,sha256=izOKRJpGOx1PrJiGOKR0HsNdlB5JdH2d0Z4P7a7ssTc,1081
2
+ wandb-0.20.1.dist-info/RECORD,,
3
+ wandb-0.20.1.dist-info/WHEEL,sha256=B_HTF0nESsbkeA2UeB8YgKrtPrxyKFORYURx7Qxu8Xw,101
4
+ wandb-0.20.1.dist-info/entry_points.txt,sha256=v4FCOZ9gW7Pc6KLsmgQqpCiKTrA1wh2XHmNf-NUP1-I,67
5
+ wandb-0.20.1.dist-info/METADATA,sha256=86RafFiYjMqMeso0ph6f-0hXGZoVAQUy9jUW33HH-EE,10307
6
+ wandb-0.20.1.dist-info/licenses/LICENSE,sha256=izOKRJpGOx1PrJiGOKR0HsNdlB5JdH2d0Z4P7a7ssTc,1081
7
7
  wandb/env.py,sha256=G9VGOMvSPAAmKxIfTrJuYs1fVtHvPqnalg7KjJ7fSFY,14139
8
- wandb/__init__.pyi,sha256=kZo96SFeW-OLP6hIGhyi7224rxhs_79UxnRET5v3lk4,48123
8
+ wandb/__init__.pyi,sha256=nWUVGrUbymxXWlYwbkoakcN5EbXF-15ZJkXThTGKXTg,48123
9
9
  wandb/util.py,sha256=fCPwfepeZVKoR9eVgEntygISAmP6Mz5q7KknhF7cn50,63114
10
10
  wandb/wandb_run.py,sha256=CNh9S6uubFk8FphQjzkbvedyyGCN9aBEsRBKjy8tqqs,155
11
11
  wandb/_iterutils.py,sha256=NX6MaIE3JzPXsqKNXUKdnpIlX0spGG8HwGIQt5VASrk,2400
12
- wandb/__init__.py,sha256=Q0K6cKpsIpkEcwlfEagt0w2vTeQpORSgjX-51m9GzL4,7072
12
+ wandb/__init__.py,sha256=voeAUjikukV1wUbzWpSRKezgf6AEE6NODckD2qsuHCU,7072
13
13
  wandb/data_types.py,sha256=M-wqAO0FtIqvj28556u3h4nzSwlRcbxhXoX0B9jlJSo,2283
14
14
  wandb/wandb_controller.py,sha256=SksJdgwn14PpnUoIaBjJ9Ki4Nksl9BpQGGn42hT0xZg,24936
15
15
  wandb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -103,7 +103,7 @@ wandb/proto/v3/wandb_base_pb2.py,sha256=_nsr_HW4Fdz62-KiXGo6Dw0_9bwdXz07auZkkH2Q
103
103
  wandb/proto/v3/wandb_internal_pb2.py,sha256=xKTg9CalkBOznziFa5fA9kirA9kqg72QbEANoMvcSDI,118397
104
104
  wandb/proto/v3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
105
105
  wandb/proto/v3/wandb_telemetry_pb2.py,sha256=IOk3VMF7uOKOpl8C5163Vuzxt32xbR_ph_2TsKJU3NQ,14350
106
- wandb/bin/wandb-core,sha256=7yJWXx7zH9cSSvi7Rc2q9qa7R3sW33KUbkFcNruxKxQ,56596866
106
+ wandb/bin/wandb-core,sha256=fylEgIC7Evu_MpIko6DMXNdX-Kamwx50NkEC96cVstQ,56596866
107
107
  wandb/bin/gpu_stats,sha256=Kewea_STGOMcTnHflaerBOPvsTM2-2LUw4FM_QrSdpI,9146736
108
108
  wandb/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
109
  wandb/integration/yolov8/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -307,7 +307,7 @@ wandb/sdk/data_types/bokeh.py,sha256=RuMsi7v_yJyMEuYjfrwTL1q1B8svdCW9t_eNge9aEJA
307
307
  wandb/sdk/data_types/saved_model.py,sha256=OKk1IB3q1HC-VRQMD2CTNP1h_Ca_15NRAMY5LXLjO7o,16310
308
308
  wandb/sdk/data_types/plotly.py,sha256=LEIHRqtHHpSou04AEUsyH8_UMXP4adrEHHaKoEtQkxo,2913
309
309
  wandb/sdk/data_types/video.py,sha256=JQ9ZJ-IqocQ7fI9iGswG_JwB0gUk89JXgMSUOemVak8,9835
310
- wandb/sdk/data_types/image.py,sha256=Al6Jtgm8_uDcSy9JnQf0L3MSmYb72Ep4u8eKQVxO0Io,34314
310
+ wandb/sdk/data_types/image.py,sha256=xdYth860StgcqoUJ0o4NPncj83XB5BRWI7ypY5PbrUY,34811
311
311
  wandb/sdk/data_types/_private.py,sha256=zp2NRarTlIq4Hk3R2xp7j_qPGNzBMnaGHrZUN82shaY,299
312
312
  wandb/sdk/data_types/base_types/media.py,sha256=U-JmWYqd2uykHTMjPi_BdL53NMf3kgdlbpr-Dg_z_3Y,14510
313
313
  wandb/sdk/data_types/base_types/json_metadata.py,sha256=oKpimndUQvDW30n15tb2pbyyyKhhWwm8wsYNBEot060,1553
File without changes