JunxiongWang commited on
Commit
d853d17
1 Parent(s): a39194f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -1
README.md CHANGED
@@ -2,4 +2,59 @@
2
  license: apache-2.0
3
  ---
4
 
5
- Train in 30B Byte. Mode size 353M. Table 2 in [MambaByte](https://arxiv.org/abs/2401.13660)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  ---
4
 
5
+ Train in 30B Byte. Mode size 353M. Table 2 in [MambaByte](https://arxiv.org/abs/2401.13660)
6
+
7
+ To use
8
+
9
+ ```
10
+ import torch
11
+ from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel
12
+
13
+ import numpy as np
14
+
15
+ model=MambaLMHeadModel.from_pretrained("JunxiongWang/MambaByte_Stories", device='cuda', dtype=torch.float32)
16
+
17
+ text = "It was terribly cold and nearly dark on the last evening of the old year, and the snow was falling fast."
18
+
19
+ text_byte = np.frombuffer(text.encode('utf-8'), dtype=np.uint8)
20
+ input_ids = torch.from_numpy(text_byte[None, :]).long().cuda()
21
+
22
+ sample = model.generate(
23
+ input_ids=input_ids,
24
+ max_length=2048,
25
+ cg=True,
26
+ return_dict_in_generate=True,
27
+ output_scores=True,
28
+ enable_timing=True,
29
+ temperature=1,
30
+ top_k=256,
31
+ top_p=0.9,
32
+ )
33
+
34
+ print(bytes(sample.sequences[0].tolist()).decode('utf-8'))
35
+ ```
36
+
37
+ Output
38
+
39
+ ```
40
+ It was terribly cold and nearly dark on the last evening of the old year, and the snow was falling fast.
41
+ It had been a warm summer , but the ground was dry and cracked .
42
+ The grass was like a great cloud , as deep as a city of ancient people .
43
+ Strange to see a land with so few colors standing strong on the land ; but there it was , passing by in her dreams , the colors of flowers and grasses and birds .
44
+ Of course , the old year was all a faded charcoal black , somewhat like the distant gloaming in the city where she lived .
45
+ She seemed to be walking along the shore of a land that was no longer there .
46
+ And indeed , at first it seemed as if there was another world there , a world inhabited by beings no one had ever seen before , who all consisted of flowers and small fish .
47
+ And they were lovely people , but of whom had never the least idea of a love of anything or anyone before .
48
+ They were neither fierce nor merciless , but deadly serious and bloodthirsty .
49
+ Their deaths were against nature , and nature alone knew how to play tricks on those who opposed it .
50
+ The living , the lived and dead , were all the same to the living ; the living ones were no more than living things whose deaths were inconceivable to them .
51
+ Who could understand why the living were plagued by these men and women ?
52
+ But at least the living were dead ; no doubt they would eat themselves to death in the end .
53
+ The sun shone and the warmth of the day renewed its purity .
54
+ The living were finally able to enjoy the refreshing waters that often flow from the spring .
55
+ The sun shone brightly , and the air was filled with the scent of the flowers .
56
+ But the flowers had no soul .
57
+ They were cold and lonely , and would rather have died in the cold and the wet , than be with the living ones who were dead .
58
+ Of course , this was no great loss , for the living could not take a death in the cold or the weather , for the living could only die by coldness .
59
+ They were cold because they knew that no human being could take warmth and shelter from the cold of death .
60
+ ```