Skip to content

Commit

Permalink
Ensure filename remains set for later saving in sample_info (#2747)
Browse files Browse the repository at this point in the history
Ensure filename remains set for later saving in sample_info

---------

Co-authored-by: Nathan Voxland <nathan@voxland.net>
Co-authored-by: FayazRahman <fayazrahman4u@gmail.com>
  • Loading branch information
3 people committed Jan 24, 2024
1 parent ac1c471 commit 15fba0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 9 additions & 1 deletion deeplake/core/chunk/sample_compressed_chunk.py
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions deeplake/core/sample.py
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 15fba0c

Please sign in to comment.