wandb 0.20.0__py3-none-win32.whl → 0.20.1__py3-none-win32.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/gpu_stats.exe CHANGED
Binary file
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,6 +1,6 @@
1
1
  package_readme.md,sha256=XGlaq8rMFcoBb21rCr2d5qeSM79ZI4WslLmXqRimTGQ,4395
2
- wandb/__init__.py,sha256=vkJpQB53unFHVkg9O3j1cHd-IJdfWGaviwchAlYfwpA,7321
3
- wandb/__init__.pyi,sha256=1MjC035r5bv9JFNtsGs31WVSmFXuFYci0kbsG2keM-c,49375
2
+ wandb/__init__.py,sha256=vvYTPs3lKelQTsFwnHU_3Axn6V_EqLAq7IvadREhS8Y,7321
3
+ wandb/__init__.pyi,sha256=AnFHXNQ-qSVPWRju2psy8Kl9n7iX8tUSioHEhWAPujQ,49375
4
4
  wandb/__main__.py,sha256=uHY6OxHT6RtTH34zC8_UC1GsCTkndgbdsHXv-t7dOMI,67
5
5
  wandb/_iterutils.py,sha256=_ZUvfdQ8YeKrT_0HKaAKjkVyLHQdTYRcCh0l-zGxTMM,2465
6
6
  wandb/data_types.py,sha256=DdCkf7Dh_j86Q74FWzh3M20EW_hzKpNagexjo03qv-A,2349
@@ -86,8 +86,8 @@ wandb/automations/_generated/operations.py,sha256=V0n3PZ_e754Ym8IraYjFzLWg0wqnA_
86
86
  wandb/automations/_generated/slack_integrations_by_entity.py,sha256=95llPwkGxKrwX4R6ze9IxzmMuyLpIWoperLUy-hKsE0,558
87
87
  wandb/automations/_generated/update_automation.py,sha256=9SvGNXYK7fEZdhztonzRcMiJ8Yqps-42hKB16CUOFYI,357
88
88
  wandb/beta/workflows.py,sha256=t35UZZ0fovG8qmE0wIINKpU0ynHHXQ2DjE7XdzWD__4,10648
89
- wandb/bin/gpu_stats.exe,sha256=mRrKMPkznAz1oLK-1uaLLl9wij1c0WaPCqzEv0RVyTI,8159232
90
- wandb/bin/wandb-core,sha256=fcZMk-hjT2g6H0qqh2ir_lk5IWwiIMV2DsjBJ8bwHk8,58521600
89
+ wandb/bin/gpu_stats.exe,sha256=DKxl5tCYGwH0gWrUKbY_j_dT_7THYMLgqxNBmn2XOc4,8159232
90
+ wandb/bin/wandb-core,sha256=-n93BcaIvaZRQMFRnTqYknHu7-fhhUCwvTkrXv2dKTs,58521600
91
91
  wandb/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
92
  wandb/cli/beta.py,sha256=_wbqhk6J2yjnNuVQAGlYbYZ9-j0sFE73zMIXVkQYlXA,5619
93
93
  wandb/cli/cli.py,sha256=wGObFtUSgm_IyesGiuAKRt3nmY0lwN3QD_-OTCkyt4M,94802
@@ -326,7 +326,7 @@ wandb/sdk/data_types/bokeh.py,sha256=ykxVAha5whA7uQyrYYHalS4NXha5tcFgOVRxFXUqCwo
326
326
  wandb/sdk/data_types/graph.py,sha256=eHCo-Svlzvihf_nri_50rcD-NohqHuE80PR-otiueYQ,12494
327
327
  wandb/sdk/data_types/histogram.py,sha256=Icb6ox2dXP_OjaXjU6rZzkk8AfRQevQE9BHdQiedELo,3239
328
328
  wandb/sdk/data_types/html.py,sha256=eMgZyJ5VYcT6AH2gb34CA09Y0s3ul8en_FD48nFRU6M,4523
329
- wandb/sdk/data_types/image.py,sha256=EhjfERF4r9Bizppnn8Tm_faWUqRqSW_caF1uhrr4w7M,35238
329
+ wandb/sdk/data_types/image.py,sha256=lRaEChoi9ZGL3iQK-XDbR1WIZIP2_Oz9RiNnVMrsbmg,35749
330
330
  wandb/sdk/data_types/molecule.py,sha256=JY3Hr-gI9scBk82UVTMdoZHWiAgrpL7tzDSROvCpPww,8786
331
331
  wandb/sdk/data_types/object_3d.py,sha256=6zrw8cdunfdlVNKWZpPOQDd0TGaWovRrAS_5h-GRTGs,16758
332
332
  wandb/sdk/data_types/plotly.py,sha256=UNYwRUUCODSyGvD3WEiF0p6jEseNfYiGnm8mD_tOoiI,2995
@@ -907,8 +907,8 @@ wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py,sha256=kX0rdVmTDL
907
907
  wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py,sha256=7fpTDfxSYvSRtHvyog-plRdLR5A6k1QVY_AL0gVhhPM,1563
908
908
  wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py,sha256=xzyQmuba2gns1s3Qemu9SXaKV5zeTL3TP9--xOi541g,2254
909
909
  wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py,sha256=R48kuuEIi7XzCJBJ6Xo7v6DJIbOP5EwcsWaPf5Axn_g,3951
910
- wandb-0.20.0.dist-info/METADATA,sha256=54GhP4I8qsLq7vu3FjlR_sxav0qC3_sCSraynNk2kSg,10307
911
- wandb-0.20.0.dist-info/WHEEL,sha256=F7luzo77gHneG2SMTaD6iIlqNT8oVz1uotn5Zigp4o8,89
912
- wandb-0.20.0.dist-info/entry_points.txt,sha256=v4FCOZ9gW7Pc6KLsmgQqpCiKTrA1wh2XHmNf-NUP1-I,67
913
- wandb-0.20.0.dist-info/licenses/LICENSE,sha256=rJ7p1acqNi17WFOAJ9WqsImXZtKZDA3i_gzdDVGRuFQ,1102
914
- wandb-0.20.0.dist-info/RECORD,,
910
+ wandb-0.20.1.dist-info/METADATA,sha256=86RafFiYjMqMeso0ph6f-0hXGZoVAQUy9jUW33HH-EE,10307
911
+ wandb-0.20.1.dist-info/WHEEL,sha256=F7luzo77gHneG2SMTaD6iIlqNT8oVz1uotn5Zigp4o8,89
912
+ wandb-0.20.1.dist-info/entry_points.txt,sha256=v4FCOZ9gW7Pc6KLsmgQqpCiKTrA1wh2XHmNf-NUP1-I,67
913
+ wandb-0.20.1.dist-info/licenses/LICENSE,sha256=rJ7p1acqNi17WFOAJ9WqsImXZtKZDA3i_gzdDVGRuFQ,1102
914
+ wandb-0.20.1.dist-info/RECORD,,
File without changes