Skip to content

Fix RWKV framework integration contracts - #8

Merged
Cai-z-us merged 1 commit into
mainfrom
codex/fix-rwkv-framework-contracts
Aug 24, 2026
Merged

Fix RWKV framework integration contracts#8
Cai-z-us merged 1 commit into
mainfrom
codex/fix-rwkv-framework-contracts

Conversation

@Cai-z-us

@Cai-z-us Cai-z-us commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • align the public RWKV forwards with the standard Transformers decorator contracts while preserving tuple/model-output behavior and the existing hidden-state boundaries
  • delegate generation input preparation to GenerationMixin, retaining only RWKV's cached-decode attention-mask rule, and mark the recurrent cache as non-compilable
  • move the pinned FlashRWKV2 training, stateful-training, and inference API checks into a thin lazy integration adapter
  • remove explicit trust_remote_code=False from native RWKV tokenizer and conversion loading tests

This intentionally excludes the proposed Qwen2/RWKV composition example and does not add padding/ragged batching, gradient checkpointing, tensor parallelism, compile/export, provider fallbacks, or kernel/backend changes.

Validation

Local ./.venv loaded FlashRWKV2==0.1.0a8 from the installed public package.

  • UV_CACHE_DIR=/tmp/transformers-rwkv-uv-cache uv run pytest -q tests/models/rwkv/test_tokenization_rwkv.py tests/models/rwkv/test_modeling_rwkv.py53 passed, 2 skipped; the available CUDA cases covered training forward/backward, stateful training, prefill/decode continuation, hidden-state capture, tuple output, greedy generation, stream-scoped metadata, and CUDA Graph capture
  • UV_CACHE_DIR=/tmp/transformers-rwkv-uv-cache uv run make typing — passed both type annotations and modeling structure checks with the branch-pinned transformers-mlinter==0.1.2
  • UV_CACHE_DIR=/tmp/transformers-rwkv-uv-cache uv run make style — passed
  • git diff --check origin/main...HEAD — passed

The planned independent run on rwkv-sha-pro6000x8 was stopped before syncing because its existing rwkv worktree has overlapping uncommitted RWKV test changes. Nothing on that remote worktree was modified. A read-only environment check confirmed that it loads FlashRWKV2==0.1.0a8.

Initial fork CI was checked after opening this PR. Check code quality, Check repository consistency, and Test preparation (fetcher) each failed before executing any step with the GitHub annotation Required runner group 'aws-m8i-l-cache' not found; their dependent test jobs were therefore skipped. The independent anti-slop and security-gate / bandit-check checks passed. This is a fork runner-configuration blocker, not a source-test failure.

Upstream relationship

Hugging Face Transformers already has overlapping RWKV-7 work in #47780 and #47787. This PR maintains the FlashRWKV2-specific implementation in the rwkv-rs/transformers-rwkv fork only; it does not claim to replace or supersede that upstream work.

AI assistance

This implementation was AI-assisted. The resulting four-file diff was reviewed path-by-path and validated with the commands and results above.

@github-actions

Copy link
Copy Markdown

CI recap

Dashboard: View test results in Grafana
Latest run: 32758194100
Result: failure | Grafana metrics are not available yet.

Code quality check failed: test jobs were skipped. Fix the code quality issues and push again to run tests.

@github-actions

Copy link
Copy Markdown

[For maintainers] Suggested jobs to run (before merge)

run-slow: rwkv

@Cai-z-us
Cai-z-us merged commit 52ba991 into main Aug 24, 2026
28 of 33 checks passed
@Cai-z-us
Cai-z-us deleted the codex/fix-rwkv-framework-contracts branch August 25, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant