rkumar70900 commited on
Commit
506e559
·
verified ·
1 Parent(s): 721620b

readme for llama 3.2 3b instruct

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.2
3
+ language:
4
+ - en
5
+ - de
6
+ - fr
7
+ - it
8
+ - pt
9
+ - hi
10
+ - es
11
+ - th
12
+ library_name: transformers
13
+ tags:
14
+ - llama-3.2
15
+ - meta
16
+ - autogptq
17
+ base_model:
18
+ - meta-llama/Llama-3.2-3B-Instruct
19
+ ---
20
+
21
+ > [!IMPORTANT]
22
+ > This repository is a community-driven quantized version of the original model [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) which is the FP16 half-precision official version released by Meta AI.
23
+
24
+ ## Model Information
25
+
26
+ The Meta Llama 3.2 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes (text in/text out). The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks.
27
+
28
+ This repository contains [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) quantized using [AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ) from FP16 down to INT4 using the GPTQ kernels performing zero-point quantization with a group size of 128.
29
+
30
+ ## Model Usage
31
+
32
+ > [!NOTE]
33
+ > In order to run the inference with Llama 3.2 3B Instruct GPTQ in INT4, around 8 GiB of VRAM are needed only for loading the model checkpoint, without including the KV cache or the CUDA graphs, meaning that there should be a bit over that VRAM available.
34
+
35
+ In order to use the current quantized model, support is offered for different solutions as `transformers`, `autogptq`, or `text-generation-inference`.
36
+
37
+ ### 🤗 transformers
38
+
39
+ In order to run the inference with Llama 3.2 3B Instruct GPTQ in INT4, you need to install the following packages:
40
+
41
+ ```bash
42
+ pip install -q --upgrade transformers accelerate optimum
43
+ pip install -q --no-build-isolation auto-gptq
44
+ ```
45
+
46
+ To run the inference on top of Llama 3.2 3B Instruct GPTQ in INT4 precision, the GPTQ model can be instantiated as any other causal language modeling model via `AutoModelForCausalLM` and run the inference normally.
47
+
48
+ ```python
49
+ import torch
50
+ from transformers import AutoModelForCausalLM, AutoTokenizer
51
+
52
+ model_id = "rkumar70900/Llama-3.2-3B-Instruct-GPTQ-INT4"
53
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
54
+ model = AutoModelForCausalLM.from_pretrained(
55
+ model_id,
56
+ torch_dtype=torch.float16,
57
+ low_cpu_mem_usage=True,
58
+ device_map="auto",
59
+ )
60
+
61
+ prompt = [
62
+ {"role": "system", "content": "You are a helpful assistant, that responds as a pirate."},
63
+ {"role": "user", "content": "What's Deep Learning?"},
64
+ ]
65
+ inputs = tokenizer.apply_chat_template(
66
+ prompt,
67
+ tokenize=True,
68
+ add_generation_prompt=True,
69
+ return_tensors="pt",
70
+ return_dict=True,
71
+ ).to("cuda")
72
+
73
+ outputs = model.generate(**inputs, do_sample=True, max_new_tokens=256)
74
+ print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
75
+ ```