aabbdev commited on
Commit
cf99f40
·
verified ·
1 Parent(s): 4a4cfc1

Close non-thinking chat prefix

Browse files
README.md CHANGED
@@ -81,7 +81,7 @@ optional TileLang inference implementation are distributed with this release.
81
 
82
  | Field | Value |
83
  | --- | --- |
84
- | Repository | `aabbdev/RWKV7-1.5B-20260805` |
85
  | Architecture class | `Rwkv7ForCausalLM` |
86
  | Public size label | `1.5`B |
87
  | Source parameters | `1,527,668,736` |
@@ -116,7 +116,7 @@ from transformers import (
116
  PreTrainedConfig,
117
  )
118
 
119
- model_id = "aabbdev/RWKV7-1.5B-20260805"
120
  tokenizer = AutoTokenizer.from_pretrained(
121
  model_id,
122
  config=PreTrainedConfig(),
@@ -144,7 +144,7 @@ THINK_RE = re.compile(r"\A<think>?\s*(.*?)\s*</think>?", re.DOTALL)
144
 
145
 
146
  def assistant_content(completion, thinking, *, close_incomplete=False):
147
- prefix = "<think" if thinking else "<think></think"
148
  reply = prefix + completion
149
  thinking_block = THINK_RE.match(reply)
150
  if thinking:
@@ -153,7 +153,7 @@ def assistant_content(completion, thinking, *, close_incomplete=False):
153
  return f"{reply.rstrip()}\n</think>".strip()
154
  return "" if thinking_block is None else reply[thinking_block.end():].strip()
155
 
156
- model_id = "aabbdev/RWKV7-1.5B-20260805"
157
  tokenizer = AutoTokenizer.from_pretrained(
158
  model_id,
159
  config=PreTrainedConfig(),
@@ -203,10 +203,11 @@ print(
203
  ```
204
 
205
  Set `thinking=True` for the RWKV thinking prefix. The intentional generation
206
- prefixes are `Assistant: <think></think` and `Assistant: <think`; do not append a
207
- closing `>` to them. The post-processing above reconstructs that prefix before
208
- removing an empty thinking block or preserving an enabled one. If generation hits
209
- the token limit inside thinking, it closes the displayed block before returning it.
 
210
  Reference stops are token ID `0` and `\n\nUser:`.
211
 
212
  Strip trailing spaces from user input. The official RWKV prompt guide is available
@@ -218,14 +219,14 @@ Install the versions listed in `inference/requirements.txt`, then run the bundle
218
  interactive chat:
219
 
220
  ```bash
221
- python inference/generate.py --model aabbdev/RWKV7-1.5B-20260805 --backend auto --interactive
222
  ```
223
 
224
  Or independent prompts separated by blank lines:
225
 
226
  ```bash
227
  python inference/generate.py \
228
- --model aabbdev/RWKV7-1.5B-20260805 \
229
  --backend auto \
230
  --input-file prompts.txt
231
  ```
 
81
 
82
  | Field | Value |
83
  | --- | --- |
84
+ | Repository | `BlinkDL/RWKV7-1.5B-20260805` |
85
  | Architecture class | `Rwkv7ForCausalLM` |
86
  | Public size label | `1.5`B |
87
  | Source parameters | `1,527,668,736` |
 
116
  PreTrainedConfig,
117
  )
118
 
119
+ model_id = "BlinkDL/RWKV7-1.5B-20260805"
120
  tokenizer = AutoTokenizer.from_pretrained(
121
  model_id,
122
  config=PreTrainedConfig(),
 
144
 
145
 
146
  def assistant_content(completion, thinking, *, close_incomplete=False):
147
+ prefix = "<think" if thinking else "<think></think>\n"
148
  reply = prefix + completion
149
  thinking_block = THINK_RE.match(reply)
150
  if thinking:
 
153
  return f"{reply.rstrip()}\n</think>".strip()
154
  return "" if thinking_block is None else reply[thinking_block.end():].strip()
155
 
156
+ model_id = "BlinkDL/RWKV7-1.5B-20260805"
157
  tokenizer = AutoTokenizer.from_pretrained(
158
  model_id,
159
  config=PreTrainedConfig(),
 
203
  ```
204
 
205
  Set `thinking=True` for the RWKV thinking prefix. The intentional generation
206
+ prefixes are `Assistant: <think></think>` followed by a newline and
207
+ `Assistant: <think`. Only the enabled thinking prefix intentionally leaves its opening
208
+ tag incomplete. The post-processing above reconstructs that prefix before removing an
209
+ empty thinking block or preserving an enabled one. If generation hits the token limit
210
+ inside thinking, it closes the displayed block before returning it.
211
  Reference stops are token ID `0` and `\n\nUser:`.
212
 
213
  Strip trailing spaces from user input. The official RWKV prompt guide is available
 
219
  interactive chat:
220
 
221
  ```bash
222
+ python inference/generate.py --model BlinkDL/RWKV7-1.5B-20260805 --backend auto --interactive
223
  ```
224
 
225
  Or independent prompts separated by blank lines:
226
 
227
  ```bash
228
  python inference/generate.py \
229
+ --model BlinkDL/RWKV7-1.5B-20260805 \
230
  --backend auto \
231
  --input-file prompts.txt
232
  ```
chat_template.jinja CHANGED
@@ -51,6 +51,6 @@
51
  {%- if thinking -%}
52
  {{ 'Assistant: <think' }}
53
  {%- else -%}
54
- {{ 'Assistant: <think></think' }}
55
  {%- endif -%}
56
  {%- endif -%}
 
51
  {%- if thinking -%}
52
  {{ 'Assistant: <think' }}
53
  {%- else -%}
54
+ {{ 'Assistant: <think></think>\n' }}
55
  {%- endif -%}
56
  {%- endif -%}
inference/generate.py CHANGED
@@ -59,7 +59,7 @@ class StopOnText(StoppingCriteria):
59
  def _assistant_content(
60
  completion: str, thinking: bool, *, close_incomplete: bool = False
61
  ) -> str:
62
- prefix = "<think" if thinking else "<think></think"
63
  reply = prefix + completion
64
  thinking_block = THINK_RE.match(reply)
65
  if thinking:
 
59
  def _assistant_content(
60
  completion: str, thinking: bool, *, close_incomplete: bool = False
61
  ) -> str:
62
+ prefix = "<think" if thinking else "<think></think>\n"
63
  reply = prefix + completion
64
  thinking_block = THINK_RE.match(reply)
65
  if thinking:
release-manifest.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "builder": {
3
  "asset_set": "2026.08.06-r1",
4
- "assets_sha256": "3c3f6237fcd9dc2ec8ba0b61b626ef72924ebe42bdc6dc49e21a5bfeb19bb96b",
5
  "version": "0.2.0"
6
  },
7
  "conversion": {
@@ -36,13 +36,13 @@
36
  },
37
  "README.md": {
38
  "role": "model_card",
39
- "sha256": "b7795213e1fcf1d9e7de41fa027a0b2d311b2dacfa5a5ba9f62c4c2484bd729f",
40
- "size_bytes": 10260
41
  },
42
  "chat_template.jinja": {
43
  "role": "tokenizer",
44
- "sha256": "f0d8f8161f03d38d0bf68b1ea9a1293064c0fe2b60dfc2874008154c33861c07",
45
- "size_bytes": 2333
46
  },
47
  "config.json": {
48
  "role": "model_config",
@@ -61,8 +61,8 @@
61
  },
62
  "inference/generate.py": {
63
  "role": "inference",
64
- "sha256": "9e4f3461ade971a96a276ec4e18683d6d8df6420b09bf3e63cc499b6e119aa05",
65
- "size_bytes": 7804
66
  },
67
  "inference/kernel.py": {
68
  "role": "inference",
@@ -320,7 +320,7 @@
320
  }
321
  }
322
  },
323
- "schema_version": 6,
324
  "source": {
325
  "filename": "rwkv7-g1i-1.5b-20260805-ctx16384.pth",
326
  "kind": "huggingface",
 
1
  {
2
  "builder": {
3
  "asset_set": "2026.08.06-r1",
4
+ "assets_sha256": "5a31129dcca03f5ecd55157e1561af64aaf35046c77e253fc4d6214b95ab8ede",
5
  "version": "0.2.0"
6
  },
7
  "conversion": {
 
36
  },
37
  "README.md": {
38
  "role": "model_card",
39
+ "sha256": "0f1a8bfe6a0d420333fdf5f7e787e751104348c81c531e3b846a6b0bf7b88d44",
40
+ "size_bytes": 10331
41
  },
42
  "chat_template.jinja": {
43
  "role": "tokenizer",
44
+ "sha256": "abcd52a871eb3f7f0de7b69f2e0ac974fd7cfb03d4acea7a4609cb441f5d9048",
45
+ "size_bytes": 2336
46
  },
47
  "config.json": {
48
  "role": "model_config",
 
61
  },
62
  "inference/generate.py": {
63
  "role": "inference",
64
+ "sha256": "8c2ca021f04b15db07e3724c783867ffeb7e323d71f753523094b69d2338b8f0",
65
+ "size_bytes": 7807
66
  },
67
  "inference/kernel.py": {
68
  "role": "inference",
 
320
  }
321
  }
322
  },
323
+ "schema_version": 7,
324
  "source": {
325
  "filename": "rwkv7-g1i-1.5b-20260805-ctx16384.pth",
326
  "kind": "huggingface",