from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("RWKV/rwkv-5-world-3b", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("RWKV/rwkv-5-world-3b", trust_remote_code=True)
text = "\nIn a shocking finding, scientist discovered a herd of dragons living in a remote, previously unexplored valley, in Tibet. Even more surprising to the researchers was the fact that the dragons spoke perfect Chinese."
prompt = f'Question: {text.strip()}\n\nAnswer:'
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(inputs["input_ids"], max_new_tokens=256)
print(tokenizer.decode(output[0].tolist(), skip_special_tokens=True))
RWKV/rwkv-5-world-3b的详细解读
https://huggingface.co/RWKV/rwkv-5-world-3b 该模型名为
RWKV/rwkv-5-world-3b
,是一种用于文本生成的模型,使用Transformers库和PyTorch框架进行开发。🔍 模型的主要信息:
⚙️ 模型的使用:
该模型可以通过Hugging Face的Transformers库进行调用。页面提供了在CPU和GPU上运行模型的代码示例。代码分为几个部分:
🖥️ 代码示例:
在CPU上运行的代码:
在GPU上运行的代码:
📊 模型的统计数据:
🚀 推理API:
此模型支持Hugging Face的推理API,可以进行文本生成。