MLSysOps / MLE-agent

MLE-Agent is designed to be a pair coding agent for machine learning engineers and researchers. Support OpenAI and Ollama.
MIT License
16 stars 1 forks source link

Is the code execution and reflectiona necessary step? #57

Closed huangyz0918 closed 4 weeks ago

huangyz0918 commented 1 month ago

An interesting log:

(mle) ➜  MLE-agent git:(feat/web) mle start
[23:35:12] Step 1: User requirements understanding                         tech_leader.py:85
           User Requirement: I want to train a sentiment analysis model    tech_leader.py:87
           Step 2: Data quick review                                      tech_leader.py:102
           Data source: IMDb movie reviews                                tech_leader.py:121
           Step 3: Task & Model selection                                 tech_leader.py:129
           Step 5: Code generation                                        tech_leader.py:188
[23:35:13] Will install the following dependencies: ['torch',              setup_agent.py:64
           'torchmetrics']
? Are you sure to install the dependencies? No
[23:35:16] Skipped the dependencies installation.                          setup_agent.py:71
[23:35:16] Step 6: Code execution and reflection                          tech_leader.py:199
Running command: python sentiment_analysis_model_training.py
Error:   File "/Users/huangyz0918/Desktop/test/sentiment_analysis_model_training.py", line 2
Error:     !pip install torch torchmetrics
Error:     ^
Error: SyntaxError: invalid syntax
[23:35:16] Web search is disabled.                                        search_agent.py:17
[23:35:16] Debugging the code script...                                  reflect_agent.py:90
           Code generated to:                                               base_agent.py:43
           /Users/huangyz0918/Desktop/test/sentiment_analysis_model_trainin
           g.py
╭─────────────────────────────────────── MLE-Agent ────────────────────────────────────────╮
│ Code:                                                                                    │
│                                                                                          │
│                                                                                          │
│  # Install the required libraries                                                        │
│  !pip install torch torchmetrics                                                         │
│                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
Running command: python sentiment_analysis_model_training.py
Error:   File "/Users/huangyz0918/Desktop/test/sentiment_analysis_model_training.py", line 2
Error:     !pip install torch torchmetrics
Error:     ^
Error: SyntaxError: invalid syntax
           Debugging the code script...                                  reflect_agent.py:90
[23:35:17] Code generated to:                                               base_agent.py:43
           /Users/huangyz0918/Desktop/test/sentiment_analysis_model_trainin
           g.py
╭─────────────────────────────────────── MLE-Agent ────────────────────────────────────────╮
│ Code:                                                                                    │
│                                                                                          │
│                                                                                          │
│  # Install the required libraries                                                        │
│  !pip install torch torchmetrics                                                         │
│                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
Running command: python sentiment_analysis_model_training.py
Error:   File "/Users/huangyz0918/Desktop/test/sentiment_analysis_model_training.py", line 2
Error:     !pip install torch torchmetrics
Error:     ^
Error: SyntaxError: invalid syntax
           Debugging the code script...                                  reflect_agent.py:90
[23:35:18] Code generated to:                                               base_agent.py:43
           /Users/huangyz0918/Desktop/test/sentiment_analysis_model_trainin
           g.py
╭─────────────────────────────────────── MLE-Agent ────────────────────────────────────────╮
│ Code:                                                                                    │
│                                                                                          │
│                                                                                          │
│  # Install the required libraries                                                        │
│  !pip install torch torchmetrics                                                         │
│                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
Running command: python sentiment_analysis_model_training.py
Error:   File "/Users/huangyz0918/Desktop/test/sentiment_analysis_model_training.py", line 2
Error:     !pip install torch torchmetrics
Error:     ^
Error: SyntaxError: invalid syntax
           Debugging failed after 3 attempts.

I think after the code generation, we can ask the user if they wish to conduct the execution and reflection (step 6), I think some user don't want to run the generated scripts immediately, and some of the senior MLEs maybe just want to look at the generated content and gather some insights.

HuaizhengZhang commented 1 month ago

yes. let me decouple this to two steps and allow users to decide if they need to execute.