A Quick Library for Llama Text2SQL Accuracy Evaluation
This library provides a simple interface for evaluating the accuracy of Llama models on the Text2SQL task. It uses the BIRD DEV dataset and provides a simple API for running the evaluation pipeline using the Llama API.
Quick Start
-
Run
pip install llama-text2sql-evalto install the library. -
Download the BIRD DEV dataset by running the following commands:
mkdir -p llama-text2sql-eval/data
cd llama-text2sql-eval/data
wget https://bird-bench.oss-cn-beijing.aliyuncs.com/dev.zip
unzip dev.zip
rm dev.zip
rm -rf __MACOSX
cd dev_20240627
unzip dev_databases.zip
rm dev_databases.zip
rm -rf __MACOSX
cd ../..
- Get your Llama API key here and set up an environment variable:
export LLAMA_API_KEY="your_key_here"
- Run the eval with one of the two options:
Option A:
llama-text2sql-eval --model Llama-3.3-8B-Instruct
Option B:
Save the following code to a file named run.py, then python run.py:
import os
from llama_text2sql_eval import LlamaText2SQLEval
evaluator = LlamaText2SQLEval()
results = evaluator.run(
model="Llama-3.3-70B-Instruct", # or any other Llama models supported by the Llama API
api_key=os.getenv("LLAMA_API_KEY")
)
if results:
print(f"Overall Accuracy: {results['overall_accuracy']:.2f}%")
print(f"Simple: {results['simple_accuracy']:.2f}%")
print(f"Moderate: {results['moderate_accuracy']:.2f}%")
print(f"Challenging: {results['challenging_accuracy']:.2f}%")
Running the eval will take about 40 minutes to complete. You should see something like at the end of the run:
Overall Accuracy: 57.95%
Simple: 65.30%
Moderate: 47.63%
Challenging: 44.14%
Metadata
Release files for llama-text2sql-eval 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_text2sql_eval-0.0.4.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_text2sql_eval-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / llama_text2sql_eval-0.0.4.tar.gz
| Download URL | llama_text2sql_eval-0.0.4.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbc4b1e0b82fbd673a0612d0c05d346b9c5b346f8090be9043585f8bd5281db6
|
|
BLAKE2b-256 checksum How to use checksums |
ad09ec5febb85562b2f67d411eb7d4222617834cb1d0acd5e837dfd93cb347aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / llama_text2sql_eval-0.0.4-py3-none-any.whl
| Download URL | llama_text2sql_eval-0.0.4-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
808a730888c2b5e59cc9a9c39a7feb9a3828155cbda376a8dce69d3ef402132a
|
|
BLAKE2b-256 checksum How to use checksums |
66a743d172be1203c9007ad33468dca322b54b8feb6787c8ac8a222ba6070f5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|