Efficient Large Language Model
Collection
Shortened LLMs from Depth Pruning; https://github.com/Nota-NetsPresso/shortened-llm • 14 items • Updated • 3
How to use nota-ai/st-vicuna-v1.3-5.5b-ppl with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="nota-ai/st-vicuna-v1.3-5.5b-ppl") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("nota-ai/st-vicuna-v1.3-5.5b-ppl")
model = AutoModelForMultimodalLM.from_pretrained("nota-ai/st-vicuna-v1.3-5.5b-ppl")How to use nota-ai/st-vicuna-v1.3-5.5b-ppl with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "nota-ai/st-vicuna-v1.3-5.5b-ppl"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "nota-ai/st-vicuna-v1.3-5.5b-ppl",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/nota-ai/st-vicuna-v1.3-5.5b-ppl
How to use nota-ai/st-vicuna-v1.3-5.5b-ppl with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "nota-ai/st-vicuna-v1.3-5.5b-ppl" \
--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": "nota-ai/st-vicuna-v1.3-5.5b-ppl",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "nota-ai/st-vicuna-v1.3-5.5b-ppl" \
--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": "nota-ai/st-vicuna-v1.3-5.5b-ppl",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use nota-ai/st-vicuna-v1.3-5.5b-ppl with Docker Model Runner:
docker model run hf.co/nota-ai/st-vicuna-v1.3-5.5b-ppl
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Shortened LLaMA is a depth-pruned version of LLaMA models & variants for efficient text generation.
After identifying unimportant Transformer blocks, we perform one-shot pruning and light LoRA-based retraining.
| Source Model |
Pruning Ratio |
Pruning Criterion |
HF Models Link |
|---|---|---|---|
| LLaMA-1-7B | 20% | PPL | nota-ai/st-llama-1-5.5b-ppl |
| LLaMA-1-7B | 20% | Taylor+ | nota-ai/st-llama-1-5.5b-taylor |
| Vicuna-v1.3-7B | 20% | PPL | nota-ai/st-vicuna-v1.3-5.5b-ppl |
| Vicuna-v1.3-7B | 20% | Taylor+ | nota-ai/st-vicuna-v1.3-5.5b-taylor |
| Vicuna-v1.3-13B | 21% | PPL | nota-ai/st-vicuna-v1.3-10.5b-ppl |
| Vicuna-v1.3-13B | 21% | Taylor+ | nota-ai/st-vicuna-v1.3-10.5b-taylor |
@article{kim2024shortened,
title={Shortened LLaMA: A Simple Depth Pruning for Large Language Models},
author={Kim, Bo-Kyeong and Kim, Geonmin and Kim, Tae-Ho and Castells, Thibault and Choi, Shinkook and Shin, Junho and Song, Hyoung-Kyu},
journal={arXiv preprint arXiv:2402.02834},
year={2024},
url={https://arxiv.org/abs/2402.02834}
}
@article{kim2024mefomo,
title={Shortened LLaMA: A Simple Depth Pruning for Large Language Models},
author={Kim, Bo-Kyeong and Kim, Geonmin and Kim, Tae-Ho and Castells, Thibault and Choi, Shinkook and Shin, Junho and Song, Hyoung-Kyu},
journal={ICLR Workshop on Mathematical and Empirical Understanding of Foundation Models (ME-FoMo)},
year={2024},
url={https://openreview.net/forum?id=18VGxuOdpu}
}