Instructions to use princeton-nlp/Sheared-LLaMA-2.7B-Pruned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use princeton-nlp/Sheared-LLaMA-2.7B-Pruned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="princeton-nlp/Sheared-LLaMA-2.7B-Pruned")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("princeton-nlp/Sheared-LLaMA-2.7B-Pruned") model = AutoModelForCausalLM.from_pretrained("princeton-nlp/Sheared-LLaMA-2.7B-Pruned") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use princeton-nlp/Sheared-LLaMA-2.7B-Pruned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "princeton-nlp/Sheared-LLaMA-2.7B-Pruned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "princeton-nlp/Sheared-LLaMA-2.7B-Pruned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/princeton-nlp/Sheared-LLaMA-2.7B-Pruned
- SGLang
How to use princeton-nlp/Sheared-LLaMA-2.7B-Pruned 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 "princeton-nlp/Sheared-LLaMA-2.7B-Pruned" \ --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": "princeton-nlp/Sheared-LLaMA-2.7B-Pruned", "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 "princeton-nlp/Sheared-LLaMA-2.7B-Pruned" \ --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": "princeton-nlp/Sheared-LLaMA-2.7B-Pruned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use princeton-nlp/Sheared-LLaMA-2.7B-Pruned with Docker Model Runner:
docker model run hf.co/princeton-nlp/Sheared-LLaMA-2.7B-Pruned
license: llama2
Paper: https://arxiv.org/pdf/2310.06694.pdf
Code: https://github.com/princeton-nlp/LLM-Shearing
Models: Sheared-LLaMA-1.3B, Sheared-LLaMA-2.7B
Pruned Models without Continued Pre-training: Sheared-LLaMA-1.3B-Pruned, Sheared-LLaMA-2.7B-Pruned
Instruction-tuned Models: Sheared-LLaMA-1.3B-ShareGPT, Sheared-LLaMA-2.7B-ShareGPT
License: Must comply with license of Llama2 since it's a model derived from Llama2.
Sheared-LLaMA-2.7B-Pruned is the model pruned from meta-llama/Llama-2-7b-hf without continued pre-training. We used roughly 0.4B tokens to perform the pruning experiment. This model could be a good use to study
- effective data mixtures for continued pre-training
- comparisons to other pruning techniques
- extensive evaluations to understand how pruning affects knowledge and reasoning capabilities of LLMs
- Downloads last month
- 4