Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- fla2/layers/__pycache__/attn.cpython-38.pyc +0 -0
- fla2/layers/__pycache__/gsa.cpython-312.pyc +0 -0
- fla2/layers/__pycache__/mask_deltanet.cpython-310.pyc +0 -0
- fla2/layers/__pycache__/multiscale_retention.cpython-312.pyc +0 -0
- fla2/models/emgla-noaux/__pycache__/__init__.cpython-310.pyc +0 -0
- fla2/models/emgla-noaux/__pycache__/modeling_emgla.cpython-310.pyc +0 -0
- fla2/models/emgla/__pycache__/configuration_emgla.cpython-310.pyc +0 -0
- fla2/models/emla-noaux/__pycache__/configuration_emla.cpython-38.pyc +0 -0
- fla2/models/emla-noaux/__pycache__/modeling_emla.cpython-310.pyc +0 -0
- fla2/models/emla-noaux/__pycache__/modeling_emla.cpython-38.pyc +0 -0
- fla2/models/emla/__pycache__/configuration_emgla.cpython-310.pyc +0 -0
- fla2/models/emla/__pycache__/configuration_emla.cpython-312.pyc +0 -0
- fla2/models/emla/__pycache__/configuration_emla.cpython-38.pyc +0 -0
- fla2/models/emla/__pycache__/modeling_emgla.cpython-310.pyc +0 -0
- fla2/models/emla/__pycache__/modeling_emla.cpython-38.pyc +0 -0
- fla2/models/gla/__pycache__/__init__.cpython-39.pyc +0 -0
- fla2/models/gla/__pycache__/modeling_gla.cpython-312.pyc +0 -0
- fla2/models/gla/__pycache__/modeling_gla.cpython-38.pyc +0 -0
- fla2/models/gsa/__pycache__/__init__.cpython-38.pyc +0 -0
- fla2/models/gsa/__pycache__/configuration_gsa.cpython-38.pyc +0 -0
- fla2/models/gsa/__pycache__/modeling_gsa.cpython-312.pyc +0 -0
- fla2/models/gsa/__pycache__/modeling_gsa.cpython-38.pyc +0 -0
- fla2/models/gsa/__pycache__/modeling_gsa.cpython-39.pyc +0 -0
- fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-312.pyc +0 -0
- fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-38.pyc +0 -0
- fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-39.pyc +0 -0
- fla2/models/hgrn/__pycache__/modeling_hgrn.cpython-312.pyc +0 -0
- fla2/models/hgrn2/__pycache__/__init__.cpython-38.pyc +0 -0
- fla2/models/hgrn2/__pycache__/configuration_hgrn2.cpython-312.pyc +0 -0
- fla2/models/hgrn2/__pycache__/modeling_hgrn2.cpython-312.pyc +0 -0
- fla2/models/hgrn2/__pycache__/modeling_hgrn2.cpython-39.pyc +0 -0
- fla2/models/linear_attn/__pycache__/__init__.cpython-312.pyc +0 -0
- fla2/models/linear_attn/__pycache__/__init__.cpython-38.pyc +0 -0
- fla2/models/linear_attn/configuration_linear_attn.py +72 -0
- fla2/models/mamba/__pycache__/__init__.cpython-312.pyc +0 -0
- fla2/models/mamba/__pycache__/__init__.cpython-39.pyc +0 -0
- fla2/models/retnet/__pycache__/modeling_retnet.cpython-39.pyc +0 -0
- fla2/models/samba/__pycache__/configuration_samba.cpython-312.pyc +0 -0
- fla2/models/samba/__pycache__/configuration_samba.cpython-39.pyc +0 -0
- fla2/models/samba/__pycache__/modeling_samba.cpython-38.pyc +0 -0
- fla2/models/transformer/__pycache__/__init__.cpython-310.pyc +0 -0
- fla2/models/transformer/__pycache__/__init__.cpython-312.pyc +0 -0
- fla2/models/transformer/__pycache__/configuration_transformer.cpython-312.pyc +0 -0
- fla2/models/transformer/__pycache__/configuration_transformer.cpython-38.pyc +0 -0
- fla2/models/transformer/__pycache__/configuration_transformer.cpython-39.pyc +0 -0
- fla2/models/transformer/__pycache__/modeling_transformer.cpython-310.pyc +0 -0
- fla2/modules/__pycache__/__init__.cpython-312.pyc +0 -0
- fla2/modules/__pycache__/activations.cpython-312.pyc +0 -0
- fla2/modules/__pycache__/activations.cpython-38.pyc +0 -0
- fla2/modules/__pycache__/activations.cpython-39.pyc +0 -0
fla2/layers/__pycache__/attn.cpython-38.pyc
ADDED
|
Binary file (4.77 kB). View file
|
|
|
fla2/layers/__pycache__/gsa.cpython-312.pyc
ADDED
|
Binary file (13.1 kB). View file
|
|
|
fla2/layers/__pycache__/mask_deltanet.cpython-310.pyc
ADDED
|
Binary file (9.16 kB). View file
|
|
|
fla2/layers/__pycache__/multiscale_retention.cpython-312.pyc
ADDED
|
Binary file (13.5 kB). View file
|
|
|
fla2/models/emgla-noaux/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (520 Bytes). View file
|
|
|
fla2/models/emgla-noaux/__pycache__/modeling_emgla.cpython-310.pyc
ADDED
|
Binary file (11.7 kB). View file
|
|
|
fla2/models/emgla/__pycache__/configuration_emgla.cpython-310.pyc
ADDED
|
Binary file (2.8 kB). View file
|
|
|
fla2/models/emla-noaux/__pycache__/configuration_emla.cpython-38.pyc
ADDED
|
Binary file (2.52 kB). View file
|
|
|
fla2/models/emla-noaux/__pycache__/modeling_emla.cpython-310.pyc
ADDED
|
Binary file (11.7 kB). View file
|
|
|
fla2/models/emla-noaux/__pycache__/modeling_emla.cpython-38.pyc
ADDED
|
Binary file (11.3 kB). View file
|
|
|
fla2/models/emla/__pycache__/configuration_emgla.cpython-310.pyc
ADDED
|
Binary file (2.71 kB). View file
|
|
|
fla2/models/emla/__pycache__/configuration_emla.cpython-312.pyc
ADDED
|
Binary file (3.81 kB). View file
|
|
|
fla2/models/emla/__pycache__/configuration_emla.cpython-38.pyc
ADDED
|
Binary file (2.61 kB). View file
|
|
|
fla2/models/emla/__pycache__/modeling_emgla.cpython-310.pyc
ADDED
|
Binary file (11.7 kB). View file
|
|
|
fla2/models/emla/__pycache__/modeling_emla.cpython-38.pyc
ADDED
|
Binary file (14.1 kB). View file
|
|
|
fla2/models/gla/__pycache__/__init__.cpython-39.pyc
ADDED
|
Binary file (499 Bytes). View file
|
|
|
fla2/models/gla/__pycache__/modeling_gla.cpython-312.pyc
ADDED
|
Binary file (17.9 kB). View file
|
|
|
fla2/models/gla/__pycache__/modeling_gla.cpython-38.pyc
ADDED
|
Binary file (11.1 kB). View file
|
|
|
fla2/models/gsa/__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (497 Bytes). View file
|
|
|
fla2/models/gsa/__pycache__/configuration_gsa.cpython-38.pyc
ADDED
|
Binary file (2.21 kB). View file
|
|
|
fla2/models/gsa/__pycache__/modeling_gsa.cpython-312.pyc
ADDED
|
Binary file (18.9 kB). View file
|
|
|
fla2/models/gsa/__pycache__/modeling_gsa.cpython-38.pyc
ADDED
|
Binary file (11.5 kB). View file
|
|
|
fla2/models/gsa/__pycache__/modeling_gsa.cpython-39.pyc
ADDED
|
Binary file (11.5 kB). View file
|
|
|
fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-312.pyc
ADDED
|
Binary file (2.39 kB). View file
|
|
|
fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-38.pyc
ADDED
|
Binary file (1.75 kB). View file
|
|
|
fla2/models/hgrn/__pycache__/configuration_hgrn.cpython-39.pyc
ADDED
|
Binary file (1.76 kB). View file
|
|
|
fla2/models/hgrn/__pycache__/modeling_hgrn.cpython-312.pyc
ADDED
|
Binary file (18.1 kB). View file
|
|
|
fla2/models/hgrn2/__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (513 Bytes). View file
|
|
|
fla2/models/hgrn2/__pycache__/configuration_hgrn2.cpython-312.pyc
ADDED
|
Binary file (2.39 kB). View file
|
|
|
fla2/models/hgrn2/__pycache__/modeling_hgrn2.cpython-312.pyc
ADDED
|
Binary file (18.2 kB). View file
|
|
|
fla2/models/hgrn2/__pycache__/modeling_hgrn2.cpython-39.pyc
ADDED
|
Binary file (11.3 kB). View file
|
|
|
fla2/models/linear_attn/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (758 Bytes). View file
|
|
|
fla2/models/linear_attn/__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (573 Bytes). View file
|
|
|
fla2/models/linear_attn/configuration_linear_attn.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
from typing import Optional
|
| 4 |
+
|
| 5 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class LinearAttentionConfig(PretrainedConfig):
|
| 9 |
+
|
| 10 |
+
model_type = 'linear_attn'
|
| 11 |
+
keys_to_ignore_at_inference = ['past_key_values']
|
| 12 |
+
|
| 13 |
+
def __init__(
|
| 14 |
+
self,
|
| 15 |
+
vocab_size: int = 32000,
|
| 16 |
+
hidden_size: int = 2048,
|
| 17 |
+
expand_k: int = 1,
|
| 18 |
+
expand_v: int = 1,
|
| 19 |
+
hidden_ratio: Optional[int] = 4,
|
| 20 |
+
intermediate_size: Optional[int] = None,
|
| 21 |
+
num_hidden_layers: int = 24,
|
| 22 |
+
num_heads: int = 4,
|
| 23 |
+
num_kv_heads: Optional[int] = None,
|
| 24 |
+
attn_mode: str = "fused_chunk",
|
| 25 |
+
feature_map: str = "elementwise_product",
|
| 26 |
+
tie_feature_map_qk: bool = False,
|
| 27 |
+
norm_q: bool = False,
|
| 28 |
+
norm_k: bool = False,
|
| 29 |
+
norm_feature_map: bool = False,
|
| 30 |
+
hidden_act: str = "swish",
|
| 31 |
+
max_position_embeddings: int = 2048,
|
| 32 |
+
elementwise_affine: Optional[bool] = True,
|
| 33 |
+
norm_eps: float = 1e-6,
|
| 34 |
+
use_cache: bool = True,
|
| 35 |
+
pad_token_id: int = None,
|
| 36 |
+
bos_token_id: int = 1,
|
| 37 |
+
eos_token_id: int = 2,
|
| 38 |
+
tie_word_embeddings: bool = False,
|
| 39 |
+
initializer_range: float = 0.02,
|
| 40 |
+
fuse_cross_entropy: bool = True,
|
| 41 |
+
**kwargs
|
| 42 |
+
):
|
| 43 |
+
self.vocab_size = vocab_size
|
| 44 |
+
self.max_position_embeddings = max_position_embeddings
|
| 45 |
+
self.hidden_size = hidden_size
|
| 46 |
+
self.expand_k = expand_k
|
| 47 |
+
self.expand_v = expand_v
|
| 48 |
+
self.hidden_ratio = hidden_ratio
|
| 49 |
+
self.intermediate_size = intermediate_size
|
| 50 |
+
self.num_hidden_layers = num_hidden_layers
|
| 51 |
+
self.num_heads = num_heads
|
| 52 |
+
self.num_kv_heads = num_kv_heads
|
| 53 |
+
self.attn_mode = attn_mode
|
| 54 |
+
self.feature_map = feature_map
|
| 55 |
+
self.tie_feature_map_qk = tie_feature_map_qk
|
| 56 |
+
self.norm_q = norm_q
|
| 57 |
+
self.norm_k = norm_k
|
| 58 |
+
self.norm_feature_map = norm_feature_map
|
| 59 |
+
self.hidden_act = hidden_act
|
| 60 |
+
self.elementwise_affine = elementwise_affine
|
| 61 |
+
self.norm_eps = norm_eps
|
| 62 |
+
self.use_cache = use_cache
|
| 63 |
+
self.initializer_range = initializer_range
|
| 64 |
+
self.fuse_cross_entropy = fuse_cross_entropy
|
| 65 |
+
|
| 66 |
+
super().__init__(
|
| 67 |
+
pad_token_id=pad_token_id,
|
| 68 |
+
bos_token_id=bos_token_id,
|
| 69 |
+
eos_token_id=eos_token_id,
|
| 70 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 71 |
+
**kwargs,
|
| 72 |
+
)
|
fla2/models/mamba/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (738 Bytes). View file
|
|
|
fla2/models/mamba/__pycache__/__init__.cpython-39.pyc
ADDED
|
Binary file (548 Bytes). View file
|
|
|
fla2/models/retnet/__pycache__/modeling_retnet.cpython-39.pyc
ADDED
|
Binary file (11.2 kB). View file
|
|
|
fla2/models/samba/__pycache__/configuration_samba.cpython-312.pyc
ADDED
|
Binary file (3.31 kB). View file
|
|
|
fla2/models/samba/__pycache__/configuration_samba.cpython-39.pyc
ADDED
|
Binary file (2.28 kB). View file
|
|
|
fla2/models/samba/__pycache__/modeling_samba.cpython-38.pyc
ADDED
|
Binary file (13.1 kB). View file
|
|
|
fla2/models/transformer/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (551 Bytes). View file
|
|
|
fla2/models/transformer/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (729 Bytes). View file
|
|
|
fla2/models/transformer/__pycache__/configuration_transformer.cpython-312.pyc
ADDED
|
Binary file (2.35 kB). View file
|
|
|
fla2/models/transformer/__pycache__/configuration_transformer.cpython-38.pyc
ADDED
|
Binary file (1.73 kB). View file
|
|
|
fla2/models/transformer/__pycache__/configuration_transformer.cpython-39.pyc
ADDED
|
Binary file (1.73 kB). View file
|
|
|
fla2/models/transformer/__pycache__/modeling_transformer.cpython-310.pyc
ADDED
|
Binary file (10.8 kB). View file
|
|
|
fla2/modules/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (900 Bytes). View file
|
|
|
fla2/modules/__pycache__/activations.cpython-312.pyc
ADDED
|
Binary file (18.9 kB). View file
|
|
|
fla2/modules/__pycache__/activations.cpython-38.pyc
ADDED
|
Binary file (10.8 kB). View file
|
|
|
fla2/modules/__pycache__/activations.cpython-39.pyc
ADDED
|
Binary file (10.7 kB). View file
|
|
|