Spaces:
Runtime error
Runtime error
kirp
commited on
Commit
·
82fe858
1
Parent(s):
9cb066b
app.py
CHANGED
@@ -11,8 +11,7 @@ from huggingface_hub import snapshot_download
|
|
11 |
from llama_cpp import Llama
|
12 |
|
13 |
repo_name = "kirp/TinyLlama-1.1B-Chat-v0.2-gguf"
|
14 |
-
|
15 |
-
model_name = "ggml-model-q2_k.gguf"
|
16 |
|
17 |
|
18 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
@@ -31,14 +30,14 @@ def generate(
|
|
31 |
temperature=0.1,
|
32 |
top_p=0.75,
|
33 |
top_k=40,
|
34 |
-
|
35 |
):
|
36 |
prompt = template.format(input)
|
37 |
output = model(prompt,
|
38 |
temperature = temperature,
|
39 |
top_k = top_k,
|
40 |
top_p = top_p,
|
41 |
-
max_tokens =
|
42 |
stop=["<|im_end|>"],
|
43 |
echo=True)
|
44 |
output = output["choices"][0]['text']
|
@@ -48,7 +47,7 @@ g = gr.Interface(
|
|
48 |
fn=generate,
|
49 |
inputs=[
|
50 |
gr.components.Textbox(
|
51 |
-
lines=2, label="Prompt",
|
52 |
),
|
53 |
gr.components.Slider(minimum=0, maximum=1, value=0.7, label="Temperature"),
|
54 |
gr.components.Slider(minimum=0, maximum=1, value=0.8, label="Top p"),
|
|
|
11 |
from llama_cpp import Llama
|
12 |
|
13 |
repo_name = "kirp/TinyLlama-1.1B-Chat-v0.2-gguf"
|
14 |
+
model_name = "ggml-model-q4_0.gguf"
|
|
|
15 |
|
16 |
|
17 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
|
|
30 |
temperature=0.1,
|
31 |
top_p=0.75,
|
32 |
top_k=40,
|
33 |
+
max_tokens=512,
|
34 |
):
|
35 |
prompt = template.format(input)
|
36 |
output = model(prompt,
|
37 |
temperature = temperature,
|
38 |
top_k = top_k,
|
39 |
top_p = top_p,
|
40 |
+
max_tokens = max_tokens,
|
41 |
stop=["<|im_end|>"],
|
42 |
echo=True)
|
43 |
output = output["choices"][0]['text']
|
|
|
47 |
fn=generate,
|
48 |
inputs=[
|
49 |
gr.components.Textbox(
|
50 |
+
lines=2, label="Prompt", value = "What is huggingface?"
|
51 |
),
|
52 |
gr.components.Slider(minimum=0, maximum=1, value=0.7, label="Temperature"),
|
53 |
gr.components.Slider(minimum=0, maximum=1, value=0.8, label="Top p"),
|