Git Product home page Git Product logo

llm-eval's Introduction

LLM Evaluation

Install

Install PyTorch nightly following these instructions.

pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121

You need PyTorch nightly and at least CUDA 12 to use the new torch.compile options. For whatever reason, PyTorch nightly doesn't work on CUDA 11.8 (see this issue). So you can use

  • Stable PyTorch + torch.compile on CUDA 11.8
  • PyTorch nightly with no compilation on CUDA 11.8 (--no-compile)
  • PyTorch nightly with torch.compile on CUDA 12

Download Data

MMLU

wget https://people.eecs.berkeley.edu/~hendrycks/data.tar
tar -xvf data.tar

Human Eval

git clone https://github.com/samuelstevens/human-eval.git
cd human-eval
pip install -e .

Download Models

You can use scripts/download.py to download models. But my research lab had HF Llama2 weights downloaded, so I ran:

python -m scripts.convert_hf_checkpoint \
  --input /research/nfs_su_809/huggingface_cache/models--meta-llama--Llama-2-7b-hf/snapshots/8cca527612d856d7d32bd94f8103728d614eb852/ \
  --name llama2-7b \
  --output /local/scratch/stevens.994/models/torch/llama2-7b

You can also copy the tokenizer to keep everything together.

cp \
  /research/nfs_su_809/huggingface_cache/models--meta-llama--Llama-2-7b-hf/snapshots/8cca527612d856d7d32bd94f8103728d614eb852/tokenizer.model \
  /local/scratch/stevens.994/models/torch/llama2-7b/

Quantize to use int8

python quantize.py \
  --ckpt_path /research/nfs_su_809/workspace/stevens.994/models/torch/llama2-7b-chat/model.pth \
  --model_name llama2-7b-chat \
  --mode int8

This saves a model_int8.pth checkpoint. Typically int8 has little to no performance degradations for language models.

Evaluate

python mmlu.py \
  --data /local/scratch/stevens.994/datasets/mmlu/data \
  --model_name llama2-7b \
  --model_path /local/scratch/stevens.994/models/torch/llama2-7b/model.pth
python humaneval.py \
  --model_name llava-7b-v1.5 \
  --model_path /research/nfs_su_809/workspace/stevens.994/models/torch/llava-7b-v1.5/model.pth \
  --max-new-tokens 1024 \
  --batch-size 24 \
  --samples-per-task 120 \
  --compile \
  --out results/human_eval/bf16

Then run

evaluate_functional_correctness results/human_eval/bf16/llava-7b-v1.5/results.jsonl --k 1,3,5,10

llm-eval's People

Contributors

samuelstevens avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.