rwkv-raven / app.py
jeevavijay10's picture
Update app.py
afbb139
from transformers import AutoTokenizer, AutoModelForCausalLM
import gradio as gr
model_id = "RWKV/rwkv-raven-1b5"
model = AutoModelForCausalLM.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
def chat(question):
prompt = f"### Instruction: {question}\n### Response:"
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(inputs["input_ids"], max_new_tokens=500)
response = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
print(response)
return response
iface = gr.Interface(fn=chat,
inputs=gr.inputs.Textbox(label="Enter your text"),
outputs="text",
title="Chat with Raven")
# index = construct_index("docs")
iface.launch()
### Instruction: How do I train the RWKV on specific data?
### Response: To train the RWKV on specific data, you can use the `train_rwkv`
# function from the `sklearn.model_selection` module.
# This function takes a list of data points as input and returns a list of predictions for each data point. You can then use this list of predictions to train the RWKV on your specific data.