It is broken into two parts: installation and setup, and then usage with an example.Installation and Setup‚ÄãInstall the Python package with pip install rwkvInstall the tokenizer Python package with pip install tokenizerDownload a RWKV model and place it in your desired directoryDownload the tokens fileUsage‚ÄãRWKV‚ÄãTo use the RWKV wrapper, you need to provide the path to the pre-trained model file and the tokenizer's configuration.from langchain.llms import RWKV# Test the model```pythondef generate_prompt(instruction, input=None):    if input:        return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.# Instruction:{instruction}# Input:{input}# Response:"""    else:        return f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.# Instruction:{instruction}# Response:"""model = RWKV(model="./models/RWKV-4-Raven-3B-v7-Eng-20230404-ctx4096.pth", strategy="cpu fp32", tokens_path="./rwkv/20B_tokenizer.json")response = model(generate_prompt("Once upon a time, "))Model File‚ÄãYou can find links to model file downloads at the RWKV-4-Raven repository.Rwkv-4 models -> recommended VRAM‚ÄãRWKV VRAMModel | 8bit | bf16/fp16 | fp3214B   | 16GB | 28GB      | >50GB7B    | 8GB  | 14GB      | 28GB3B    | 2.8GB| 6GB       | 12GB1b5   | 1.3GB| 3GB       | 6GBSee the rwkv pip page for more information about strategies, including streaming and cuda support.PreviousRunhouseNextScaNNInstallation and SetupUsageRWKVModel FileRwkv-4 models -> recommended VRAMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This page covers how to use the RWKV-4 wrapper within LangChain.
This page covers how to use the RWKV-4 wrapper within LangChain. ->: It is broken into two parts: installation and setup, and then usage with an example.Installation and Setup‚ÄãInstall the Python package with pip install rwkvInstall the tokenizer Python package with pip install tokenizerDownload a RWKV model and place it in your desired directoryDownload the tokens fileUsage‚ÄãRWKV‚ÄãTo use the RWKV wrapper, you need to provide the path to the pre-trained model file and the tokenizer's configuration.from langchain.llms import RWKV# Test the model```pythondef generate_prompt(instruction, input=None):    if input:        return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.# Instruction:{instruction}# Input:{input}# Response:"""    else:        return f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.# Instruction:{instruction}# Response:"""model = RWKV(model="./models/RWKV-4-Raven-3B-v7-Eng-20230404-ctx4096.pth", strategy="cpu fp32", tokens_path="./rwkv/20B_tokenizer.json")response = model(generate_prompt("Once upon a time, "))Model File‚ÄãYou can find links to model file downloads at the RWKV-4-Raven repository.Rwkv-4 models -> recommended VRAM‚ÄãRWKV VRAMModel | 8bit | bf16/fp16 | fp3214B   | 16GB | 28GB      | >50GB7B    | 8GB  | 14GB      | 28GB3B    | 2.8GB| 6GB       | 12GB1b5   | 1.3GB| 3GB       | 6GBSee the rwkv pip page for more information about strategies, including streaming and cuda support.PreviousRunhouseNextScaNNInstallation and SetupUsageRWKVModel FileRwkv-4 models -> recommended VRAMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.