Views
No views yet


pip3 install --upgrade rwkv-fla transformersexport WKV_MODE=chunk1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3
4model = AutoModelForCausalLM.from_pretrained(
5 "RWKV-Red-Team/ARWKV-R1-1B5",
6 device_map="auto",
7 torch_dtype=torch.float16,
8 trust_remote_code=True,
9)
10tokenizer = AutoTokenizer.from_pretrained(
11 "RWKV-Red-Team/ARWKV-R1-1B5"
12)
13
14system_prompt = "You are a world class trivia AI - provide accurate, succinct responses. "
15messages = [
16 {"role": "system", "content": system_prompt},
17 {"role": "user", "content": prompt}]
18
19text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
20text = text + "<think>"
21print(text)
22model_inputs = tokenizer([text], return_tensors="pt").to(device)
23
24streamer = TextIteratorStreamer(tokenizer, skip_prompt=False, skip_special_tokens=False)
25
26
27generation_kwargs = dict(model_inputs, streamer=streamer, max_new_tokens=8192, do_sample=True,tokenizer=tokenizer,stop_strings=["<|end▁of▁sentence|>"])
28thread = threading.Thread(target=model.generate, kwargs=generation_kwargs)
29thread.start()
30
31print("Streaming output:")
32for new_text in streamer:
33 print(new_text, end="", flush=True)
34
35thread.join()1<|begin▁of▁sentence|>You are a world class trivia AI - provide accurate, succinct responses. <|User|>The world's largest rainforest, home to approximately three million species of plants and animals, is named after which river?<|Assistant|><think>
2Okay, so I'm trying to solve this question about the world's largest rainforest and which river it's named after. Hmm, first, I think rainforest names often have links related to the region it's in. The most famous rainforest in the world is the Amazon. I remember hearing a lot about it being called that because rainforests are connected to specific river systems.
3
4Now, I'm trying to recall which river is named after the Amazon. I think it's the Amazon River. But I want to be sure. Let me see... the Amazon is a major rainforest located in South America. The Amazon River flows through it, which is why it's named after it. That makes sense because it's a very important river. I recall reading somewhere that all the rainforests are named after rivers related to their regions. So if the Amazon is named after its River, then the name would naturally be related to its source.
5
6I wonder if it's the Amazon itself that's named after it, or another river named after it. But the official name for the Amazon is the Amazon Rainforest. The most significant rainforest in the world is the Amazon, and its name probably started with river-sounding names.
7</think>
8
9The largest rainforest located in South America is the Amazon. It is named after the river named after it, which is the Amazon River. Therefore, the Amazon River is the name given to the Amazon Rain Forest.| Component | Specification | Note |
|---|---|---|
| Architecture | RWKV-7 TimeMix + SwiGLU | Hybrid design |
| Context Window | 2048 training CTX | Preview limitation |
| Training Tokens | 40M | Distillation-focused |
| Precision | FP16 inference recommended(16G Vram required) | 15%↑ vs BF16 |
1Transformer Decoder Layer:
2- Multi-head Latent Attention(MLA)
3+ RWKV-7 Time Mixing (Eq.3)
4- RoPE Positional Encoding
5+ State Recurrence
6= Hybrid Layer Output