Views
No views yet
bitsandbytes quantization.deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5BNF4)transformers1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2
3model_id = "Deepak7376/DeepSeek-R1-Distill-Qwen-1.5B-bnb-4bit"
4
5bnb_config_4bit = BitsAndBytesConfig(
6 load_in_4bit=True,
7 bnb_4bit_quant_type="nf4",
8 bnb_4bit_compute_dtype=torch.float16,
9 bnb_4bit_use_double_quant=True,
10)
11
12model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config_4bit)
13tokenizer = AutoTokenizer.from_pretrained(model_id)
14
15pipe = pipeline(
16 'text-generation',
17 model=model,
18 tokenizer=tokenizer,
19 max_length=1024,
20 truncation=True,
21 do_sample=True,
22 temperature=0.6,
23 top_p=0.95,
24 )
25
26messages = [
27 {"role": "user", "content": "suggest me top movies in 2021? <think>\n"},
28]
29pipe(messages)
301
2from transformers import pipeline
3
4pipe = pipeline("text-generation", model="Deepak7376/DeepSeek-R1-Distill-Qwen-1.5B-bnb-4bit")
5
6messages = [
7 {"role": "user", "content": "suggest me top movies in 2021? <think>\n"},
8]
9pipe(messages)| Model Version | Memory Usage |
|---|---|
| Base Model | ~3.5GB |
| 4-bit Quantized | ~1.5GB |
apache-2.0 license.