Update README.md
Browse files
README.md
CHANGED
@@ -63,7 +63,7 @@ You can use this model just as any other HuggingFace models:
|
|
63 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
64 |
model = AutoModelForCausalLM.from_pretrained('fla-hub/rwkv7-1.5B-g1', trust_remote_code=True)
|
65 |
tokenizer = AutoTokenizer.from_pretrained('fla-hub/rwkv7-1.5B-g1', trust_remote_code=True)
|
66 |
-
model = model.cuda()
|
67 |
prompt = "What is a large language model?"
|
68 |
messages = [
|
69 |
{"role": "user", "content": prompt}
|
@@ -71,13 +71,18 @@ messages = [
|
|
71 |
text = tokenizer.apply_chat_template(
|
72 |
messages,
|
73 |
tokenize=False,
|
74 |
-
add_generation_prompt=True
|
|
|
75 |
)
|
76 |
|
77 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
78 |
generated_ids = model.generate(
|
79 |
**model_inputs,
|
80 |
max_new_tokens=1024,
|
|
|
|
|
|
|
|
|
81 |
)
|
82 |
generated_ids = [
|
83 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
|
|
63 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
64 |
model = AutoModelForCausalLM.from_pretrained('fla-hub/rwkv7-1.5B-g1', trust_remote_code=True)
|
65 |
tokenizer = AutoTokenizer.from_pretrained('fla-hub/rwkv7-1.5B-g1', trust_remote_code=True)
|
66 |
+
model = model.cuda() # Supported on Nvidia/AMD/Intel eg. model.xpu()
|
67 |
prompt = "What is a large language model?"
|
68 |
messages = [
|
69 |
{"role": "user", "content": prompt}
|
|
|
71 |
text = tokenizer.apply_chat_template(
|
72 |
messages,
|
73 |
tokenize=False,
|
74 |
+
add_generation_prompt=True,
|
75 |
+
enable_thinking=True # Default is True, set to False to disable thinking
|
76 |
)
|
77 |
|
78 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
79 |
generated_ids = model.generate(
|
80 |
**model_inputs,
|
81 |
max_new_tokens=1024,
|
82 |
+
do_sample=True,
|
83 |
+
temperature=1.0,
|
84 |
+
top_p=0.3,
|
85 |
+
repetition_penalty=1.2
|
86 |
)
|
87 |
generated_ids = [
|
88 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|