Open-Orca/SlimOrca
Viewer • Updated • 518k • 4.08k • 300
How to use parmanu-lcs2/Llama-3.1-6B-Instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="parmanu-lcs2/Llama-3.1-6B-Instruct", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("parmanu-lcs2/Llama-3.1-6B-Instruct", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("parmanu-lcs2/Llama-3.1-6B-Instruct", trust_remote_code=True, device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use parmanu-lcs2/Llama-3.1-6B-Instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "parmanu-lcs2/Llama-3.1-6B-Instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "parmanu-lcs2/Llama-3.1-6B-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/parmanu-lcs2/Llama-3.1-6B-Instruct
How to use parmanu-lcs2/Llama-3.1-6B-Instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "parmanu-lcs2/Llama-3.1-6B-Instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "parmanu-lcs2/Llama-3.1-6B-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "parmanu-lcs2/Llama-3.1-6B-Instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "parmanu-lcs2/Llama-3.1-6B-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use parmanu-lcs2/Llama-3.1-6B-Instruct with Docker Model Runner:
docker model run hf.co/parmanu-lcs2/Llama-3.1-6B-Instruct
This model is a pruned version of Meta-Llama-3.1-8B-Instruct, compressed using SNIPER (paper).
| Setting | Value |
|---|---|
| Pruning method | SNIPER (paper) |
| Target compression ratio | 25% |
| Parameters after pruning | 6,030,118,912 |
| Calibration data | slim_orca (50 samples × 512 tokens) |
LoRA fine-tuned on 2000 samples of SlimOrca after pruning. The LoRA adapters have been merged into the base weights.
| Setting | Value |
|---|---|
| Epochs | 1 |
| Context length | 1024 |
| Learning rate | 0.0002 |
| LoRA rank / alpha | 64 / 16 |
| LoRA target modules | up_proj, gate_proj, down_proj, q_proj, o_proj, k_proj, v_proj |
All pruning and fine-tuning was performed on an NVIDIA A100 GPU.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("parmanu-lcs2/Llama-3.1-6B-Instruct", trust_remote_code=True, dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("parmanu-lcs2/Llama-3.1-6B-Instruct")
trust_remote_code=True is required because pruning leaves layers with different shapes (and some attention/MLP blocks removed). This architecture is defined in the bundled modeling_pruned.py.
Meta-Llama-3.1-8B-Instruct