SwastikM commited on
Commit
fddfb41
·
verified ·
1 Parent(s): e5c5447

Update README.md

Browse files

-- Initial Model Card Added

Files changed (1) hide show
  1. README.md +96 -1
README.md CHANGED
@@ -5,6 +5,101 @@ language:
5
  pipeline_tag: text-generation
6
  ---
7
 
8
- # Model Card for Model ID
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  COMING SOON
 
5
  pipeline_tag: text-generation
6
  ---
7
 
8
+ # Meta-Llama-3-8B-Instruct-4bit
9
+
10
+ BitsAndBytes 4bit Quantized Model
11
+
12
+ # Quantization Configuration
13
+
14
+ - **load_in_4bit:** True
15
+ - **llm_int8_threshold:** 6.0
16
+ - **bnb_4bit_quant_type:** nf4
17
+ - **bnb_4bit_use_double_quant:** True
18
+ - **bnb_4bit_compute_dtype:** bfloat16
19
+
20
+ # How to use
21
+
22
+ ### Load Required Libraries
23
+
24
+ ```Python
25
+ !pip install transformers
26
+ !pip install peft
27
+ !pip install -U bitsandbytes
28
+ ```
29
+
30
+ ### Load model directly
31
+
32
+ ```Python
33
+ from transformers import AutoTokenizer, AutoModelForCausalLM
34
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
35
+ model = AutoModelForCausalLM.from_pretrained("SwastikM/Meta-Llama-3-8B-Instruct_bitsandbytes_4bit")
36
+
37
+ messages = [
38
+ {"role": "system", "content": "You are a Coder."},
39
+ {"role": "user", "content": "How to ctrate a list in Python?"}
40
+ ]
41
+
42
+ input_ids = tokenizer.apply_chat_template(
43
+ messages,
44
+ add_generation_prompt=True,
45
+ return_tensors="pt"
46
+ ).to(model.device)
47
+
48
+ terminators = [
49
+ tokenizer.eos_token_id,
50
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
51
+ ]
52
+
53
+ outputs = model.generate(
54
+ input_ids,
55
+ max_new_tokens=256,
56
+ eos_token_id=terminators,
57
+ do_sample=False,
58
+ temperature=0.0
59
+ )
60
+
61
+ response = outputs[0][input_ids.shape[-1]:]
62
+ print(tokenizer.decode(response, skip_special_tokens=True))
63
+ ```
64
+
65
+ ### Output
66
+
67
+ ```
68
+ In Python, you can create a list in several ways:
69
+
70
+ 1. Using the `list()` function:
71
+
72
+ my_list = list()
73
+
74
+ This creates an empty list.
75
+
76
+ 2. Using square brackets `[]`:
77
+
78
+ my_list = []
79
+
80
+ This also creates an empty list.
81
+
82
+ 3. Using the `list()` function with an iterable (such as a string or a tuple):
83
+
84
+ my_list = list("hello")
85
+ print(my_list) # Output: ['h', 'e', 'l', 'l', 'o']
86
+
87
+ 4. Using the `list()` function with a range of numbers:
88
+
89
+ my_list = list(range(1, 6))
90
+ print(my_list) # Output: [1, 2, 3, 4, 5]
91
+
92
+ 5. Using the `list()` function with a dictionary:
93
+
94
+ my_dict = {"a": 1, "b": 2, "c": 3}
95
+ my_list = list(my_dict.keys())
96
+ print(my_list) # Output: ['a', 'b', 'c']
97
+
98
+ Note that in Python, lists are mutable, meaning you can add, remove, or modify elements after creating the list.
99
+ ```
100
+
101
+
102
+
103
+
104
 
105
  COMING SOON