Skip to content

Commit

Permalink
Remove metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
robmarkcole committed Nov 28, 2024
1 parent 86fda0b commit 3c8c3bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/litdata/streaming/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,7 @@ def serialize(self, item: Any) -> Tuple[bytes, Optional[str]]:
with open(item, "rb") as f:
data = f.read()

# Store metadata if needed
_, ext = os.path.splitext(item)
metadata = f"tifffile:{ext.lower()}"
return data, metadata
return data

def deserialize(self, data: bytes) -> Any:
return tifffile.imread(io.BytesIO(data)) # This is a NumPy array
Expand Down
4 changes: 1 addition & 3 deletions tests/streaming/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,10 @@ def test_tiff_serializer():
assert serializer.can_serialize(file_path)

# Serialize
data, metadata = serializer.serialize(file_path)
data = serializer.serialize(file_path)
assert isinstance(data, bytes)
assert metadata == f"tiff:{os.path.splitext(file_path)[1].lower()}"

# Deserialize
serializer.setup(metadata)
deserialized_data = serializer.deserialize(data)
assert isinstance(deserialized_data, np.ndarray)
assert deserialized_data.shape == (height, width, bands)
Expand Down

0 comments on commit 3c8c3bd

Please sign in to comment.