Transformers documentation

SpQR

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

SpQR

Алгоритм квантования SpQR использует структуру 3-битного квантования с двухуровневой группировкой, разбитой на блоки 16x16, с учетом разреженных выбросов.

Чтобы квантовать модель с помощью SpQR, обратитесь к репозиторию Vahe1994/SpQR.

Загрузите модель, квантованную с помощью SpQR, с помощью from_pretrained().

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

quantized_model = AutoModelForCausalLM.from_pretrained(
    "elvircrn/Llama-2-7b-SPQR-3Bit-16x16-red_pajama-hf",
    dtype=torch.half,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("elvircrn/Llama-2-7b-SPQR-3Bit-16x16-red_pajama-hf")
Update on GitHub