From 15fba0c896a9d67ea5f122556d5a7fa4ac3a481d Mon Sep 17 00:00:00 2001 From: nvoxland-al <151186252+nvoxland-al@users.noreply.github.com> Date: Wed, 24 Jan 2024 06:09:01 +0000 Subject: [PATCH] Ensure filename remains set for later saving in sample_info (#2747) Ensure filename remains set for later saving in sample_info --------- Co-authored-by: Nathan Voxland Co-authored-by: FayazRahman --- deeplake/core/chunk/sample_compressed_chunk.py | 10 +++++++++- deeplake/core/sample.py | 6 ++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/deeplake/core/chunk/sample_compressed_chunk.py b/deeplake/core/chunk/sample_compressed_chunk.py index 35c5f1217a..2fe2019591 100644 --- a/deeplake/core/chunk/sample_compressed_chunk.py +++ b/deeplake/core/chunk/sample_compressed_chunk.py @@ -53,8 +53,16 @@ def extend_if_has_space(self, incoming_samples: List[InputSample], update_tensor num_samples += 1 else: if serialized_sample: + path = None + if isinstance(incoming_sample, Sample): + path = incoming_sample.path + sample = Sample( - buffer=serialized_sample, compression=compr, shape=shape, dtype=dtype # type: ignore + buffer=serialized_sample, + compression=compr, + shape=shape, + dtype=dtype, + path=path, # type: ignore ) sample.htype = self.htype incoming_samples[i] = sample diff --git a/deeplake/core/sample.py b/deeplake/core/sample.py index 98e5803489..c4b3058b0f 100644 --- a/deeplake/core/sample.py +++ b/deeplake/core/sample.py @@ -19,6 +19,7 @@ POINT_CLOUD_COMPRESSION, MESH_COMPRESSION, NIFTI_COMPRESSION, + BYTE_COMPRESSION, ) from deeplake.util.exceptions import SampleReadError, UnableToReadFromUrlError from deeplake.util.exif import getexif @@ -349,10 +350,7 @@ def _decompress(self, to_pil: bool = False): ) else: - if self.path and get_path_type(self.path) == "local": - compressed = self.path - else: - compressed = self.buffer + compressed = self.buffer if to_pil: self._pil = decompress_array(