Instructions to use ahxt/LiteLlama-460M-1T with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ahxt/LiteLlama-460M-1T with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ahxt/LiteLlama-460M-1T")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ahxt/LiteLlama-460M-1T") model = AutoModelForCausalLM.from_pretrained("ahxt/LiteLlama-460M-1T") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ahxt/LiteLlama-460M-1T with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ahxt/LiteLlama-460M-1T" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ahxt/LiteLlama-460M-1T
- SGLang
How to use ahxt/LiteLlama-460M-1T with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ahxt/LiteLlama-460M-1T" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ahxt/LiteLlama-460M-1T" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ahxt/LiteLlama-460M-1T with Docker Model Runner:
docker model run hf.co/ahxt/LiteLlama-460M-1T
LiteLlama: Reduced-Scale Llama
We present an open-source reproduction of Meta AI's LLaMa 2. However, with significantly reduced model sizes, LiteLlama-460M-1T has 460M parameters trained with 1T tokens.
Dataset and Tokenization
We train our models on part of RedPajama dataset. We use the GPT2Tokenizer to tokenize the text.
Training Details
The model was trained with ~1T tokens (0.98T). num of tokens = stepslengthbatch_size=4996791024192=98240888832β0.98T.
The training curve is at this WandB project.
Using with HuggingFace Transformers
The experimental checkpoints can be directly loaded by Transformers library. The following code snippet shows how to load the our experimental model and generate text with it.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_path = 'ahxt/LiteLlama-460M-1T'
model = AutoModelForCausalLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
model.eval()
prompt = 'Q: What is the largest bird?\nA:'
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
tokens = model.generate(input_ids, max_length=20)
print( tokenizer.decode(tokens[0].tolist(), skip_special_tokens=True) )
# Q: What is the largest bird?\nA: The largest bird is a black-headed gull.
Evaluation
We evaluate our models on the MMLU task.
| Models | #parameters | zero-shot | 5-shot |
|---|---|---|---|
| llama | 7B | 28.46 | 35.05 |
| openllama | 3B | 24.90 | 26.71 |
| TinyLlama-1.1B-step-50K-105b | 1.1B | 19.00 | 26.53 |
| LiteLlama-460M-1T | 0.46B | 21.13 | 26.39 |
Open LLM Leaderboard Evaluation Results
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 26.65 |
| ARC (25-shot) | 24.91 |
| HellaSwag (10-shot) | 38.47 |
| MMLU (5-shot) | 26.17 |
| TruthfulQA (0-shot) | 41.59 |
| Winogrande (5-shot) | 49.88 |
| GSM8K (5-shot) | 0.0 |
| DROP (3-shot) | 5.51 |
Contact
This model was developed by Xiaotian Han from Texas A&M University at the DATA Lab under the supervision of Prof. Xia "Ben" Hu, and the model is released under MIT License.
- Downloads last month
- 1,225
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "ahxt/LiteLlama-460M-1T"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahxt/LiteLlama-460M-1T", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'