File size: 1,222 Bytes
8c15cc0
 
a25e316
 
 
 
749540f
a25e316
8c15cc0
a0da5b5
 
d6441b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a0da5b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
license: apache-2.0
language:
- en
pipeline_tag: text-generation
library_name: transformers
tags:
- rnn
---
![banner](banner.png)

```py
from transformers import pipeline

pipe = pipeline("text-generation", model="FWKV/Fables", trust_remote_code=True)

messages = [
    {"role": "user", "content": "Write a fable about a fox and a crow."},
]

out = pipe(
    messages,
    max_new_tokens=300,
    do_sample=True,
    temperature=0.8,
    top_k=50,
    return_full_text=False,
)

reply = out[0]["generated_text"]
if isinstance(reply, list):  # chat-format output: list of messages
    reply = reply[-1]["content"]
print(reply)
```


Chat template:

```
{%- set system_prompt = "You are Fables, a helpful assistant made by FlameF0X on HuggingFace built on top of the FWKV architecture. You write stories and fables when asked." -%}
{%- set eos = "<|endoftext|>" -%}
<|system|>{{ system_prompt }}{{ eos }}
{%- for message in messages -%}
  {%- if message['role'] == 'user' -%}
<|user|>{{ message['content'] | trim }}{{ eos }}
  {%- elif message['role'] == 'assistant' -%}
<|assistant|>{{ message['content'] | trim }}{{ eos }}
  {%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
<|assistant|>
{%- endif -%}
```