SQFT
Collection
SQFT Models (SQFT: Low-cost Model Adaptation in Low-precision Sparse Foundation
Models) • 57 items • Updated • 2
How to use IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu")
model = AutoModelForCausalLM.from_pretrained("IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu", device_map="auto")How to use IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu
How to use IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu" \
--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": "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu",
"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 "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu" \
--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": "IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu with Docker Model Runner:
docker model run hf.co/IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu
MODEL_NAME=IntelLabs/sqft-sparsepeft-mistral-7b-v0.3-40-gsm8k-heu
lm_eval --model hf --model_args pretrained=${MODEL_NAME},add_bos_token=True,trust_remote_code=True --tasks gsm8k --batch_size auto:4
Refer to our repo for the environment information to run this command.
Repository: https://github.com/IntelLabs/Hardware-Aware-Automated-Machine-Learning/tree/main/SQFT
Paper:
@inproceedings{munoz-etal-2024-sqft,
title = "{SQFT}: Low-cost Model Adaptation in Low-precision Sparse Foundation Models",
author = "Munoz, Juan Pablo and
Yuan, Jinjie and
Jain, Nilesh",
editor = "Al-Onaizan, Yaser and
Bansal, Mohit and
Chen, Yun-Nung",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2024",
month = nov,
year = "2024",
address = "Miami, Florida, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.findings-emnlp.749",
pages = "12817--12832",
}
Apache-2.0