mrm8488 commited on
Commit
94d456c
1 Parent(s): c60e590

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -0
README.md CHANGED
@@ -1,3 +1,112 @@
1
  ---
2
  license: wtfpl
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: wtfpl
3
+ datasets:
4
+ - migtissera/Synthia-v1.3
5
+ language:
6
+ - en
7
  ---
8
+
9
+
10
+ # MAMBA (2.8B) 🐍 fine-tuned on Synthia-v1.3
11
+
12
+ <div style="text-align:center;width:250px;height:250px;">
13
+ <img src="https://huggingface.co/clibrain/mamba-2.8b-instruct-openhermes/resolve/main/mamba_hermes_logo_1.png?download=true" alt="mamba-hermes logo"">
14
+ </div>
15
+
16
+ Model Card is still WIP!
17
+
18
+
19
+ ## Base model info
20
+
21
+ Mamba is a new state space model architecture showing promising performance on information-dense data such as language modeling, where previous subquadratic models fall short of Transformers.
22
+ It is based on the line of progress on [structured state space models](https://github.com/state-spaces/s4),
23
+ with an efficient hardware-aware design and implementation in the spirit of [FlashAttention](https://github.com/Dao-AILab/flash-attention).
24
+
25
+ ## Dataset info
26
+
27
+ The OpenHermes dataset is composed of 242,000 entries of primarily GPT-4 generated data, from open datasets across the AI landscape, including:
28
+
29
+ OpenHermes 13B is the first fine tune of the Hermes dataset that has a fully open source dataset!
30
+
31
+ OpenHermes was trained on 242,000 entries of primarily GPT-4 generated data, from open datasets across the AI landscape, including:
32
+
33
+ - GPTeacher - General Instruct, Roleplay v1, Roleplay v2, and Code Instruct Datasets, by Teknium
34
+ - WizardLM (v1, evol_instruct 70k), by WizardLM Team/nlpxucan
35
+ - Airoboros GPT-4 (v1.0), by JonDurbin
36
+ - Camel-AI's domain expert datasets, by the Camel-AI Team
37
+ - CodeAlpaca, by Sahil2801
38
+ - GPT4-LLM and Unnatural Instructions, by Microsoft
39
+ Filtering included removal of OpenAI refusals, disclaimers, and "As an AI" type examples and more
40
+ The base dataset mix is identical to the original Nous-Hermes', minus the Nous-Instruct and PDACTL datasets which were private datasets.
41
+
42
+ ## Usage
43
+
44
+ ```sh
45
+ pip install torch==2.1.0 transformers==4.35.0 causal-conv1d==1.0.0 mamba-ssm==1.0.1
46
+ ```
47
+
48
+ ```py
49
+ import torch
50
+ from transformers import AutoTokenizer, AutoModelForCausalLM
51
+ from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel
52
+
53
+ CHAT_TEMPLATE_ID = "HuggingFaceH4/zephyr-7b-beta"
54
+
55
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
56
+ model_name = "clibrain/mamba-2.8b-ft-synthia-v1.3"
57
+
58
+ eos_token = "<|endoftext|>"
59
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
60
+ tokenizer.eos_token = eos_token
61
+ tokenizer.pad_token = tokenizer.eos_token
62
+ tokenizer.chat_template = AutoTokenizer.from_pretrained(CHAT_TEMPLATE_ID).chat_template
63
+
64
+ model = MambaLMHeadModel.from_pretrained(
65
+ model_name, device=device, dtype=torch.float16)
66
+
67
+ messages = []
68
+ prompt = "Tell me 5 sites to visit in Spain"
69
+ messages.append(dict(role="user", content=prompt))
70
+
71
+ input_ids = tokenizer.apply_chat_template(
72
+ messages, return_tensors="pt", add_generation_prompt=True
73
+ ).to(device)
74
+
75
+ out = model.generate(
76
+ input_ids=input_ids,
77
+ max_length=2000,
78
+ temperature=0.9,
79
+ top_p=0.7,
80
+ eos_token_id=tokenizer.eos_token_id,
81
+ )
82
+
83
+ decoded = tokenizer.batch_decode(out)
84
+ assistant_message = (
85
+ decoded[0].split("<|assistant|>\n")[-1].replace(eos, "")
86
+ )
87
+
88
+ print(assistant_message)
89
+ ```
90
+
91
+
92
+ ## Gradio Demo
93
+
94
+ ```sh
95
+ git clone https://github.com/mrm8488/mamba-chat.git
96
+ cd mamba-chat
97
+
98
+ pip install -r requirements.txt
99
+ pip install -q gradio==4.8.0
100
+
101
+ python app.py \
102
+ --model clibrain/mamba-2.8b-ft-synthia-v1.3 \
103
+ --share
104
+ ```
105
+ ## Evaluations
106
+
107
+ Coming soon!
108
+
109
+
110
+ ## Acknowledgments
111
+
112
+ Thanks to [mamba-chat](https://github.com/havenhq/mamba-chat/tree/main) for heavily inspiring our work