How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="IntelLabs/sqft-phi-3-mini-4k-40-base", 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("IntelLabs/sqft-phi-3-mini-4k-40-base", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("IntelLabs/sqft-phi-3-mini-4k-40-base", 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]:]))
Quick Links

SQFT Base Model: sqft-phi-3-mini-4k-40-base

Model Sources

Repository: https://github.com/IntelLabs/Hardware-Aware-Automated-Machine-Learning/tree/main/SQFT

Paper:

How to get this model

Refer to the command in SQFT/run_command/phi-3-mini-4k-instruct/sparse_quantization.sh#11.

Citation

@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",
}

Acknowledgement

Thanks to the work Wanda (paper, code), which provides a simple but effective pruning approach.

License

Apache-2.0

Downloads last month
8
Safetensors
Model size
4B params
Tensor type
F16
·
Inference Providers NEW
Input a message to start chatting with IntelLabs/sqft-phi-3-mini-4k-40-base.

Model tree for IntelLabs/sqft-phi-3-mini-4k-40-base

Quantizations
2 models

Collection including IntelLabs/sqft-phi-3-mini-4k-40-base

Papers for IntelLabs/sqft-phi-3-mini-4k-40-base