Idiap-Data commited on
Commit
3c21bee
·
verified ·
1 Parent(s): 3258e34

Upload 8 files

Browse files
LICENSE.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Idiap Research Institute
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,3 +1,54 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ # gated-deltanet-attn-0.4B-10B
6
+
7
+ Gated DeltaNet + full attention (0.4B params, 10B tokens)
8
+
9
+ ## Overview
10
+
11
+ * **Training**: gated-deltanet-attn-0.4B-10B was trained on [FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu), which is realeased under [ODC-By v1.0](https://opendatacommons.org/licenses/by/1-0/)
12
+ * **Parameters**: 0.4B
13
+ * **Task**: Language modeling
14
+ * **Framework**: HuggingFace, [flash-linear-attention](https://github.com/fla-org/flash-linear-attention)
15
+ * **Output structure**: [batch_size, sequence_length, num_logits]
16
+
17
+ ## Performance
18
+
19
+ Various; available in paper
20
+
21
+ ## Running Code
22
+
23
+ * Minimal code to instantiate the model and perform inference:
24
+ ```python
25
+ # Requires flash-linear-attention (https://github.com/fla-org/flash-linear-attention)
26
+ import fla
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+ model = AutoModelForCausalLM.from_pretrained(path_to_model).cuda()
29
+ tokenizer = AutoTokenizer.from_pretrained(path_to_model).cuda()
30
+ input_ids = tokenizer("All human beings are", return_tensors="pt").input_ids
31
+ outputs = model.generate(input_ids, max_length=15)
32
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
33
+ ```
34
+
35
+ ## License
36
+
37
+ HyperFace is released under [MIT License](LICENSE.txt)
38
+
39
+ ## Citation
40
+
41
+ If you find our work useful, please cite the following publication:
42
+
43
+ ```bibtex
44
+ @misc{he_alleviating_2025,
45
+ title = {Alleviating {Forgetfulness} of {Linear} {Attention} by {Hybrid} {Sparse} {Attention} and {Contextualized} {Learnable} {Token} {Eviction}},
46
+ url = {http://arxiv.org/abs/2510.20787},
47
+ doi = {10.48550/arXiv.2510.20787},
48
+ publisher = {arXiv},
49
+ author = {He, Mutian and Garner, Philip N.},
50
+ month = oct,
51
+ year = {2025},
52
+ note = {arXiv:2510.20787 [cs]},
53
+ }
54
+ ```
config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "exp/gated_deltanet-h-Q16_K16-340M-c4K-10B/re2_batch32.seqlen4096.warmup1024.steps20480.lr3e-4/config.json",
3
+ "architectures": [
4
+ "GatedDeltaNetForCausalLM"
5
+ ],
6
+ "attn": {
7
+ "layers": [
8
+ 1,
9
+ 3,
10
+ 5,
11
+ 7,
12
+ 9,
13
+ 11,
14
+ 13,
15
+ 15,
16
+ 17,
17
+ 19,
18
+ 21,
19
+ 23
20
+ ],
21
+ "num_heads": 16,
22
+ "num_kv_heads": 16,
23
+ "qkv_bias": false,
24
+ "rope_theta": 10000.0,
25
+ "window_size": null
26
+ },
27
+ "attn_mode": "chunk",
28
+ "bos_token_id": 1,
29
+ "conv_size": 4,
30
+ "eos_token_id": 2,
31
+ "expand_v": 1,
32
+ "fuse_cross_entropy": true,
33
+ "fuse_norm": true,
34
+ "fuse_swiglu": true,
35
+ "head_dim": 128,
36
+ "hidden_act": "swish",
37
+ "hidden_ratio": 4,
38
+ "hidden_size": 1024,
39
+ "initializer_range": 0.006,
40
+ "intermediate_size": null,
41
+ "max_position_embeddings": 4096,
42
+ "model_type": "gated_deltanet",
43
+ "norm_eps": 1e-06,
44
+ "num_heads": 8,
45
+ "num_hidden_layers": 24,
46
+ "tie_word_embeddings": true,
47
+ "torch_dtype": "float32",
48
+ "transformers_version": "4.49.0",
49
+ "use_cache": true,
50
+ "use_gate": true,
51
+ "use_short_conv": true,
52
+ "vocab_size": 32000
53
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.49.0"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00d0c14cbf6226f68ba64ac5dc77a9fdcd7f6025142607c030016975943e1d95
3
+ size 1416148088
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "additional_special_tokens": [],
32
+ "bos_token": "<s>",
33
+ "clean_up_tokenization_spaces": false,
34
+ "eos_token": "</s>",
35
+ "extra_special_tokens": {},
36
+ "legacy": true,
37
+ "model_max_length": 1000000000000000019884624838656,
38
+ "pad_token": null,
39
+ "sp_model_kwargs": {},
40
+ "spaces_between_special_tokens": false,
41
+ "tokenizer_class": "LlamaTokenizer",
42
+ "unk_token": "<unk>",
43
+ "use_default_system_prompt": false
44
+ }