
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Treescope: An interactive HTML pretty-printer for ML research in IPython notebooks.
Treescope is an interactive HTML pretty-printer and N-dimensional array ("tensor") visualizer, designed for machine learning and neural networks research in IPython notebooks. It's a drop-in replacement for the standard IPython/Colab renderer, and adds support for:
Treescope was originally developed as the pretty-printer for the Penzai neural network library, but it also supports rendering neural networks developed with other libraries, including Equinox, Flax NNX, and PyTorch. You can also use it with basic JAX and Numpy code.
With Treescope, instead of looking at this:
You could be looking at this:
This is an interactive visualization; try clicking the ▶
buttons to expand
parts of the output! (You can also hold shift while scrolling to
scroll horizontally instead of vertically.)
Documentation on Treescope can be found at https://treescope.readthedocs.io.
You can install Treescope using:
pip install treescope
and import it using:
import treescope
To render a specific object in an IPython notebook with Treescope, you can use
treescope.show
, which is like print
but produces a rich interactive output.
Alternatively, you can simply configure Treescope as the default pretty printer for your notebook via:
treescope.register_as_default()
To turn on automatic array visualization, you can run:
treescope.active_autovisualizer.set_globally(treescope.ArrayAutovisualizer())
Or, if you'd like to both set up Treescope as the default pretty printer and enable automatic array visualization, you can simply run:
treescope.basic_interactive_setup(autovisualize_arrays=True)
Once you've rendered an object, try clicking on it and pressing the r
key!
This turns on "roundtrip mode", and adds qualified names to every type in the
visualization, making it easier to identify what the types in your object are.
[!TIP] If Treescope's outputs are too verbose, or if you are using a terminal that wraps lines, you can configure Treescope to abbreviate collapsed objects at a given depth using:
treescope.basic_interactive_setup( autovisualize_arrays=True, abbreviation_threshold=1, # or a different value )
You can also configure the abbreviation threshold manually by overriding
treescope.abbreviation_threshold
using the.set_globally
or.set_scoped
methods.
For more information on how to use Treescope, check out the Treescope documentation.
Looking for a neural network library with first-class support for Treescope's visualization features? Try Penzai!
If you have found Treescope to be useful for your research, please consider citing the following writeup (also available on arXiv):
@article{johnson2024penzai,
author={Daniel D. Johnson},
title={{Penzai} + {Treescope}: A Toolkit for Interpreting, Visualizing, and Editing Models As Data},
year={2024},
journal={ICML 2024 Workshop on Mechanistic Interpretability}
}
This is not an officially supported Google product.
FAQs
Treescope: An interactive HTML pretty-printer for ML research in IPython notebooks.
We found that treescope demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.