Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,19 +2,13 @@ import gradio as gr
|
|
| 2 |
from ctransformers import AutoModelForCausalLM
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
|
| 5 |
-
model = AutoModelForCausalLM.from_pretrained("
|
| 6 |
|
| 7 |
-
basePrompt = """#YOUR ROLE: You are a helpful, respectful, and honest online forum moderator. You are designed to detect and moderate online content.
|
| 8 |
-
You have to ensure that any online content shared with you should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.
|
| 9 |
-
Please ensure that your answers are socially unbiased and positive in nature.
|
| 10 |
-
If any online content, shared with you, does not make any sense or is not factually coherent, convey the same.
|
| 11 |
-
If you don't know whether the online content shared with you should be moderated or not, then please convey the same, instead of deciding whether to moderate or not.
|
| 12 |
-
|
| 13 |
-
#Below is the online content which has to be screened for moderation:"""
|
| 14 |
|
| 15 |
def generateResponse(prompt):
|
| 16 |
-
prompt = f"<s>[INST]
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
title = "Mistral-7B-Instruct-GGUF"
|
| 20 |
description = "This space is an attempt to run the GGUF 4 bit quantized version of 'Mistral-7B-Instruct'."
|
|
|
|
| 2 |
from ctransformers import AutoModelForCausalLM
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
|
| 5 |
+
model = AutoModelForCausalLM.from_pretrained("mistral-7b-instruct-v0.1.Q6_K.gguf", model_type="mistral", gpu_layers=0, context_length=2048)
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def generateResponse(prompt):
|
| 9 |
+
prompt = f"<s>[INST] {prompt} [/INST]"
|
| 10 |
+
response = model(prompt, max_new_tokens=1024, stream=True)
|
| 11 |
+
return response
|
| 12 |
|
| 13 |
title = "Mistral-7B-Instruct-GGUF"
|
| 14 |
description = "This space is an attempt to run the GGUF 4 bit quantized version of 'Mistral-7B-Instruct'."
|