Remove solo pack benchmark/MLAgentBench (kept team contests only)
Browse files
benchmark/MLAgentBench/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
MIT License
|
| 2 |
-
|
| 3 |
-
Copyright (c) [year] [fullname]
|
| 4 |
-
|
| 5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
-
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
-
in the Software without restriction, including without limitation the rights
|
| 8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
-
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
-
furnished to do so, subject to the following conditions:
|
| 11 |
-
|
| 12 |
-
The above copyright notice and this permission notice shall be included in all
|
| 13 |
-
copies or substantial portions of the Software.
|
| 14 |
-
|
| 15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
benchmark/MLAgentBench/SOURCE_README.md
DELETED
|
@@ -1,138 +0,0 @@
|
|
| 1 |
-
# MLAgentBench: Evaluating Language Agents on Machine Learning Experimentation
|
| 2 |
-
|
| 3 |
-
MLAgentBench is a suite of end-to-end Machine Learning (ML) experimentation tasks for benchmarking AI agents, where the agent aims to take a given
|
| 4 |
-
dataset and a machine learning task description and autonomously develop or improve an ML model. Paper: https://arxiv.org/abs/2310.03302
|
| 5 |
-

|
| 6 |
-
|
| 7 |
-
Our AI agent in action on MLAgentBench:
|
| 8 |
-
[](https://youtu.be/s9NANrjLEZs)
|
| 9 |
-
|
| 10 |
-
Each task is an interactive environment that directly resembles what human researchers see,
|
| 11 |
-
where an agent can read available files, run multiple experiments on a compute cluster, and analyze results to achieve the specified research goal.
|
| 12 |
-
Specifically, we include 13 diverse ML engineering tasks,
|
| 13 |
-
achievable by trying different machine learning methods, data processing, architectures, training processes, etc:
|
| 14 |
-

|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# Setup
|
| 18 |
-
|
| 19 |
-
The MLAgentBench package can be installed with
|
| 20 |
-
```
|
| 21 |
-
pip install -e .
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-
Install dependencies with python 3.10 by running
|
| 25 |
-
```
|
| 26 |
-
bash install.sh
|
| 27 |
-
```
|
| 28 |
-
or use our [docker image](https://hub.docker.com/layers/qhwang123/researchassistant/latest/images/sha256-6b3690a13ba44fd089086e9860a298ed49a179d9a04a5406c0df074569a3aabe?context=repo). Since agent will modify and execute files, we recommend running experiments within sandboxes such as docker container.
|
| 29 |
-
For docker, use the following instructions:
|
| 30 |
-
1. Pull the docker image:
|
| 31 |
-
```
|
| 32 |
-
docker pull qhwang123/researchassistant:latest
|
| 33 |
-
```
|
| 34 |
-
2. Run the docker container from the image, mounting the current directory to `/MLAgentBench` inside the container with root user permissions to install other packages:
|
| 35 |
-
- On Windows PowerShell
|
| 36 |
-
```
|
| 37 |
-
docker run -it --user root -v ${PWD}:/MLAgentBench -w /MLAgentBench qhwang123/researchassistant:latest
|
| 38 |
-
```
|
| 39 |
-
- On Mac or Linux
|
| 40 |
-
```
|
| 41 |
-
docker run -it --user root -v "$(pwd)":/MLAgentBench -w /MLAgentBench qhwang123/researchassistant:latest
|
| 42 |
-
```
|
| 43 |
-
|
| 44 |
-
Each dataset will be prepared when it is run the first time. You can also prepare them beforehand with
|
| 45 |
-
```
|
| 46 |
-
python -u -m MLAgentBench.prepare_task <task_name> $(which python)
|
| 47 |
-
```
|
| 48 |
-
For Kaggle datasets, you need to set up Kaggle API and authentication (~/.kaggle/kaggle.json) as described [here](https://www.kaggle.com/docs/api). You may also need to provide manual consent to the rules of specific competitions by following the prompts. For docker, use the following instructions:
|
| 49 |
-
1. Ensure that you have ".kaggle/kaggle.json" with your API credentials in the MLAgentBench root folder.
|
| 50 |
-
2. Once your container is mounted (instructions above), run
|
| 51 |
-
```
|
| 52 |
-
export KAGGLE_CONFIG_DIR=/MLAgentBench/.kaggle
|
| 53 |
-
pip install kaggle
|
| 54 |
-
sudo apt-get install unzip
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
Finally, put API keys under the root directory of this repo (or wherever you run scripts from). Currently, we support OpenAI (openai_api_key.txt in the format of organization:APIkey), Claude (claude_api_key.txt), and CRFM API (crfm_api_key.txt). To use an AutoGPT agent, setup the directory as described [here](https://docs.agpt.co/setup/).
|
| 58 |
-
|
| 59 |
-
Update: We support gemini pro and huggingface now! To run gemini, fill in PROJECT_ID in LLM.py to your project id. To run huggingface, specifiy model as huggingface/<org name>/<model name>.
|
| 60 |
-
|
| 61 |
-
# Quick Start
|
| 62 |
-
|
| 63 |
-
To run our research agent on cifar10 task with openai API using gpt-4 and gpt-3.5-turbo:
|
| 64 |
-
|
| 65 |
-
```
|
| 66 |
-
python -u -m MLAgentBench.runner --python $(which python) --task cifar10 --device 0 --log-dir first_test --work-dir workspace --llm-name gpt-4 --edit-script-llm-name gpt-4 --fast-llm-name gpt-3.5-turbo > first_test/log 2>&1
|
| 67 |
-
```
|
| 68 |
-
|
| 69 |
-
Note: capturing log is necessary for oom error etc runtime error detection.
|
| 70 |
-
|
| 71 |
-
This will produce logs in `first_test` directory with the following structure
|
| 72 |
-
```
|
| 73 |
-
first_test/
|
| 74 |
-
agent_log/
|
| 75 |
-
main_log # main log showing agent's research process
|
| 76 |
-
agent_*.json # saved agent states
|
| 77 |
-
...
|
| 78 |
-
env_log/
|
| 79 |
-
tool_logs/
|
| 80 |
-
traces/ # snap shots of the agent workspace
|
| 81 |
-
trace.json # interaction trace of the agent
|
| 82 |
-
overall_time.txt # overall time
|
| 83 |
-
error.txt # will be generated if there is a system error
|
| 84 |
-
```
|
| 85 |
-
|
| 86 |
-
If llm names are not specified in the args, we use claude-v1 model by default for all LLM calls. See example logs with GPT-4 over cifar10 [here](https://drive.google.com/drive/folders/1Ozy_zKYdvwcSq3EFnkaudgUXKJmBwQ5t?usp=drive_link).
|
| 87 |
-
|
| 88 |
-
# Evaluation
|
| 89 |
-
|
| 90 |
-
To run evaluation:
|
| 91 |
-
```
|
| 92 |
-
python -m MLAgentBench.eval --log-folder <log_folder> --task <task_name> --output-file <output_name>
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
This will evaluate all runs under <log_folder> as a json.
|
| 96 |
-
|
| 97 |
-
To run baseline, run the trivial policy of directly running train.py then submit with ``--agent_type Agent`` as in baseline.sh:
|
| 98 |
-
|
| 99 |
-
```
|
| 100 |
-
python -u -m MLAgentBench.runner --python $(which python) --task cifar10 --device 0 --log-dir first_test --work-dir workspace --agent_type Agent
|
| 101 |
-
```
|
| 102 |
-
|
| 103 |
-
Finally, to reproduce plots with jsons genereated, run plot.py in MLAgentBench.
|
| 104 |
-
|
| 105 |
-
# Workflow
|
| 106 |
-
|
| 107 |
-
To run the benchmark systematically, we recommend the following workflow:
|
| 108 |
-
|
| 109 |
-
1. Run parallel experiments over different tasks and different agents using `run_experiments.sh`. This will generate log folders in structure of final_exp_logs/<model_name>/<run_timestamp>/...
|
| 110 |
-
2. Run baseline.sh on all tasks to provide baselines.
|
| 111 |
-
2. Run eval.sh with properly specified models and tasks to generate evaluation jsons, including baselines.
|
| 112 |
-
3. Use plot.py in MLAgentBench to analyze the results. Note you need to fix some paths and names in the file as marked with TODO.
|
| 113 |
-
|
| 114 |
-
# Tasks
|
| 115 |
-
|
| 116 |
-
Each task is a folder in `MLAgentBench/benchmarks/`, under which the `env/` folder contains files that the research agent will see at the beginning, and `script/` folder contains additional hidden files such as `prepare.py` for downloading data and `eval.py` for evaluation.
|
| 117 |
-
|
| 118 |
-
# Agents
|
| 119 |
-
|
| 120 |
-
We currently support variants of our research agent along with langchain and autogpt agents. See `run_experiments.sh` for their commands.
|
| 121 |
-
|
| 122 |
-
# Results
|
| 123 |
-
Success Rate, i.e. the percentages of runs that achieve more than 10% improvement at the
|
| 124 |
-
last step over the average performance of the baseline in starter code:
|
| 125 |
-

|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
Average Improvement over the baseline in starter code among the runs that made a valid
|
| 130 |
-
submission at the last step:
|
| 131 |
-

|
| 132 |
-
|
| 133 |
-
See all logs here: https://github.com/q-hwang/MLAgentBench_logs
|
| 134 |
-
|
| 135 |
-
# Interactive Mode (Under construction)
|
| 136 |
-
|
| 137 |
-
You can also specify tasks interactively to the research agent by running `research_agent_interactive.sh`, or ideally as a vscode extension.
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|