m8than commited on
Commit
44a0ded
·
1 Parent(s): 16f39d7

initial commit

Browse files
Files changed (2) hide show
  1. EagleX-7B-Chat-V0.5.pth +3 -0
  2. README.md +100 -0
EagleX-7B-Chat-V0.5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6dadc748292332d89441a24f580f0c091b0ba561f606171c0543d71cff54cd94
3
+ size 15036308756
README.md CHANGED
@@ -1,3 +1,103 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ ![](EagleChat.png "An eagle conversing with a person")
6
+
7
+ ### RWKV EagleX 7B v2 Model
8
+
9
+ > **!Important!: This is not meant to be used with huggingface transformers library**
10
+ >
11
+ > The following is the raw representation of the EagleX 7B Chat V0.5 model. For use with our own set of inference libraries and tools
12
+ >
13
+ > This IS the chat/instruct tune (up to 100k context length)!!
14
+
15
+ ## Chat Format
16
+
17
+ The chat format is identical to the ChatML, the only difference is that the <|im_start|> and <|im_end|> special tokens have been replaced with the unused ASCII codes "\x16" and "\x17" respectively. This was done to ensure complete compatibility with the standard RWKV World tokenizer.
18
+
19
+ Example:
20
+ ```
21
+ \x16system
22
+ You are Eagle, a very smart, creative and helpful personal assistant. Assist the user in any way you can with detailed and smart responses.\x17
23
+ \x16user
24
+ I want to cheer up my friend who's having a rough day. Can you suggest a couple short and sweet text messages to go with a kitten gif?\x17
25
+ \x16assistant
26
+ Sure, I can help you with that! Here are a couple of suggestions for text messages:
27
+
28
+ "You're the cutest thing ever! I hope you have a great day!"
29
+
30
+ "I know you're having a tough day, but you're amazing. Hang in there!"
31
+
32
+ "Thinking of you and sending you lots of love and light. You're amazing just the way you are."\x17
33
+ \x16user
34
+ Have you got anything even more sympathetic?\x17
35
+ \x16assistant
36
+ Sure, here are a couple of additional suggestions:
37
+
38
+ "I'm so sorry you're having a tough day. You're an amazing person, and I'm so proud of you."
39
+
40
+ "You're a wonderful person, and you're going through a tough time right now. Just remember that you're strong and capable, and you can get through this."
41
+
42
+ "I'm here for you, and I'm going to do everything I can to support you. You're amazing, and you're going to get through this."
43
+
44
+ "I'm so sorry you're having a tough day. You're an amazing person, and I'm so proud of you. You're going to get through this, and you're going to be even stronger and happier in the future."\x17
45
+ ```
46
+
47
+ ## Quickstart with the PIP library
48
+
49
+ https://pypi.org/project/rwkv/
50
+
51
+ ```
52
+
53
+ from rwkv.model import RWKV
54
+ from rwkv.utils import PIPELINE, PIPELINE_ARGS
55
+
56
+ # download models: https://huggingface.co/BlinkDL
57
+ model = RWKV(model='/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-169m/RWKV-4-Pile-169M-20220807-8023', strategy='cpu fp32')
58
+ pipeline = PIPELINE(model, "20B_tokenizer.json") # 20B_tokenizer.json is in https://github.com/BlinkDL/ChatRWKV
59
+ # use pipeline = PIPELINE(model, "rwkv_vocab_v20230424") for rwkv "world" models
60
+
61
+ ctx = "\nIn a shocking finding, scientist discovered a herd of dragons living in a remote, previously unexplored valley, in Tibet. Even more surprising to the researchers was the fact that the dragons spoke perfect Chinese."
62
+ print(ctx, end='')
63
+
64
+ def my_print(s):
65
+ print(s, end='', flush=True)
66
+
67
+ # For alpha_frequency and alpha_presence, see "Frequency and presence penalties":
68
+ # https://platform.openai.com/docs/api-reference/parameter-details
69
+
70
+ args = PIPELINE_ARGS(temperature = 1.0, top_p = 0.7, top_k = 100, # top_k = 0 then ignore
71
+ alpha_frequency = 0.25,
72
+ alpha_presence = 0.25,
73
+ alpha_decay = 0.996, # gradually decay the penalty
74
+ token_ban = [0], # ban the generation of some tokens
75
+ token_stop = [], # stop generation whenever you see any token here
76
+ chunk_len = 256) # split input into chunks to save VRAM (shorter -> slower)
77
+
78
+ pipeline.generate(ctx, token_count=200, args=args, callback=my_print)
79
+ print('\n')
80
+
81
+ out, state = model.forward([187, 510, 1563, 310, 247], None)
82
+ print(out.detach().cpu().numpy()) # get logits
83
+ out, state = model.forward([187, 510], None)
84
+ out, state = model.forward([1563], state) # RNN has state (use deepcopy to clone states)
85
+ out, state = model.forward([310, 247], state)
86
+ print(out.detach().cpu().numpy()) # same result as above
87
+ print('\n')
88
+ ```
89
+
90
+ ## Ramblings
91
+ Several new techniques were used to build the instruct dataset including the following:
92
+ - Smart packing of the instruct pairs (to improve long context multi turn conversation)
93
+ - Smart grouping of different context lengths and data categories/priorities (to improve training efficiency)
94
+ - Variable context length training (courtesy of https://github.com/RWKV/RWKV-infctx-trainer)
95
+ - A bunch of synthetic data to increase long context usage and reasoning (to be released soon...)
96
+
97
+ ## Acknowledgement
98
+ We are grateful for the help and support from the following key groups:
99
+
100
+ - [Recursal.ai](https://recursal.ai) team for financing the GPU resources, and managing the training of this model - you can run the Eagle line of RWKV models on their cloud / on-premise platform today.
101
+ - Dataset built and model finetuned by @m8than
102
+ - EleutherAI for their support, especially in the v5/v6 Eagle/Finch paper
103
+ - Linux Foundation AI & Data group for supporting and hosting the RWKV project