From f369a064a136d66dfcc363b4e3d6f5290fe12db8 Mon Sep 17 00:00:00 2001 From: 0AnshuAditya0 Date: Sun, 16 Nov 2025 11:04:20 +0530 Subject: [PATCH 1/2] Fix MSLR-WEB dataset download URLs The old OneDrive API v1.0 URLs were returning HTTP 400 errors. Updated to new OneDrive share links from the official Microsoft Research page. Fixes #11136 --- tensorflow_datasets/ranking/mslr_web/mslr_web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow_datasets/ranking/mslr_web/mslr_web.py b/tensorflow_datasets/ranking/mslr_web/mslr_web.py index 3d07dcaefb2..b76e8ac9c2d 100644 --- a/tensorflow_datasets/ranking/mslr_web/mslr_web.py +++ b/tensorflow_datasets/ranking/mslr_web/mslr_web.py @@ -61,8 +61,8 @@ """ _URLS = { - "10k": "https://api.onedrive.com/v1.0/shares/s!AtsMfWUz5l8nbOIoJ6Ks0bEMp78/root/content", - "30k": "https://api.onedrive.com/v1.0/shares/s!AtsMfWUz5l8nbXGPBlwD1rnFdBY/root/content", + "10k": "https://1drv.ms/u/s!AtsMfWUz5l8nbOIoJ6Ks0bEMp78", + "30k": "https://1drv.ms/u/s!AtsMfWUz5l8nbXGPBlwD1rnFdBY", } _FEATURE_NAMES = { From 21062d65b33978f2263443280c03413add5c0224 Mon Sep 17 00:00:00 2001 From: 0AnshuAditya0 Date: Thu, 20 Nov 2025 10:49:28 +0530 Subject: [PATCH 2/2] Fix Pillow 12.0.0 compatibility for uint16 multi-channel images. Pillow 12.0.0 removed support for creating multi-channel (RGB/RGBA) images from uint16 numpy arrays via fromarray(). The _fromarray_typemap no longer includes keys like ((1, 1, 3), ' PilImage: def create_thumbnail( ex: np.ndarray, *, use_colormap: bool, default_dimensions: bool = True ) -> PilImage: - """Creates the image from the np.array input.""" - PIL_Image = lazy_imports_lib.lazy_imports.PIL_Image # pylint: disable=invalid-name + PIL_Image = lazy_imports_lib.lazy_imports.PIL_Image - if use_colormap: # Apply the colormap first as it modify the shape/dtype + if use_colormap: ex = apply_colormap(ex) _, _, c = ex.shape @@ -183,12 +182,16 @@ def create_thumbnail( ex = ex.squeeze(axis=-1) mode = 'L' elif ex.dtype == np.uint16: - mode = 'I;16' - postprocess = _postprocess_convert_rgb + if c in (3, 4): + ex = (ex / 257).astype(np.uint8) + mode = None + else: + mode = 'I;16' + postprocess = _postprocess_convert_rgb else: mode = None img = PIL_Image.fromarray(ex, mode=mode) img = postprocess(img) if default_dimensions: - img.thumbnail((THUMBNAIL_SIZE, THUMBNAIL_SIZE)) # Resize the image in-place + img.thumbnail((THUMBNAIL_SIZE, THUMBNAIL_SIZE)) return img