Skip to content

Commit

Permalink
Revert "Allow virtual tensors .data to use indra_ts.numpy as fallback. (
Browse files Browse the repository at this point in the history
#2873)"

This reverts commit 8b27518.
  • Loading branch information
nvoxland committed Jun 18, 2024
1 parent 54b1cbe commit fd76ea7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
36 changes: 12 additions & 24 deletions deeplake/core/dataset/indra_tensor_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,21 @@ def numpy(

def text(self, fetch_chunks: bool = False):
"""Return text data. Only applicable for tensors with 'text' base htype."""
try:
bs = self.indra_tensor.bytes()
if self.ndim == 1:
return bs.decode()
if isinstance(bs, bytes):
return [bs.decode()]
return list(b.decode() for b in bs)
except Exception as e:
bs = self.indra_tensor.numpy(aslist=True)
if self.ndim == 1:
return bs[0]
return list(b[0] for b in bs)
bs = self.indra_tensor.bytes()
if self.ndim == 1:
return bs.decode()
if isinstance(bs, bytes):
return [bs.decode()]
return list(b.decode() for b in bs)

def dict(self, fetch_chunks: bool = False):
"""Return json data. Only applicable for tensors with 'json' base htype."""
try:
bs = self.indra_tensor.bytes()
if self.ndim == 1:
return json.loads(bs.decode())
if isinstance(bs, bytes):
return [json.loads(bs.decode())]
return list(json.loads(b.decode()) for b in self.indra_tensor.bytes())
except Exception as e:
bs = self.indra_tensor.numpy(aslist=True)
if self.ndim == 1:
return bs[0]
return list(b[0] for b in bs)
bs = self.indra_tensor.bytes()
if self.ndim == 1:
return json.loads(bs.decode())
if isinstance(bs, bytes):
return [json.loads(bs.decode())]
return list(json.loads(b.decode()) for b in self.indra_tensor.bytes())

@property
def dtype(self):
Expand Down
2 changes: 1 addition & 1 deletion deeplake/util/bugout_token.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUGOUT_TOKEN = "0095ccd3-7ff0-41b9-b031-f4eb58f00906"
BUGOUT_TOKEN = "f7176d62-73fa-4ecc-b24d-624364bddcb0"

0 comments on commit fd76ea7

Please sign in to comment.