Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,20 +16,23 @@ Response:"""
|
|
| 16 |
else:
|
| 17 |
return f"""User: hi
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
User: {instruction}
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
model_path = "models/rwkv-6-world-1b6/" # Path to your local model directory
|
| 26 |
|
| 27 |
model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
model_path,
|
| 29 |
trust_remote_code=True,
|
| 30 |
-
use_flash_attention_2=False
|
| 31 |
).to(torch.float32)
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
# Create a custom tokenizer (make sure to download vocab.json)
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 35 |
model_path,
|
|
@@ -72,7 +75,7 @@ iface = gr.Interface(
|
|
| 72 |
)
|
| 73 |
|
| 74 |
# For local testing:
|
| 75 |
-
iface.launch(share=
|
| 76 |
# deploy()
|
| 77 |
|
| 78 |
|
|
|
|
| 16 |
else:
|
| 17 |
return f"""User: hi
|
| 18 |
|
| 19 |
+
Assistant: Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.
|
| 20 |
|
| 21 |
User: {instruction}
|
| 22 |
|
| 23 |
+
Assistant:"""
|
| 24 |
|
| 25 |
model_path = "models/rwkv-6-world-1b6/" # Path to your local model directory
|
| 26 |
|
| 27 |
model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
model_path,
|
| 29 |
trust_remote_code=True,
|
| 30 |
+
# use_flash_attention_2=False
|
| 31 |
).to(torch.float32)
|
| 32 |
|
| 33 |
+
model = model.quantize(8) # Quantize to int8 (experiment with different values)
|
| 34 |
+
model = model.to("cpu")
|
| 35 |
+
|
| 36 |
# Create a custom tokenizer (make sure to download vocab.json)
|
| 37 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 38 |
model_path,
|
|
|
|
| 75 |
)
|
| 76 |
|
| 77 |
# For local testing:
|
| 78 |
+
iface.launch(share=False)
|
| 79 |
# deploy()
|
| 80 |
|
| 81 |
|