RichardErkhov commited on
Commit
3cd6030
·
verified ·
1 Parent(s): e37defa

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +120 -0
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ Llama3-8b-alpaca-v2 - bnb 8bits
11
+ - Model creator: https://huggingface.co/lainshower/
12
+ - Original model: https://huggingface.co/lainshower/Llama3-8b-alpaca-v2/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ library_name: transformers
20
+ tags: []
21
+ ---
22
+
23
+ # Model Card for Model ID
24
+
25
+ lainshower/Llama3-8b-alpaca-v2
26
+
27
+ ## Model Details
28
+
29
+ Full Fine-tuned Llama3-8B Alpaca (with training 3 epochs).
30
+
31
+ Training with (BF16) Mixed Precision For Stability.
32
+
33
+ This is Model is Trained For [stanford alpaca](https://github.com/tatsu-lab/stanford_alpaca) for 3 Epochs. > Click here [Llama3-8B-Alpaca-1EPOCHS](https://huggingface.co/lainshower/Llama3-8b-alpaca) For the Best Validation Loss Model.
34
+
35
+ Refer to the Training Graph for the better details.
36
+
37
+
38
+ ### Direct Use
39
+
40
+ #### [Templates]
41
+
42
+ You can use the following standard templates for inference the Llama3 Alpaca model:
43
+
44
+ <pre><code>
45
+ PROMPT_DICT = {
46
+ "prompt_input": (
47
+ "Below is an instruction that describes a task, paired with an input that provides further context. "
48
+ "Write a response that appropriately completes the request.\n\n"
49
+ "### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:"
50
+ ),
51
+ "prompt_no_input": (
52
+ "Below is an instruction that describes a task. "
53
+ "Write a response that appropriately completes the request.\n\n"
54
+ "### Instruction:\n{instruction}\n\n### Response:"
55
+ ),
56
+ }
57
+ </code></pre>
58
+
59
+ #### [Code]
60
+
61
+ #### [Model Loading]
62
+
63
+ <pre><code>
64
+ ### We recommend using Float32 when running inference on the models.
65
+ model = LlamaForCausalLM.from_pretrained("lainshower/Llama3-8b-alpaca-v2")
66
+ tokenizer = AutoTokenizer.from_pretrained("lainshower/Llama3-8b-alpaca-v2")
67
+
68
+ </code></pre>
69
+
70
+ #### [Template]
71
+
72
+ <pre><code>
73
+ PROMPT_DICT = {
74
+ "prompt_input": (
75
+ "Below is an instruction that describes a task, paired with an input that provides further context. "
76
+ "Write a response that appropriately completes the request.\n\n"
77
+ "### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:"
78
+ ),
79
+ "prompt_no_input": (
80
+ "Below is an instruction that describes a task. "
81
+ "Write a response that appropriately completes the request.\n\n"
82
+ "### Instruction:\n{instruction}\n\n### Response:"
83
+ ),
84
+ }
85
+
86
+ ann = {}
87
+ ann['instruction'] = '''You are presented with the quiz "What causes weather changes on Earth? " But you don't know the answer, so you turn to your teacher to ask for hints. He says that "the Earth being tilted on its rotating axis causes seasons" and "weather changes from season to season". So, what's the best answer to the question? Choose your answer from: (a). the sun's energy (b). The tilt in its rotating axis. (c). high temperature (d). Weather in space (e). Vertical movement (f). Greenhouse gases (g). Spinning backwards (h). wind and erosion Answer:'''
88
+ prompt = PROMPT_DICT["prompt_no_input"].format_map(ann)
89
+ '''
90
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
91
+
92
+ ### Instruction:
93
+ "What causes weather changes on Earth? " But you don't know the answer, so you turn to your teacher to ask for hints. He says that "the Earth being tilted on its rotating axis causes seasons" and "weather changes from season to season". So, what's the best answer to the question? Choose your answer from: (a). the sun's energy (b). The tilt in its rotating axis. (c). high temperature (d). Weather in space (e). Vertical movement (f). Greenhouse gases (g). Spinning backwards (h). wind and erosion Answer:
94
+
95
+ ### Response:
96
+ '''
97
+ </code></pre>
98
+
99
+ #### [Generation]
100
+
101
+ <pre><code>
102
+ input_ids = token.batch_encode_plus([prompt], return_tensors="pt", padding=False)
103
+ total_sequences = model.generate(input_ids=input_ids['input_ids'].cuda(), attention_mask=input_ids['attention_mask'].cuda(), max_length=490, do_sample=True, top_p=0.9)
104
+ print(token.decode(total_sequences[0], skip_special_tokens=True)))
105
+ </code></pre>
106
+
107
+ #### Training Hyperparameters
108
+
109
+ * Learning Rates : 2e-5
110
+ * Training Procedures : Mixed Precision (bfloat16)
111
+ * Context Length: 512
112
+ * This is 3-Epochs Training Model > Click here [Llama3-8B-Alpaca-1EPOCHS](https://huggingface.co/lainshower/Llama3-8b-alpaca) For the Best Validation Loss Model.
113
+ * We follow the [Rethinking Data Selection for Supervised Fine-Tuning](https://arxiv.org/abs/2402.06094) for Total Training Epochs Selection.
114
+
115
+ #### Training Graph
116
+
117
+ ![training_graph.png](https://cdn-uploads.huggingface.co/production/uploads/64bf77338e051085ba405d66/DkxRN6qqsQRMImdeFevXk.png)
118
+
119
+
120
+