Skip to content

Commit 70d6722

Browse files
[BFCL] Package the Codebase (#565)
This PR aims to improve the organization and distribution of the codebase by packaging the BFCL codebase. This PR is part of a series of changes that break down the tasks outlined in #510. --------- Co-authored-by: Huanzhi Mao <[email protected]>
1 parent 3850c2b commit 70d6722

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+175
-135
lines changed

berkeley-function-call-leaderboard/README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,34 @@ We introduce the Berkeley Function Leaderboard (BFCL), the **first comprehensive
1212
Read more about the technical details and interesting insights in our [blog post](https://gorilla.cs.berkeley.edu/blogs/8_berkeley_function_calling_leaderboard.html)!
1313

1414
![image](./architecture_diagram.png)
15+
16+
1517
### Install Dependencies
1618

1719
```bash
20+
# Create a new Conda environment with Python 3.10
1821
conda create -n BFCL python=3.10
22+
23+
# Activate the new environment
1924
conda activate BFCL
20-
pip install -r requirements.txt # Inside gorilla/berkeley-function-call-leaderboard
21-
pip install vllm==0.5.0 # If you have vLLM supported GPU(s) and want to run our evaluation data against self-hosted OSS models.
25+
26+
# Clone the Gorilla repository
27+
git clone https://github.com/ShishirPatil/gorilla.git
28+
29+
# Change directory to the berkeley-function-call-leaderboard
30+
cd gorilla/berkeley-function-call-leaderboard
31+
32+
# Install the package in editable mode
33+
pip install -e .
2234
```
2335

36+
### Installing Extra Dependencies for Self-Hosted Open Source Models
37+
38+
To do LLM generation on self-hosted open source models, you need to run the following command to install the extra dependencies.
39+
```bash
40+
pip install -e .[oss_eval]
41+
```
42+
Note that this requires GPU supported by vLLM and it can only be installed on Linux and Windows (not Mac).
2443

2544
## Execution Evaluation Data Post-processing (Can be Skipped: Necesary for Executable Test Categories)
2645
Add your keys into `function_credential_config.json`, so that the original placeholder values in questions, params, and answers will be reset.
@@ -189,7 +208,7 @@ In the following two sections, the optional `--test-category` parameter can be u
189208

190209
### Running the Checker
191210

192-
Navigate to the `gorilla/berkeley-function-call-leaderboard/eval_checker` directory and run the `eval_runner.py` script with the desired parameters. The basic syntax is as follows:
211+
Navigate to the `gorilla/berkeley-function-call-leaderboard/bfcl/eval_checker` directory and run the `eval_runner.py` script with the desired parameters. The basic syntax is as follows:
193212

194213
```bash
195214
python eval_runner.py --model MODEL_NAME --test-category TEST_CATEGORY

berkeley-function-call-leaderboard/apply_function_credential_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import argparse
44
import os
5-
from eval_checker import custom_exception
5+
from bfcl.eval_checker import custom_exception
66

77
parser = argparse.ArgumentParser(description="Replace placeholders in the function credential config file.")
88
parser.add_argument("--input-path", help="Path to the function credential config file. Can be a file or a directory.")

berkeley-function-call-leaderboard/bfcl/__init__.py

Whitespace-only changes.

berkeley-function-call-leaderboard/bfcl/eval_checker/__init__.py

Whitespace-only changes.

berkeley-function-call-leaderboard/eval_checker/checker.py renamed to berkeley-function-call-leaderboard/bfcl/eval_checker/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from model_handler.constant import (
1+
from bfcl.model_handler.constant import (
22
UNDERSCORE_TO_DOT,
33
JAVA_TYPE_CONVERSION,
44
JS_TYPE_CONVERSION,

berkeley-function-call-leaderboard/eval_checker/eval_runner.py renamed to berkeley-function-call-leaderboard/bfcl/eval_checker/eval_runner.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import sys
2-
3-
sys.path.append("../")
4-
51
from checker import ast_checker, exec_checker, executable_checker_rest
62
from custom_exception import BadAPIStatusError
73
from eval_runner_helper import *
@@ -440,10 +436,10 @@ def runner(model_names, test_categories, api_sanity_check):
440436
)
441437

442438

443-
INPUT_PATH = "../result/"
444-
PROMPT_PATH = "../data/"
445-
POSSIBLE_ANSWER_PATH = "../data/possible_answer/"
446-
OUTPUT_PATH = "../score/"
439+
INPUT_PATH = "../../result/"
440+
PROMPT_PATH = "../../data/"
441+
POSSIBLE_ANSWER_PATH = "../../data/possible_answer/"
442+
OUTPUT_PATH = "../../score/"
447443

448444
# A dictionary to store the results
449445
# Key is model name, value is a dictionary with keys as test category and values as a dictionary with accuracy and total count

0 commit comments

Comments
 (0)