IlyasMoutawwakil HF Staff commited on
Commit
fcf43f4
·
verified ·
1 Parent(s): 4110997

Mirror from rkazants/tiny-falcon-mamba

Browse files
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ ```python
6
+ import os
7
+ from transformers import FalconMambaConfig, FalconMambaModel, AutoTokenizer
8
+
9
+ model_dir = "tiiuae/falcon-mamba-7b"
10
+ tokenizer = AutoTokenizer.from_pretrained(model_dir)
11
+
12
+ # === Step 1: Define tiny model config ===
13
+ config = FalconMambaConfig(
14
+ d_model=8, # Dimensionality of the input embeddings (model hidden size)
15
+ n_layer=2, # Number of Mamba layers (or blocks) in the model
16
+ d_state=32, # Dimensionality of the internal state used in the Mamba block (e.g., for state-space modeling)
17
+ expand=2, # Expansion factor used in the Mamba block, typically to widen the intermediate dimensions
18
+ conv_kernel=3, # Size of the convolution kernel used in the Mamba block (affects temporal mixing)
19
+ vocab_size=50280, # Size of the vocabulary (number of unique tokens)
20
+ num_hidden_layers=16, # Total number of hidden layers in the model (could override `n_layer`)
21
+ hidden_size=64, # Size of hidden states used in the model layers (could override `d_model`)
22
+ )
23
+
24
+ # === Step 2: Create model from config ===
25
+ model = FalconMambaModel(config)
26
+
27
+ # === Step 4: Save model and tokenizer to disk ===
28
+ output_dir = "./tiny-falcon-mamba"
29
+ os.makedirs(output_dir, exist_ok=True)
30
+ model.save_pretrained(output_dir)
31
+ tokenizer.save_pretrained(output_dir)
32
+ print(f"Tiny Mamba model and tokenizer saved to: {output_dir}")
33
+ ```
config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "FalconMambaModel"
4
+ ],
5
+ "bos_token_id": 0,
6
+ "conv_kernel": 3,
7
+ "d_model": 8,
8
+ "d_state": 32,
9
+ "eos_token_id": 0,
10
+ "expand": 2,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 64,
13
+ "initializer_range": 0.1,
14
+ "intermediate_size": 128,
15
+ "layer_norm_epsilon": 1e-05,
16
+ "mixer_rms_eps": 1e-06,
17
+ "model_type": "falcon_mamba",
18
+ "n_layer": 2,
19
+ "num_hidden_layers": 16,
20
+ "pad_token_id": 0,
21
+ "rescale_prenorm_residual": false,
22
+ "residual_in_fp32": true,
23
+ "state_size": 16,
24
+ "time_step_floor": 0.0001,
25
+ "time_step_init_scheme": "random",
26
+ "time_step_max": 0.1,
27
+ "time_step_min": 0.001,
28
+ "time_step_rank": 4,
29
+ "time_step_scale": 1.0,
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.49.0",
32
+ "use_bias": false,
33
+ "use_cache": true,
34
+ "use_conv_bias": true,
35
+ "use_mambapy": false,
36
+ "vocab_size": 50280
37
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a269ef69f0f456e280769a2ea19b211ac3a4ef5493417d0e3bd41b9766ad17b
3
+ size 14972264
special_tokens_map.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ ">>TITLE<<",
4
+ ">>ABSTRACT<<",
5
+ ">>INTRODUCTION<<",
6
+ ">>SUMMARY<<",
7
+ ">>COMMENT<<",
8
+ ">>ANSWER<<",
9
+ ">>QUESTION<<",
10
+ ">>DOMAIN<<",
11
+ ">>PREFIX<<",
12
+ ">>SUFFIX<<",
13
+ ">>MIDDLE<<"
14
+ ],
15
+ "eos_token": {
16
+ "content": "<|endoftext|>",
17
+ "lstrip": false,
18
+ "normalized": false,
19
+ "rstrip": false,
20
+ "single_word": false
21
+ }
22
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": ">>TITLE<<",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": ">>ABSTRACT<<",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": ">>INTRODUCTION<<",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": ">>SUMMARY<<",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": ">>COMMENT<<",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": ">>ANSWER<<",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": ">>QUESTION<<",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": ">>DOMAIN<<",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": ">>PREFIX<<",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": ">>SUFFIX<<",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": ">>MIDDLE<<",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<|endoftext|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ }
100
+ },
101
+ "additional_special_tokens": [
102
+ ">>TITLE<<",
103
+ ">>ABSTRACT<<",
104
+ ">>INTRODUCTION<<",
105
+ ">>SUMMARY<<",
106
+ ">>COMMENT<<",
107
+ ">>ANSWER<<",
108
+ ">>QUESTION<<",
109
+ ">>DOMAIN<<",
110
+ ">>PREFIX<<",
111
+ ">>SUFFIX<<",
112
+ ">>MIDDLE<<"
113
+ ],
114
+ "clean_up_tokenization_spaces": true,
115
+ "eos_token": "<|endoftext|>",
116
+ "extra_special_tokens": {},
117
+ "model_input_names": [
118
+ "input_ids",
119
+ "attention_mask"
120
+ ],
121
+ "model_max_length": 1000000000000000019884624838656,
122
+ "padding_side": "left",
123
+ "tokenizer_class": "PreTrainedTokenizer"
124
+ }