Skip to main content

LITA

LLM Integrated Testing & Analysis Framework

Lita is a comprehensive testing and analysis framework for Large Language Models (LLMs), designed to provide an integrated environment for efficient execution, benchmarking, and profiling.

Key Features:

  • Multi-Framework Support: Run models on various execution backends, including vLLM, Hugging Face (HF), and ONNX Runtime (ORT).
  • Performance Profiling: Collect detailed execution metrics using built-in profilers like vllmprof.

Lita is designed to help researchers and developers evaluate and optimize LLM workloads across different execution environments, enabling seamless integration into existing machine learning workflows.

Installation (Development)

To set up the development environment, use the following commands:

pip install -e .
pip install torch==2.6.0, torchvision
pip uninstall onnxruntime onnxruntime-gpu
pip install onnxruntime-gpu==1.19

Ensure that PyTorch version 2.6.0 or later is installed.

Setting Cache Directory

Before running the Lita framework, you can configure the cache directory by setting environment variables. Add the following lines to your .bashrc (or .bash_profile for macOS):

export LITA_CACHE="your_cache_path"
export HF_HOME=$LITA_CACHE

Apply the changes by running:

source ~/.bashrc  # or source ~/.bash_profile

Now, Lita will use the specified cache directory.

Usage

1. Running Models with Different Frameworks

Lita supports executing models on various frameworks such as vLLM, Hugging Face (HF), and ONNX Runtime (ORT).

from lita import Lita
import time

model_name = "meta-llama/Llama-3.2-3B-Instruct"

for mode in ["vllm", "hf", "ort"]:
    mm = Lita(model_name, mode)
    output_str = mm.generate('hello')
    print(f"Generation output: {output_str}")

2. Performance Measurement

Lita provides built-in performance profiling using vLLM Profiler (vllmprof).

from lita import Lita
import time

model_name = "meta-llama/Llama-3.2-3B-Instruct"
mode = "hf"

mm = Lita(model_name, mode, perf='vllmprof')
output_str = mm.generate('hello')

print(output_str)
print(mm.metric.summary())

This script runs the model in hf mode while enabling performance profiling with vllmprof. After text generation, it prints the output along with detailed performance metrics.

3. Benchmark Test

Lita provides built-in benchmarking capabilities for evaluating model performance on standardized datasets. The following script demonstrates running a benchmark using the MMLU dataset.

from lita import Lita
from lita.benchmark.mmlu import MMLUDataLoader
from lita.benchmark.commons import run_benchmark, extract_choice
from lita.utils import get_system_info
import json

mmlu_ = MMLUDataLoader(n_shots=5)

model_name = "meta-llama/Llama-3.2-3B-Instruct"
model = Lita(model_name, "hf", perf="time")
        
log = run_benchmark(mmlu_, model, 1, extract_fn=extract_choice)

json_log_data = {
    "system_info": get_system_info(),
    "model_info": model.get_configs(),
    "benchmark_data": log
}
with open("examples/mmlu_log.json", "w", encoding="utf-8") as f:
    json.dump(json_log_data, f, indent=4, ensure_ascii=False)

This script performs an MMLU benchmark test by loading the dataset, running the model using transformers, and measuring performance at the simple time. The results, including system specifications and model configuration, are saved in examples/mmlu_log.json for further analysis.

Metadata

Release files for lita 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lita 0.0.7
File Size Uploaded
lita-0.0.7.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lita 0.0.7
File Interpreter ABI Platform
lita-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 23.2 kB

Release files / lita-0.0.7.tar.gz

Download URL lita-0.0.7.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
503b489750ad1986499b4c5c394a59710a19f977b9999d026c5822b86b88dabf
BLAKE2b-256 checksum
How to use checksums
a8e1958f272300f103724cc8105259b0b7995b29226dff72f68793b020b84098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / lita-0.0.7-py3-none-any.whl

Download URL lita-0.0.7-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33acb4818c7b174092820eab98e993d6d0f4f584b8ded7c95389366e3554c9aa
BLAKE2b-256 checksum
How to use checksums
8177bb4a152c0d14331315946caa864530219cf9c6071480b19079020237f195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page