RichardErkhov commited on
Commit
33af2a5
1 Parent(s): 7cb8496

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +120 -0
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ mamba-370m-hf - GGUF
11
+ - Model creator: https://huggingface.co/state-spaces/
12
+ - Original model: https://huggingface.co/state-spaces/mamba-370m-hf/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [mamba-370m-hf.Q2_K.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q2_K.gguf) | Q2_K | 0.2GB |
18
+ | [mamba-370m-hf.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.IQ3_XS.gguf) | IQ3_XS | 0.23GB |
19
+ | [mamba-370m-hf.IQ3_S.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.IQ3_S.gguf) | IQ3_S | 0.23GB |
20
+ | [mamba-370m-hf.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q3_K_S.gguf) | Q3_K_S | 0.23GB |
21
+ | [mamba-370m-hf.IQ3_M.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.IQ3_M.gguf) | IQ3_M | 0.23GB |
22
+ | [mamba-370m-hf.Q3_K.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q3_K.gguf) | Q3_K | 0.23GB |
23
+ | [mamba-370m-hf.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q3_K_M.gguf) | Q3_K_M | 0.23GB |
24
+ | [mamba-370m-hf.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q3_K_L.gguf) | Q3_K_L | 0.23GB |
25
+ | [mamba-370m-hf.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.IQ4_XS.gguf) | IQ4_XS | 0.26GB |
26
+ | [mamba-370m-hf.Q4_0.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q4_0.gguf) | Q4_0 | 0.27GB |
27
+ | [mamba-370m-hf.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.IQ4_NL.gguf) | IQ4_NL | 0.27GB |
28
+ | [mamba-370m-hf.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q4_K_S.gguf) | Q4_K_S | 0.27GB |
29
+ | [mamba-370m-hf.Q4_K.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q4_K.gguf) | Q4_K | 0.27GB |
30
+ | [mamba-370m-hf.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q4_K_M.gguf) | Q4_K_M | 0.27GB |
31
+ | [mamba-370m-hf.Q4_1.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q4_1.gguf) | Q4_1 | 0.28GB |
32
+ | [mamba-370m-hf.Q5_0.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q5_0.gguf) | Q5_0 | 0.3GB |
33
+ | [mamba-370m-hf.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q5_K_S.gguf) | Q5_K_S | 0.3GB |
34
+ | [mamba-370m-hf.Q5_K.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q5_K.gguf) | Q5_K | 0.3GB |
35
+ | [mamba-370m-hf.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q5_K_M.gguf) | Q5_K_M | 0.3GB |
36
+ | [mamba-370m-hf.Q5_1.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q5_1.gguf) | Q5_1 | 0.32GB |
37
+ | [mamba-370m-hf.Q6_K.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q6_K.gguf) | Q6_K | 0.34GB |
38
+ | [mamba-370m-hf.Q8_0.gguf](https://huggingface.co/RichardErkhov/state-spaces_-_mamba-370m-hf-gguf/blob/main/mamba-370m-hf.Q8_0.gguf) | Q8_0 | 0.42GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ library_name: transformers
46
+ tags: []
47
+ ---
48
+
49
+ # Mamba
50
+
51
+ <!-- Provide a quick summary of what the model is/does. -->
52
+ This repository contains the `transfromers` compatible `mamba-2.8b`. The checkpoints are untouched, but the full `config.json` and tokenizer are pushed to this repo.
53
+
54
+ # Usage
55
+
56
+ You need to install `transformers` from `main` until `transformers=4.39.0` is released.
57
+ ```bash
58
+ pip install git+https://github.com/huggingface/transformers@main
59
+ ```
60
+
61
+ We also recommend you to install both `causal_conv_1d` and `mamba-ssm` using:
62
+
63
+ ```bash
64
+ pip install causal-conv1d>=1.2.0
65
+ pip install mamba-ssm
66
+ ```
67
+
68
+ If any of these two is not installed, the "eager" implementation will be used. Otherwise the more optimised `cuda` kernels will be used.
69
+
70
+ ## Generation
71
+ You can use the classic `generate` API:
72
+ ```python
73
+ >>> from transformers import MambaConfig, MambaForCausalLM, AutoTokenizer
74
+ >>> import torch
75
+
76
+ >>> tokenizer = AutoTokenizer.from_pretrained("state-spaces/mamba-370m-hf")
77
+ >>> model = MambaForCausalLM.from_pretrained("state-spaces/mamba-370m-hf")
78
+ >>> input_ids = tokenizer("Hey how are you doing?", return_tensors="pt")["input_ids"]
79
+
80
+ >>> out = model.generate(input_ids, max_new_tokens=10)
81
+ >>> print(tokenizer.batch_decode(out))
82
+ ["Hey how are you doing?\n\nI'm doing great.\n\nI"]
83
+ ```
84
+
85
+ ## PEFT finetuning example
86
+ In order to finetune using the `peft` library, we recommend keeping the model in float32!
87
+
88
+ ```python
89
+ from datasets import load_dataset
90
+ from trl import SFTTrainer
91
+ from peft import LoraConfig
92
+ from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
93
+ tokenizer = AutoTokenizer.from_pretrained("state-spaces/mamba-370m-hf")
94
+ model = AutoModelForCausalLM.from_pretrained("state-spaces/mamba-370m-hf")
95
+ dataset = load_dataset("Abirate/english_quotes", split="train")
96
+ training_args = TrainingArguments(
97
+ output_dir="./results",
98
+ num_train_epochs=3,
99
+ per_device_train_batch_size=4,
100
+ logging_dir='./logs',
101
+ logging_steps=10,
102
+ learning_rate=2e-3
103
+ )
104
+ lora_config = LoraConfig(
105
+ r=8,
106
+ target_modules=["x_proj", "embeddings", "in_proj", "out_proj"],
107
+ task_type="CAUSAL_LM",
108
+ bias="none"
109
+ )
110
+ trainer = SFTTrainer(
111
+ model=model,
112
+ tokenizer=tokenizer,
113
+ args=training_args,
114
+ peft_config=lora_config,
115
+ train_dataset=dataset,
116
+ dataset_text_field="quote",
117
+ )
118
+ trainer.train()
119
+ ```
120
+