Spaces:
Runtime error
Runtime error
Commit ·
37198ae
1
Parent(s): 8dd83e6
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,19 +9,23 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
| 9 |
|
| 10 |
def chat(question):
|
| 11 |
prompt = f"### Instruction: {question}\n### Response:"
|
| 12 |
-
|
| 13 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 14 |
-
output = model.generate(inputs["input_ids"]
|
| 15 |
-
|
| 16 |
-
response = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
|
| 17 |
print(response)
|
| 18 |
-
|
| 19 |
return response
|
| 20 |
|
| 21 |
iface = gr.Interface(fn=chat,
|
| 22 |
inputs=gr.inputs.Textbox(label="Enter your text"),
|
| 23 |
outputs="text",
|
| 24 |
-
title="Chat with
|
| 25 |
|
| 26 |
# index = construct_index("docs")
|
| 27 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def chat(question):
|
| 11 |
prompt = f"### Instruction: {question}\n### Response:"
|
|
|
|
| 12 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 13 |
+
output = model.generate(inputs["input_ids"])
|
| 14 |
+
response = tokenizer.decode(output[0].tolist())
|
|
|
|
| 15 |
print(response)
|
|
|
|
| 16 |
return response
|
| 17 |
|
| 18 |
iface = gr.Interface(fn=chat,
|
| 19 |
inputs=gr.inputs.Textbox(label="Enter your text"),
|
| 20 |
outputs="text",
|
| 21 |
+
title="Chat with Raven")
|
| 22 |
|
| 23 |
# index = construct_index("docs")
|
| 24 |
iface.launch()
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
### Instruction: How do I train the RWKV on specific data?
|
| 29 |
+
### Response: To train the RWKV on specific data, you can use the `train_rwkv`
|
| 30 |
+
# function from the `sklearn.model_selection` module.
|
| 31 |
+
# 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.
|