A Quick Llama Text2SQL Evaluation Library
Project description
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%
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_text2sql_eval-0.0.4.tar.gz.
File metadata
- Download URL: llama_text2sql_eval-0.0.4.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbc4b1e0b82fbd673a0612d0c05d346b9c5b346f8090be9043585f8bd5281db6
|
|
| MD5 |
eb07dc3a6a3067bd7ac41f3b3135b4a6
|
|
| BLAKE2b-256 |
ad09ec5febb85562b2f67d411eb7d4222617834cb1d0acd5e837dfd93cb347aa
|
File details
Details for the file llama_text2sql_eval-0.0.4-py3-none-any.whl.
File metadata
- Download URL: llama_text2sql_eval-0.0.4-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
808a730888c2b5e59cc9a9c39a7feb9a3828155cbda376a8dce69d3ef402132a
|
|
| MD5 |
e260d28d801620e9ac8c1b0c8d99a2a9
|
|
| BLAKE2b-256 |
66a743d172be1203c9007ad33468dca322b54b8feb6787c8ac8a222ba6070f5f
|