Chrisneverdie
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,104 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
# FirstSportsELM
|
5 |
+
### The first ever Sports Expert Language Model
|
6 |
+
Created by Chris Zexin Chen, Sean Xie, and Chengxi Li.
|
7 |
+
Email for question: zc2404@nyu.edu
|
8 |
+
|
9 |
+
### This model is now on Huggingface Space for you to play around!
|
10 |
+
https://huggingface.co/spaces/Chrisneverdie/SportsDPT
|
11 |
+
|
12 |
+
As avid sports enthusiasts, we’ve consistently observed a gap in the market for a dedicated
|
13 |
+
large language model tailored to the sports domain. This research stems from our intrigue
|
14 |
+
about the potential of a language model that is exclusively trained and fine-tuned on sports-
|
15 |
+
related data. We aim to assess its performance against generic language models, thus delving
|
16 |
+
into the unique nuances and demands of the sports industry
|
17 |
+
|
18 |
+
This model structure is built by Andrej Karpathy: https://github.com/karpathy/nanoGPT
|
19 |
+
|
20 |
+
Here is an example QA from SportsDPT
|
21 |
+
![5dc29abdc17ced70ca75e2da6aa5a90](https://github.com/chrischenhub/FirstSportsELM/assets/99419764/db5f6287-8d4f-4c43-9843-de70f726d32b)
|
22 |
+
|
23 |
+
## Model Checkpoint File
|
24 |
+
|
25 |
+
https://drive.google.com/drive/folders/1PSYYWdUWiM5t0KTtlpwQ1YXBWRwV1JWi?usp=sharing
|
26 |
+
|
27 |
+
*put FineTune_ckpt.pt under model folder in finetune/model/ if you wish to proceed with inference*
|
28 |
+
|
29 |
+
## Pretrain Data
|
30 |
+
|
31 |
+
https://drive.google.com/drive/folders/1bZvWxLnmCDYJhgMDaWumr33KbyDKQUki?usp=sharing
|
32 |
+
*train.bin ~8.4 Gb/4.5B tokens, val.bin ~4.1 Mb/2M tokens*
|
33 |
+
|
34 |
+
|
35 |
+
## Pretrain
|
36 |
+
To replicate our model, you need to use train.bin and val.bin in this drive, which is processed and ready to train.
|
37 |
+
We trained on a 4xA100 40GB node for 30 hrs to get a val loss ~2.36. Once you set up the environment, run the following:
|
38 |
+
|
39 |
+
```$ torchrun --standalone --nproc_per_node=4 train.py config/train_gpt2.py```
|
40 |
+
|
41 |
+
You can tweak around with the parameters in train_gpt2.py. We had two experiments and the first one failed badly.
|
42 |
+
|
43 |
+
![image](https://github.com/chrischenhub/FirstSportsELM/assets/99419764/e99ee0bd-b49a-421b-808f-796ea90a3f32)
|
44 |
+
|
45 |
+
The second trial is a success and the parameters are all stored in pretrain/train_gpt2.py
|
46 |
+
|
47 |
+
![image](https://github.com/chrischenhub/FirstSportsELM/assets/99419764/fdd474ef-c11e-4ae9-af58-4c2632bfcd5b)
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
## Fine Tune
|
52 |
+
|
53 |
+
We used thousands of GPT4-generated Sports QA pairs to finetune our model.
|
54 |
+
|
55 |
+
1. Generate Tags, Questions and Respones from GPT-4
|
56 |
+
|
57 |
+
*python FineTuneDataGeneration.py api_key Numtag NumQuestion NumParaphrase NumAnswer*
|
58 |
+
|
59 |
+
* api_key: Your Api Key
|
60 |
+
* Numtag: number of tags, default 50, optional
|
61 |
+
* NumQuestion: number of questions, default 16, optional
|
62 |
+
* NumParaphrase: number of question paraphrases, default 1, optional
|
63 |
+
* NumAnswer: number of answers, default 2, optional
|
64 |
+
|
65 |
+
2. Convert Json to TXT and Bin for fine-tuning
|
66 |
+
|
67 |
+
*python Json2Bin.py*
|
68 |
+
|
69 |
+
3. Fine Tune OmniSportsGPT
|
70 |
+
|
71 |
+
*python train.py FineTuneConfig.py*
|
72 |
+
|
73 |
+
|
74 |
+
## Ask Your Question!
|
75 |
+
|
76 |
+
1. Inference
|
77 |
+
|
78 |
+
*python Inference.py YourQuestionHere*
|
79 |
+
|
80 |
+
*python DefaultAnswer.py*
|
81 |
+
|
82 |
+
*python RandomGPT2ChatBot.py*
|
83 |
+
|
84 |
+
2. Plot Result
|
85 |
+
|
86 |
+
*python plot.py*
|
87 |
+
|
88 |
+
## Benchmark
|
89 |
+
Target: Sports DPT
|
90 |
+
|
91 |
+
Default: GPT2 replica finetuned by sports QA
|
92 |
+
|
93 |
+
Random: GPT2 size language model finetuned by general QA
|
94 |
+
|
95 |
+
Llama2: Llama2 7B finetuned by general QA
|
96 |
+
|
97 |
+
![Alt text](image-2.png)
|
98 |
+
|
99 |
+
![Alt text](image.png)
|
100 |
+
|
101 |
+
![Alt text](image-1.png)
|
102 |
+
|
103 |
+
## Cost
|
104 |
+
The entire pretrain and finetune process costs around 250 USD. ~200$ in GPU rentals and ~50$ in OpenAI API usage.
|