cheng539539 / unity-ml-streamlit

Playing with Unity ML-Agents + Streamlit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity ML-Agents + Streamlit

Training:

  • Open the Unity project, and load "RollerAgentTrainingScene"
  • Run the Streamlit app: $ streamlit run app.py
  • Within the Streamlit app: press the "Train" button
  • Within Unity: Press Play
  • Press Stop in Unity to end training
  • The training results will be saved to results/RollerBall/RollerBall.nn
  • To use the results in Inference, copy the results file to Project/Assets/RollerAgentTutorial/RollerBall.nn, replacing the existing file.

Inference:

  • Don't run Streamlit
  • Just open the Unity scene and press Play.

Notes (11/18/2020)

  • streamlit_learn reimplements the mlagents-learn utility.
    • (mlagents/trainers/learn.py: main())
  • Need to update this whenever things change, annoyingly
  • What we want to do:
    • Create a single tensorflow session
    • When the app is re-run, reconnect if there's an existing session
    • Give the ability to interrupt that session
  • Create st.singleton, using state?

Notes

  • I always struggle with creating nice charts! Need to get more fluent at pd.DataFrame.
  • Not auto-rerunning when I change non-main modules. (Modifing mlas modules doesn't cause a rerun.)
  • Want to have just a single instance running. (I really want @st.singleton!)

TODO

  • A UI that actually explains what to do
  • Streamlit currently hangs when trying to stop, after training
  • Singleton state

Resources

About

Playing with Unity ML-Agents + Streamlit


Languages

Language:C# 91.8%Language:Python 4.1%Language:ShaderLab 4.1%