rishiraj commited on
Commit
546cfe8
1 Parent(s): cf4e97d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -1
README.md CHANGED
@@ -1,4 +1,12 @@
1
  ---
 
 
 
 
 
 
 
 
2
  tags:
3
  - autotrain
4
  - text-generation
@@ -6,4 +14,94 @@ widget:
6
  - text: "I love AutoTrain because "
7
  ---
8
 
9
- # Model Trained Using AutoTrain
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ model-index:
3
+ - name: zephyr-math
4
+ results: []
5
+ license: mit
6
+ datasets:
7
+ - rishiraj/guanaco-style-metamath
8
+ language:
9
+ - en
10
  tags:
11
  - autotrain
12
  - text-generation
 
14
  - text: "I love AutoTrain because "
15
  ---
16
 
17
+ # Zephyr Math 7B Trained Using AutoTrain
18
+
19
+ ## Model Details
20
+
21
+ [rishiraj/zephyr-math](https://huggingface.co/rishiraj/zephyr-math) is the LLM (released under [Apache License 2.0](http://www.apache.org/licenses/)) fully fine-tuned on the [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) dataset and based on the powerful [HuggingFaceH4/zephyr-7b-alpha](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha) model.
22
+
23
+ We try achieving State-Of-The-Art result in pass@1 on the [GSM8k Benchmarks](https://github.com/openai/grade-school-math). The A100 GPU used for this fine-tuning process is generously provided by [Weights & Biases](https://wandb.ai/site). I am thankful to [Soumik Rakshit](https://wandb.ai/geekyrakshit) from team W&B for constant support in this integration. The experiment can be tracked using Weights & Biases [here](https://wandb.ai/ml-colabs/huggingface/runs/gamw5iuf).
24
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61030ed7d6edf00e0107a465/jzl7eBRE0F6YoqtekaSxJ.png)
25
+
26
+ ### Preparing the dataset
27
+ AutoTrain Advanced expects your CSV custom dataset in a certain format to work properly. Your training file must contain a "text" column on which the training will be done. For best results, the "text" column should have data in the **### Human: Question?### Assistant: Answer.** format. A great example for the kind of dataset AutoTrain Advanced expects would be [timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco). However, if you observe the [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) dataset, there are 3 columns - "query", "response" and "type". We will preprocess this dataset by removing the "type" column and combining the content of the "query" and "response" columns under one "text" column with the **### Human: Query?### Assistant: Response.** format. The resulting dataset is [rishiraj/guanaco-style-metamath](https://huggingface.co/datasets/rishiraj/guanaco-style-metamath) and it will be used for training.
28
+
29
+ ### Adjusting hyperparameters
30
+ AutoTrain Advanced comes with a host hyperparameters we can tune to get the best model. While the default hyperparameters are a great start for everyone, I made a few changes there that are suitable for our use case. Here are the hyperparameters I used:
31
+ ```
32
+ learning_rate = 2e-5
33
+ num_epochs = 3
34
+ batch_size = 4
35
+ block_size = 1024
36
+ trainer = "sft"
37
+ warmup_ratio = 0.03
38
+ weight_decay = 0.
39
+ gradient_accumulation = 4
40
+ use_fp16 = True
41
+ use_peft = True
42
+ use_int4 = True
43
+ merge_adapter = True
44
+ lora_r = 16
45
+ lora_alpha = 32
46
+ lora_dropout = 0.05
47
+ logging_steps = 10
48
+ log = "wandb"
49
+ ```
50
+
51
+ ### Results
52
+ Check out the [W&B Report]() for a detailed overview of the finetuned model including its Benchmark scores on a variety of tests like the ARC, HellaSwag, MMLU, TruthfulQA. I also included a comparison with other open-source LLMs on GSM8k Pass@1 and MATH Pass@1.
53
+
54
+ ## Model Usage
55
+
56
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
57
+
58
+ ```python
59
+ import torch
60
+ from transformers import pipeline
61
+
62
+ pipe = pipeline("text-generation", model="rishiraj/zephyr-math", torch_dtype=torch.bfloat16, device_map="auto")
63
+
64
+ messages = [
65
+ {
66
+ "role": "system",
67
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
68
+ },
69
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
70
+ ]
71
+ prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
72
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
73
+ print(outputs[0]["generated_text"])
74
+ ```
75
+
76
+ ## Experiments
77
+
78
+ | Model | GSM8k Pass@1 | MATH Pass@1 |
79
+ |---------------------|--------------|-------------|
80
+ | MPT-7B | 6.8 | 3.0 |
81
+ | Falcon-7B | 6.8 | 2.3 |
82
+ | LLaMA-1-7B | 11.0 | 2.9 |
83
+ | LLaMA-2-7B | 14.6 | 2.5 |
84
+ | MPT-30B | 15.2 | 3.1 |
85
+ | LLaMA-1-13B | 17.8 | 3.9 |
86
+ | GPT-Neo-2.7B | 19.5 | -- |
87
+ | Falcon-40B | 19.6 | 2.5 |
88
+ | Baichuan-chat-13B | 23.9 | -- |
89
+ | Vicuna-v1.3-13B | 27.6 | -- |
90
+ | LLaMA-2-13B | 28.7 | 3.9 |
91
+ | InternLM-7B | 31.2 | -- |
92
+ | ChatGLM-2-6B | 32.4 | -- |
93
+ | GPT-J-6B | 34.9 | -- |
94
+ | LLaMA-1-33B | 35.6 | 3.9 |
95
+ | LLaMA-2-34B | 42.2 | 6.24 |
96
+ | RFT-7B | 50.3 | -- |
97
+ | LLaMA-1-65B | 50.9 | 10.6 |
98
+ | Qwen-7B | 51.6 | -- |
99
+ | WizardMath-7B | 54.9 | 10.7 |
100
+ | LLaMA-2-70B | 56.8 | 13.5 |
101
+ | WizardMath-13B | 63.9 | 14.0 |
102
+ | MAmmoTH-7B (COT) | 50.5 | 10.4 |
103
+ | MAmmoTH-7B (POT+COT)| 53.6 | 31.5 |
104
+ | Arithmo-Mistral-7B | 74.7 | 25.3 |
105
+ | MetaMath-7B | 66.5 | 19.8 |
106
+ | MetaMath-13B | 72.3 | 22.4 |
107
+ | 🔥 **Zephyr-Math-7B** | **??** | **??** |