Skip to main content

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

  1. Run pip install llama-text2sql-eval to install the library.

  2. 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 ../..
  1. Get your Llama API key here and set up an environment variable:
export LLAMA_API_KEY="your_key_here"
  1. Create a Python script and run it:
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}%")

This will take about 40 minutes to run. After it completes, you should see something like:

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

llama_text2sql_eval-0.0.3.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_text2sql_eval-0.0.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file llama_text2sql_eval-0.0.3.tar.gz.

File metadata

  • Download URL: llama_text2sql_eval-0.0.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for llama_text2sql_eval-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fb237abfa2d5e1c6a906f05c5094d6839560cd74b1c94638324bb608dbe3c48d
MD5 9fb5cf0c38f062bcd6ae2172dd2c1e0e
BLAKE2b-256 84c8f5c51ea5de543a829c3d9bd97e3018b3c5e28264f51b4ffe1d111c896936

See more details on using hashes here.

File details

Details for the file llama_text2sql_eval-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_text2sql_eval-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7891bbe87281346f8d4685d1a3cdbad77b49b76fdeb9a1dc965745bf894b7f8e
MD5 a73107c475988885f7a092de5e8c8cc5
BLAKE2b-256 26b78f0b9e4697763fdeddeacb14f50c07df4da1e1f26b5527dd5b398de212b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page