Spaces:
Build error
Build error
Commit
•
78f9744
1
Parent(s):
aaaeb76
feat: add batching
Browse filesfeat: add smaller model
app.py
CHANGED
@@ -6,7 +6,7 @@ from distilabel.llms import LlamaCppLLM
|
|
6 |
from distilabel.steps.tasks.argillalabeller import ArgillaLabeller
|
7 |
|
8 |
file_path = os.path.join(os.path.dirname(__file__), "Qwen2-5-0.5B-Instruct-f16.gguf")
|
9 |
-
download_url = "https://huggingface.co/gaianet/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/Qwen2.5-0.5B-Instruct-
|
10 |
|
11 |
|
12 |
if not os.path.exists(file_path):
|
@@ -66,14 +66,15 @@ def process_records_gradio(records, example_records, fields, question):
|
|
66 |
runtime_parameters = {"fields": fields, "question": question}
|
67 |
if example_records:
|
68 |
runtime_parameters["example_records"] = example_records
|
69 |
-
|
70 |
task.set_runtime_parameters(runtime_parameters)
|
71 |
|
72 |
results = []
|
73 |
-
for record in records
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
77 |
|
78 |
return json.dumps({"results": results}, indent=2)
|
79 |
except Exception as e:
|
|
|
6 |
from distilabel.steps.tasks.argillalabeller import ArgillaLabeller
|
7 |
|
8 |
file_path = os.path.join(os.path.dirname(__file__), "Qwen2-5-0.5B-Instruct-f16.gguf")
|
9 |
+
download_url = "https://huggingface.co/gaianet/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/Qwen2.5-0.5B-Instruct-Q8_0.gguf?download=true"
|
10 |
|
11 |
|
12 |
if not os.path.exists(file_path):
|
|
|
66 |
runtime_parameters = {"fields": fields, "question": question}
|
67 |
if example_records:
|
68 |
runtime_parameters["example_records"] = example_records
|
69 |
+
|
70 |
task.set_runtime_parameters(runtime_parameters)
|
71 |
|
72 |
results = []
|
73 |
+
output = task.process(inputs=[{"records": record} for record in records])
|
74 |
+
for _ in range(len(records)):
|
75 |
+
entry = next(output)[0]
|
76 |
+
if entry["suggestions"]:
|
77 |
+
results.append(entry["suggestions"].serialize())
|
78 |
|
79 |
return json.dumps({"results": results}, indent=2)
|
80 |
except Exception as e:
|