Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update viz tutorial to the new API #2289

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Update viz tutorial to the new API #2289

merged 1 commit into from
Sep 9, 2024

Conversation

Corvince
Copy link
Contributor

@Corvince Corvince commented Sep 9, 2024

Quick update to use the new SolaraViz Update. More updates to highlight more features should go into a separate PR, this is just to have it working again

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

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

Awesome!

SpaceGraph = make_space_matplotlib(agent_portrayal)
GiniPlot = make_plot_measure("Gini")

Maybe add a comment above these lines what’s exactly happening here.

@EwoutH EwoutH added the docs Release notes label label Sep 9, 2024
@EwoutH EwoutH added this to the v3.0 milestone Sep 9, 2024
@EwoutH EwoutH merged commit 5c70955 into main Sep 9, 2024
10 checks passed
@EwoutH
Copy link
Member

EwoutH commented Sep 9, 2024

Thanks!

@wang-boyu
Copy link
Member

Quick question: did the model in the viz tutorial run very slowly with the new Solara viz api, as compared with the previous implementation? @Corvince

Same thing happened for the mesa-geo intro tutorial model, when I try to update the tutorial to use the new api (projectmesa/mesa-geo#246).

@rht rht deleted the viz-tutorial-new-api branch September 17, 2024 20:55
@Corvince
Copy link
Contributor Author

Hmm I haven't noticed any significant performance degradations. Under some circumstances that I do not fully understand yet I experience it to be quite slow, but this has also happened to me with the old API. If there are any performance problems it will probably be due to the updates of the ModelController.

But I also think the frontend is too slow. But this seems to be mainly due to the used components. I tested displaying only the number of steps and this runs with several dozen steps/sec, so the solara stack doesn't seem to be the problem, mainly the space drawing is. Maybe this could somehow be optimized

@rht
Copy link
Contributor

rht commented Sep 19, 2024

I tested the viz tutorial on Colab with an intent to reproduce the slowness. Encountered another issue: it produced the Matplotlib output just fine, but the control buttons (play/pause/reset/reseed/...) are not rendered, and so I couldn't play the simulation to see whether it is the evolution that is slow or something else.

@Corvince
Copy link
Contributor Author

That's bad! I sometimes had the local issue that the ModelController had appeared after the main components. Maybe that's related. I will also investigate this on colab

@wang-boyu
Copy link
Member

Thanks for your reply @Corvince. I see that in the new Model controller, the entire model is converted to reactive, whereas previously a current_step counter is used. Could this potentially cause slowness, since we need to track the entire model object now?

Would you like to try this on your machine @rht ? Thanks for looking into this!

@rht
Copy link
Contributor

rht commented Sep 19, 2024

Would you like to try this on your machine @rht ? Thanks for looking into this!

Running locally, I was able to click the hamburger button, which then revealed the control buttons. And I confirm that each steps took 2-3 s, i.e. very slow for a simple Boltzmann wealth model.

@Corvince
Copy link
Contributor Author

Strange, i'll have to look at it from another laptop. Does this happen for both step and play/pause?

@rht
Copy link
Contributor

rht commented Sep 19, 2024

The step is much more immediate, sub 1 s response time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants