Skip to content

Conversation

@ramyamounir
Copy link
Contributor

This introduces a new hypothesis space visualization with a focus on burst sampling. The line plot shows when a burst is triggered, as well as the hypothesis space size and the max global slope over time. I've also introduced toggle switches to view the history of agent and sensor patch locations. There are some other nice features such as alpha slider for the mesh, and coloring the hyp space point cloud by different metrics. The video below showcases some of those features.

FYI @hlee9212, I've added your Shim Unpickler solution to the interactive library as part of a PretrainedModelsLoader class that returns a point cloud of the pretrained model. Feel free to adjust your code to use that directly if you like.

line_plot.mp4

fix: pretrained models class descriptions and shim unpickler

fix: remove print message in widgets.py

feat: extract_slider_state round parameter

feat: add extract button state helper function

feat: add interactive pointcloud plot
@nielsleadholm
Copy link
Contributor

Love the visualization! Just some high level comments before I have a chance to review the code. These are generally focused on how we can make it more user friendly or the improve the aesthetics:

  • Would it make more sense to call it "agent" (path) rather than sensor? I think that might be more intuitive for people seeing it for the first time.
  • For most of the buttons, I think it would be clearer to have drop-downs (if possible) that present the different options. If this is not possible, something like "Agent Path: On" vs "Agent Path: Off" - basically not assuming that someone knows what is going to happen when they click a button if they have never clicked it before.
  • Changing "Alpha" to "Mesh Transparency"

Stylistically, I wonder if you could try some subtle changes to improve it a bit? E.g.

  • Changing all the font to be consistent and clean (Arial?)
  • ?rounded corners on the buttons
  • Use the TBP colors (starting with Blumenta and then pink) for the buttons and plotting elements
  • Increasing the resolution of the line-plot, it looks kind of blurry vs the other elements?
  • You could also try passing the plotting code to an LLM and asking for graphic design tips to make it look more professional (obviously the content is already great, but I know my web dev friends have found LLMs great for this kind of thing).

@ramyamounir
Copy link
Contributor Author

ramyamounir commented Dec 2, 2025

Thanks @nielsleadholm! I addressed the majority of these concerns.

Would it make more sense to call it "agent" (path) rather than sensor?

Yes, that makes a lot of sense, especially because the patch can also be called "sensor patch" sometimes, which can be confused with the sensor. Updated in d5427f1c032a

it would be clearer to have drop-downs (if possible) that present the different options. If this is not possible, something like "Agent Path: On" vs "Agent Path: Off"

Unfortunately, I only have a few very basic widgets in vedo and even customization can be difficult, drop down menus are not supported. I updated to the pattern Name: [On/Off] as you suggested in c85b16c761fd

Changing "Alpha" to "Mesh Transparency"

Updated in 9a9132555099

Changing all the font to be consistent and clean (Arial?)

I'm trying to avoid system fonts and only use ones that come builtin in vedo to make sure it works out of the box for everyone. I personally think Calco (the one we're using now) looks good, but here is a list of the available ones. Would you prefer, e.g., Theemim?

fonts

rounded corners on the buttons

This is one of the customizations that's not supported in Vedo.

Use the TBP colors (starting with Blumenta and then pink) for the buttons and plotting elements

Nice idea, I added the TBP color palette as part of the interactive library in 784d6fb0bffd and used it in the plot in b9aa9135fa09. I tried to use it wherever possible, hopefully the colors are not too distracting. What do you think?

colors

Increasing the resolution of the line-plot

I fixed this in 8495f5d04f10

You could also try passing the plotting code to an LLM

I tried this and didn't get any good suggestions that can be done in Vedo. I think the main problem is that Vedo is limited in the types of widgets and possible customizations, we are already using all the options that can be used and pushing vedo to it's limits. Check out their gallery, it's very basic.

@nielsleadholm
Copy link
Contributor

Nice thanks, that's looking great!

Re. the font, is it possible to try Comae and Normografo for comparison? Otherwise all the changes / responses look good.

@nielsleadholm
Copy link
Contributor

As an aside/not something we need to sort now, these Vedo examples in the gallery made me think that it could eventually be interesting to have something where the mesh is gradually revealed in the same way as it is to Monty, basically showing only the parts that it has uncovered via its path. It would give the user a more intuitive sense for how much/little Monty has explored.

Screenshot 2025-12-03 at 11 21 27 AM

@ramyamounir
Copy link
Contributor Author

ramyamounir commented Dec 3, 2025

try Comae and Normografo for comparison?

Sure, first image is "Comae" and one after is "Normografo". I'm not very good with Fonts and don't usually spot the differences when they are close 😅, but let me know if there's one you prefer. Note that the font changes will only apply to the vedo widgets, the matplotlib figure uses the matplotlib default "DejaVu Sans". Vedo fonts are not available in matplotlib.

comae normografo

interesting to have something where the mesh is gradually revealed in the same way as it is to Monty

Yeah, I agree. That would be interesting to try out. We would need the size of the patch to uncover the correct surface area. Vedo also has a ray collision system where it will give you the intersection point on the mesh based on the camera's FOV, etc.

@nielsleadholm
Copy link
Contributor

Nice thanks! Personally I think Comae looks best. It might just be worth decreasing the font size ever so slightly, the text looks a bit too big for the boxes.

Would it be possible to also update the fonts below (either to match Matplotlib default or Comae?) - both the text and numbers.

(sorry I know I'm nitpicking, but just want to do these figures justice!)

Screenshot 2025-12-03 at 11 55 28 AM Screenshot 2025-12-03 at 11 55 46 AM

@ramyamounir
Copy link
Contributor Author

Nice catch, I forget to set a font variable to the slider. This is all changed now. I made some other changes to the scalar bar and the button inside the hypothesis space subplot. I also found an "Arial" font in Vedo and I think it looks nice, what do you think about these changes?

I can't change the text font size inside the box and leave the button box size the same. It's a more involved change because it looks like vedo rasterizes the button with the text on it, so we can't change the text properties after the button has been created. They also don't allow changing the font size independent of the box size, they shrink together.

pic-selected-251203-0830-54

@ramyamounir
Copy link
Contributor Author

Added some more modifications to the line plot suggested by Viviane.

line_plot_mods

@ramyamounir
Copy link
Contributor Author

I have renamed "Max slope" to "Max Recent Evidence Growth" as suggested by Niels, I also renamed "Burst" to "Sampling Burst" to be more specific.

pointcloud

Copy link
Contributor

@nielsleadholm nielsleadholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice and clean, looks great! Just a few minor comments.

label="Current step",
)

ax_left.set_ylabel("Max slope")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also be worth changing to "Max Recent Evidence Growth".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks. Fixed in 54517032c4fb

"""Load a torch checkpoint with optional fallback for tbp.monty shimming.
Try a standard torch.load first (weights_only=False because we need objects).
If tbp.monty isn't installed and the checkpoint references it, optionally
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason tbp.monty wouldn't be installed if using these plotting tools? Was this something you came across?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, tbp.plot uses a different uv environment that does not contain tbp.monty in it. One reason is the mismatch in python versions, tbp.plot uses python 3.13 (not 3.8). But also, ideally, we wouldn't want to depend on the tbp.monty codebase since everything we need is the log files and pretrained models.

In the future, I imagine it would be really cool to have visualizations that actually run a Monty episode step by step from Vedo. This would allow us to change parameters, swap/manipulate objects, move sensors, etc., between steps. At this point, we would have to install tbp.monty.

class StepMapper:
"""Bidirectional mapping between global step indices and (episode, local_step).
Global steps are defined as the concatenation of all local episode steps:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, did you manage to identify the cause of the issue where, after a jump-to-goal-state, the agent seemingly moves to a new location, while the sensory location remains un-updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, it seems like a problem on the logging side of tbp.monty. I'll look into it this week, shortcut ticket created.

}

self.step_mapper = step_mapper
self.current_episode = -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a significance to setting it to -1? Could it just be None? Seeing this value makes me nervous that there is some unexpected logic dependent on it 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, I get a little nervous when comparing None to int because I think python will error out and say that it cannot compare these two different types. I'm wrong, python is fine with it. I still do prefer to limit the number of types a variable can be (int vs int | None), but I guess that's just nitpicking on my side. I changed it to None in de62bdd9bea6.

patch_pos = self.data_parser.extract(
self._locators["patch_location"],
episode=str(episode_number),
step=step_number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that the agent-pose uses int(mapping[step_number]), while here we just use step_number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the agent_location locator is loaded from the motor_system logs, those are not filtered by which ones are processed by the LMs. So, I get the mask of which steps are processed first and use this mapping to extract the correct agent locations for the steps processed by the LM. The sensor locations come from the buffer, so we don't need this mapping since it only logs the ones processed by the LM.

ax_left.set_ylim(-1.0, 2.0)
ax_right.set_ylim(0, 10000)

# Burst locations (red dashed lines)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Burst locations (red dashed lines)
# Burst locations (violet dashed lines)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 54517032c4fb

"""WidgetOps implementation for the line plot.
This widget shows a line plot for the max global slope and hypothesis space size
over time. It also shows the sampling bursts locations as vertical dashed red lines.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
over time. It also shows the sampling bursts locations as vertical dashed red lines.
over time. It also shows the sampling bursts locations as vertical dashed violet lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 54517032c4fb

- Buttons to activate or deactivate the history of agent and/or patch locations.
- A plot of the pretrained model for the primary target with a button to show the
hypothesis space for this object.
- The hypothesis space pointcloud can be coloured by different metrics, such as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The hypothesis space pointcloud can be coloured by different metrics, such as
- The color-map of the hypothesis space pointcloud can reflect different metric values, such as

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 54517032c4fb

@ramyamounir
Copy link
Contributor Author

Great, thanks @nielsleadholm! I think I addressed your comments. Can you take another look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants