question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] pretty prints of objects

See original GitHub issue

🚨🚨 Feature Request

If your feature will improve HUB

To explore the structure of a dataset it is convenient to have nicer and more informative prints of dataset objects and samples

Description of the possible solution

1) show ds

now

> ds
Dataset(path='hub://activeloop/abalone_full_dataset', tensors=['length', 'diameter', 'height', 'weight'])

Something along the lines would work (taken from SQLlite)

> ds.height
path: "hub://activeloop/abalone_full_dataset", samples:  1532596

tensor    htype        dtype    shape       compression
------    ------       ------   ------      -----------
length    image        uint8    256x256x3   jpeg
diameter  image        float32  512x512x3   zstd
height    image        float32  512x512x3   zstd
weight    class_label  int32    32          None

and in jupyter notebook shown as a table similar to pandas

2) show ds.tensor

now

> ds.height
Tensor(key='Length')

at least provide full information about tensor

> ds.height
Tensor(
    key='height', 
    htype='image', 
    dtype='uint8', 
    shape=(256, 256, 3), 
    sample_compression='jpeg'
)

or to make consistent with 1)

> ds.height
tensor    htype    dtype     shape       compression
------    ------   ------    ------      -----------
height    image    float32   512x512x3   zstd

2) show ds[0:5] sample

> ds[0:5]
    length    diameter     height     weight
    ------    --------     ------     ------
0      0.5    [[0.,...,0]] "sent.."      dog   
0      0.5    [[0.,...,0]] "text a"      dog   
0      0.5    [[0.,...,0]] "text b"      dog   

and in jupyter notebook visualize images (and other htypes)

Notes

  • Feel free to provide a better format for printing dataset, tensor and sample classes
  • Feel free to suggest other important classes/objects need to printed properly for exploring the structure

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
SaiNikhileshReddycommented, Mar 23, 2022

@davidbuniat @FayazRahman @mikayelh I have been working on generating below output. I would push the code for the both table and schema soon.

Any updates on below outputs will help solve the issue quickly.

Command Line Output: image

Jupyter Notebook Output: image

1reaction
SaiNikhileshReddycommented, Mar 29, 2022

Sure @davidbuniat. I’ll integrate the code in hub and raise these doubts in that PR. Thanks for clarifying and sharing feedback!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettify Your Data Structures With Pretty Print in Python
The pprint module, Python's data pretty printer, is a useful part of the standard library. You can work with it for debugging data...
Read more >
pprint — Data pretty printer — Python 3.11.1 documentation
The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the...
Read more >
Data::Printer - colored & full-featured pretty print ... - MetaCPAN
This function pretty-prints the contents of whatever variable to STDERR (by default), and will use colors by default if your terminal supports it....
Read more >
which objects does Pry print pretty? · Issue #422 - GitHub
At the moment pry pretty prints using the pretty_inspect function and then piping the result through CodeRay to highlight it like ruby code, ......
Read more >
Pretty Print a JSON File in Python (6 Methods) - Datagy
One of the parameters of the function allows us to customize the indent that we want our JSON object to be indented with....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found