LLaMA: Open and Efficient Foundation Language Models
Paper • 2302.13971 • Published • 25
How to use sardukar/llama13b-4bit-v2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="sardukar/llama13b-4bit-v2") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("sardukar/llama13b-4bit-v2")
model = AutoModelForCausalLM.from_pretrained("sardukar/llama13b-4bit-v2", device_map="auto")How to use sardukar/llama13b-4bit-v2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "sardukar/llama13b-4bit-v2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "sardukar/llama13b-4bit-v2",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/sardukar/llama13b-4bit-v2
How to use sardukar/llama13b-4bit-v2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "sardukar/llama13b-4bit-v2" \
--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": "sardukar/llama13b-4bit-v2",
"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 "sardukar/llama13b-4bit-v2" \
--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": "sardukar/llama13b-4bit-v2",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use sardukar/llama13b-4bit-v2 with Docker Model Runner:
docker model run hf.co/sardukar/llama13b-4bit-v2
Quantized Meta AI's LLaMA in 4bit with the help of GPTQ algorithm v2.
Conversion process:
CUDA_VISIBLE_DEVICES=0 python llama.py ./llama-13b c4 --wbits 4 --true-sequential --act-order --groupsize 128 --save_safetensors ./q4/llama13b-4bit-ts-ao-g128-v2.safetensors
Note: This model will fail to load with current GPTQ-for-LLaMa implementation
Conversion process
CUDA_VISIBLE_DEVICES=0 python llama.py ./llama-13b c4 --wbits 4 --true-sequential --act-order --save_safetensors ./q4/llama13b-4bit-v2.safetensors