Downloads · 30 days
0
alpindale/Llama-2-7b-ONNX
Llama-2-7b-ONNX is a text generation model from alpindale. Use it when you need the model to write or continue text. The card lists the license as llama2.
This repository contains optimized version of Llama-2 7B.
Downloads · 30 days
0
Access
Public
Updated Sep 21, 2023
Repo size
81.4 GB
Likes
9
Public
Click a slice to open those files.
Other79.3 GB · 97%
From the Hugging Face model README
This repository contains optimized version of Llama-2 7B.
You can use huggingface_hub to download this repository. This can be done through both python
scripting and the commandline. Refer to the
HuggingFace Hub Documentation for
the Python examples.
With CLI:
huggingface_hub installed.pip install -U huggingface_hub
huggingface-cli download alpindale/Llama-2-7b-ONNX --repo-type model --cache-dir /path/to/custom/cache/directory --local-dir /path/to/download/dir --local-dir-use-symlinks False
The --cache-dir kwarg is only necessary if your default cache directory (~/.cache)
does not have enough disk space to accomodate the entire repository.
You can use the Gradio chat interface to run the models.
First, install the required packages:
pip install -r ChatApp/requirements.txt
Set the Python path to the root directory of the repository (necessary for importing the required modules):
export PYTHONPATH=$PYTHONPATH:$(pwd)
Then you can simply run:
python ChatApp/app.py
You can then navigate to http://localhost:7860 on your browser to access the interface.
The repository also provides example code for running the models.
python llama2_onnx_inference.py --onnx_file FP16/LlamaV2_7B_float16.onnx --embedding_file embeddings.pth --tokenizer_path tokenizer.model --prompt "What is the lightest element?"
Output:
The lightest element is hydrogen. Hydrogen is the lightest element on the periodic table, with an atomic mass of 1.00794 u (unified atomic mass units).
ONNX runtime execution provider might need to generate JIT binaries for the underlying hardware, typically the binary is cache and will be loaded directly in the subsequent runs to reduce the overhead.
Your device may not support native FP16 math, therefore weights will be cast to FP32 at runtime. Using the FP32 version of the model will avoid the cast overhead.
It's recommended that inputs/outputs are put on target device to avoid expensive data copies, please refer to the following documentations for details:
You can perform temperature and top-p sampling with the provided example code. Please refer to Meta's example here.