FlashRWKV2 0.2.0a2__tar.gz → 0.2.0a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/PKG-INFO +1 -1
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/PKG-INFO +1 -1
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/__init__.py +1 -1
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/cmix/__init__.py +3 -2
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/tokenshift/__init__.py +11 -14
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/pyproject.toml +1 -1
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/setup.py +20 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/SOURCES.txt +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/dependency_links.txt +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/not-zip-safe +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/requires.txt +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/top_level.txt +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/LICENSE +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/LICENSES/Apache-2.0.txt +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/MANIFEST.in +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/NOTICE +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/README.md +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/bindings.cpp +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/bindings.h +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/registration.cpp +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/sm80/sampling/infer_fp32_forward_varlen.cpp +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/sm80/sampling/infer_fp32_forward_varlen.cu +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation/recurrent_metadata.cpp +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation/recurrent_metadata.cu +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation.cpp +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation.h +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/elementwise.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/execution.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/linear.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/logprob.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/state.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/compile.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/embedding/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/ce/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/ce/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/l2wrap_ce/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/linear/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/loss/l2wrap_ce/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/loss/l2wrap_ce/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/mtp/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/post_norm/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/post_norm/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/sampling/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/kk_pre/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/pretrain.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/tokenshift/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/vres_gate/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/pretrain.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv_prepare/__init__.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv_prepare/tilelang.py +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/setup.cfg +0 -0
- {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/tests/test_runtime.py +0 -0
|
@@ -64,6 +64,7 @@ def infer_cmix_forward_varlen(
|
|
|
64
64
|
|
|
65
65
|
The inference value weight retains its runtime [F,C] layout. A transpose
|
|
66
66
|
view feeds the same projection as the training [C,F] weight.
|
|
67
|
+
Projection weights and adapters must use storage separate from ``shift_state_pool``.
|
|
67
68
|
``save_normalized`` optionally receives the BF16 shift state of each
|
|
68
69
|
active input row.
|
|
69
70
|
"""
|
|
@@ -77,12 +78,12 @@ def infer_cmix_forward_varlen(
|
|
|
77
78
|
(value_lora_a, value_lora_b, value_lora_scale, value_use_nora),
|
|
78
79
|
),
|
|
79
80
|
)
|
|
80
|
-
|
|
81
|
+
residual, (mixed,) = _postnorm_tokenshift_varlen(
|
|
81
82
|
x, res, weight, bias, (x_k,), shift_state_pool, cu_seqlens, state_indices,
|
|
82
83
|
max_seqlen, eps, validated_metadata, save_normalized=save_normalized,
|
|
83
84
|
save_inputs=(key_weight, value_weight, key_lora_a, key_lora_b, value_lora_a, value_lora_b),
|
|
84
|
-
project=lambda mixed: _project(mixed[0], key_weight, value_weight, adapters),
|
|
85
85
|
)
|
|
86
|
+
return residual, _project(mixed, key_weight, value_weight, adapters)
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
def pretrain_cmix_bf16(
|
|
@@ -47,7 +47,7 @@ def infer_tmix_postnorm_tokenshift_forward_varlen(
|
|
|
47
47
|
|
|
48
48
|
def _postnorm_tokenshift_varlen(
|
|
49
49
|
x, res, weight, bias, mixes, shift_state_pool, cu_seqlens, state_indices,
|
|
50
|
-
max_seqlen, eps, validated_metadata, *, save_normalized=None, save_inputs=(),
|
|
50
|
+
max_seqlen, eps, validated_metadata, *, save_normalized=None, save_inputs=(),
|
|
51
51
|
):
|
|
52
52
|
from ..._internal.state import gather_state, scatter_state
|
|
53
53
|
from ...post_norm.tilelang import norm
|
|
@@ -74,22 +74,19 @@ def _postnorm_tokenshift_varlen(
|
|
|
74
74
|
)
|
|
75
75
|
cu = ticket._query_start_loc_snapshot()
|
|
76
76
|
indices, status = ticket._state_indices_snapshot(), ticket._status()
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
total, mixed = fused_post_norm_tokenshift(
|
|
77
|
+
if ticket._max_seqlen() == 1 and x.shape[0] == indices.numel():
|
|
78
|
+
return fused_post_norm_tokenshift(
|
|
80
79
|
x, res, weight, bias, mixes, shift_state_pool, indices, status, eps,
|
|
81
80
|
save_normalized=save_normalized,
|
|
82
81
|
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
scatter_state(shift_state_pool, final, indices, status)
|
|
92
|
-
return total, output
|
|
82
|
+
|
|
83
|
+
normalized, total = norm(x, weight, bias, eps, res, return_res=True)
|
|
84
|
+
initial = gather_state(shift_state_pool, indices, status)
|
|
85
|
+
mixed, final = tokenshift(
|
|
86
|
+
normalized, mixes, cu, initial, _status=status, _save_normalized=save_normalized,
|
|
87
|
+
)
|
|
88
|
+
scatter_state(shift_state_pool, final, indices, status)
|
|
89
|
+
return total, mixed
|
|
93
90
|
|
|
94
91
|
|
|
95
92
|
def pretrain_tmix_tokenshift_bf16(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
|
|
3
|
+
import ast
|
|
3
4
|
import shutil
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
@@ -10,6 +11,23 @@ from setuptools.command.sdist import sdist
|
|
|
10
11
|
ROOT = Path(__file__).resolve().parent
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
def _check_runtime_version(distribution_version: str) -> None:
|
|
15
|
+
init = ROOT / "flashrwkv2" / "__init__.py"
|
|
16
|
+
module = ast.parse(init.read_text(encoding="utf-8"), filename=str(init))
|
|
17
|
+
(value,) = (
|
|
18
|
+
node.value
|
|
19
|
+
for node in module.body
|
|
20
|
+
if isinstance(node, ast.Assign)
|
|
21
|
+
and any(isinstance(target, ast.Name) and target.id == "__version__" for target in node.targets)
|
|
22
|
+
)
|
|
23
|
+
runtime_version = ast.literal_eval(value)
|
|
24
|
+
if runtime_version != distribution_version:
|
|
25
|
+
raise ValueError(
|
|
26
|
+
f"flashrwkv2.__version__ is {runtime_version}, "
|
|
27
|
+
f"but the distribution version is {distribution_version}"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
13
31
|
def _copy_native_sources(destination: Path) -> None:
|
|
14
32
|
if destination.exists():
|
|
15
33
|
shutil.rmtree(destination)
|
|
@@ -20,6 +38,7 @@ class SourceBuildPy(build_py):
|
|
|
20
38
|
"""Include the native source tree without importing Torch or running NVCC."""
|
|
21
39
|
|
|
22
40
|
def run(self):
|
|
41
|
+
_check_runtime_version(self.distribution.get_version())
|
|
23
42
|
super().run()
|
|
24
43
|
_copy_native_sources(Path(self.build_lib) / "flashrwkv2" / "_csrc")
|
|
25
44
|
|
|
@@ -28,6 +47,7 @@ class SourceSdist(sdist):
|
|
|
28
47
|
"""Keep the same native source tree in source distributions."""
|
|
29
48
|
|
|
30
49
|
def make_release_tree(self, base_dir, files):
|
|
50
|
+
_check_runtime_version(self.distribution.get_version())
|
|
31
51
|
super().make_release_tree(base_dir, files)
|
|
32
52
|
_copy_native_sources(Path(base_dir) / "csrc")
|
|
33
53
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|