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.
Files changed (56) hide show
  1. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/PKG-INFO +1 -1
  2. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/PKG-INFO +1 -1
  3. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/__init__.py +1 -1
  4. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/cmix/__init__.py +3 -2
  5. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/tokenshift/__init__.py +11 -14
  6. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/pyproject.toml +1 -1
  7. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/setup.py +20 -0
  8. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/SOURCES.txt +0 -0
  9. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/dependency_links.txt +0 -0
  10. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/not-zip-safe +0 -0
  11. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/requires.txt +0 -0
  12. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/FlashRWKV2.egg-info/top_level.txt +0 -0
  13. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/LICENSE +0 -0
  14. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/LICENSES/Apache-2.0.txt +0 -0
  15. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/MANIFEST.in +0 -0
  16. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/NOTICE +0 -0
  17. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/README.md +0 -0
  18. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/bindings.cpp +0 -0
  19. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/bindings.h +0 -0
  20. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/registration.cpp +0 -0
  21. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/sm80/sampling/infer_fp32_forward_varlen.cpp +0 -0
  22. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/sm80/sampling/infer_fp32_forward_varlen.cu +0 -0
  23. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation/recurrent_metadata.cpp +0 -0
  24. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation/recurrent_metadata.cu +0 -0
  25. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation.cpp +0 -0
  26. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/csrc/validation.h +0 -0
  27. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/elementwise.py +0 -0
  28. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/execution.py +0 -0
  29. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/linear.py +0 -0
  30. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/logprob.py +0 -0
  31. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/_internal/state.py +0 -0
  32. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/compile.py +0 -0
  33. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/embedding/__init__.py +0 -0
  34. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/ce/__init__.py +0 -0
  35. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/ce/tilelang.py +0 -0
  36. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/l2wrap_ce/__init__.py +0 -0
  37. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/head/linear/__init__.py +0 -0
  38. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/loss/l2wrap_ce/__init__.py +0 -0
  39. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/loss/l2wrap_ce/tilelang.py +0 -0
  40. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/mtp/__init__.py +0 -0
  41. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/post_norm/__init__.py +0 -0
  42. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/post_norm/tilelang.py +0 -0
  43. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/sampling/__init__.py +0 -0
  44. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/kk_pre/tilelang.py +0 -0
  45. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/__init__.py +0 -0
  46. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/pretrain.py +0 -0
  47. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/readout/tilelang.py +0 -0
  48. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/tokenshift/tilelang.py +0 -0
  49. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/vres_gate/tilelang.py +0 -0
  50. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/__init__.py +0 -0
  51. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/pretrain.py +0 -0
  52. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv7/tilelang.py +0 -0
  53. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv_prepare/__init__.py +0 -0
  54. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/flashrwkv2/tmix/wkv_prepare/tilelang.py +0 -0
  55. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/setup.cfg +0 -0
  56. {flashrwkv2-0.2.0a2 → flashrwkv2-0.2.0a4}/tests/test_runtime.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FlashRWKV2
3
- Version: 0.2.0a2
3
+ Version: 0.2.0a4
4
4
  Summary: TileLang RWKV-7 operators with shared BF16 training and inference
5
5
  License-Expression: MIT
6
6
  Project-URL: Repository, https://github.com/rwkv-rs/FlashRWKV2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FlashRWKV2
3
- Version: 0.2.0a2
3
+ Version: 0.2.0a4
4
4
  Summary: TileLang RWKV-7 operators with shared BF16 training and inference
5
5
  License-Expression: MIT
6
6
  Project-URL: Repository, https://github.com/rwkv-rs/FlashRWKV2
@@ -81,4 +81,4 @@ __all__ = [
81
81
  "setup_sampling_states",
82
82
  ]
83
83
 
84
- __version__ = "0.2.0a1"
84
+ __version__ = "0.2.0a4"
@@ -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
- return _postnorm_tokenshift_varlen(
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=(), project=None,
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
- fused = ticket._max_seqlen() == 1 and x.shape[0] == indices.numel()
78
- if fused:
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
- else:
84
- normalized, total = norm(x, weight, bias, eps, res, return_res=True)
85
- initial = gather_state(shift_state_pool, indices, status)
86
- mixed, final = tokenshift(
87
- normalized, mixes, cu, initial, _status=status, _save_normalized=save_normalized,
88
- )
89
- output = mixed if project is None else project(mixed)
90
- if not fused:
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(
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "FlashRWKV2"
10
- version = "0.2.0a2"
10
+ version = "0.2.0a4"
11
11
  description = "TileLang RWKV-7 operators with shared BF16 training and inference"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.10"
@@ -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