Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ from io import StringIO
|
|
23 |
|
24 |
last = 0
|
25 |
CHROMA_DATA_PATH = "chroma_data/"
|
26 |
-
EMBED_MODEL = "BAAI/bge-m3"
|
27 |
# all-MiniLM-L6-v2
|
28 |
CHUNK_SIZE = 800
|
29 |
CHUNK_OVERLAP = 50
|
@@ -31,10 +31,12 @@ max_results = 3
|
|
31 |
min_len = 40
|
32 |
min_distance = 0.35
|
33 |
max_distance = 0.6
|
34 |
-
temperature = 0.
|
35 |
-
max_tokens=
|
36 |
top_p=0.8
|
|
|
37 |
frequency_penalty=0.0
|
|
|
38 |
presence_penalty=0.15
|
39 |
jezik = "srpski"
|
40 |
cs = "s0"
|
@@ -66,10 +68,12 @@ system_propmpt = system_sr
|
|
66 |
Settings.llm = HuggingFaceInferenceAPI(model_name="mistralai/Mistral-Nemo-Instruct-2407",
|
67 |
device_map="auto",
|
68 |
system_prompt = system_propmpt,
|
69 |
-
context_window=
|
70 |
-
max_new_tokens=
|
71 |
# stopping_ids=[50278, 50279, 50277, 1, 0],
|
72 |
-
generate_kwargs={"temperature":
|
|
|
|
|
73 |
# tokenizer_kwargs={"max_length": 4096},
|
74 |
tokenizer_name="mistralai/Mistral-Nemo-Instruct-2407",
|
75 |
)
|
@@ -164,13 +168,13 @@ with gr.Blocks() as iface:
|
|
164 |
title="UChat",
|
165 |
description="Postavite pitanje ili opišite problem koji imate",
|
166 |
chatbot=gr.Chatbot(placeholder="Kako Vam mogu pomoći?", type="tuples", label="Agent podrške", height=400),
|
167 |
-
textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=
|
168 |
theme="soft",
|
169 |
# examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],
|
170 |
# cache_examples=True,
|
171 |
retry_btn=None,
|
172 |
undo_btn=None,
|
173 |
-
clear_btn="Briši sve",
|
174 |
additional_inputs = [gr.Dropdown(["slovenski", "hrvatski", "srpski", "makedonski", "Eksperimentalna opcija"], value="srpski", label="Jezik", info="N/A"),
|
175 |
gr.File()
|
176 |
],
|
|
|
23 |
|
24 |
last = 0
|
25 |
CHROMA_DATA_PATH = "chroma_data/"
|
26 |
+
EMBED_MODEL = "sentence-transformers/all-MiniLM-L6-v2" #"BAAI/bge-m3"
|
27 |
# all-MiniLM-L6-v2
|
28 |
CHUNK_SIZE = 800
|
29 |
CHUNK_OVERLAP = 50
|
|
|
31 |
min_len = 40
|
32 |
min_distance = 0.35
|
33 |
max_distance = 0.6
|
34 |
+
temperature = 0.6
|
35 |
+
max_tokens=5100
|
36 |
top_p=0.8
|
37 |
+
top_k=1000
|
38 |
frequency_penalty=0.0
|
39 |
+
repetition_penalty=1.12
|
40 |
presence_penalty=0.15
|
41 |
jezik = "srpski"
|
42 |
cs = "s0"
|
|
|
68 |
Settings.llm = HuggingFaceInferenceAPI(model_name="mistralai/Mistral-Nemo-Instruct-2407",
|
69 |
device_map="auto",
|
70 |
system_prompt = system_propmpt,
|
71 |
+
context_window=5100,
|
72 |
+
max_new_tokens=3072,
|
73 |
# stopping_ids=[50278, 50279, 50277, 1, 0],
|
74 |
+
generate_kwargs={"temperature": temperature, "top_p":top_p, "repetition_penalty": repetition_penalty,
|
75 |
+
"presence_penalty": presence_penalty, "frequency_penalty": frequency_penalty,
|
76 |
+
"top_k": top_k, "do_sample": False},
|
77 |
# tokenizer_kwargs={"max_length": 4096},
|
78 |
tokenizer_name="mistralai/Mistral-Nemo-Instruct-2407",
|
79 |
)
|
|
|
168 |
title="UChat",
|
169 |
description="Postavite pitanje ili opišite problem koji imate",
|
170 |
chatbot=gr.Chatbot(placeholder="Kako Vam mogu pomoći?", type="tuples", label="Agent podrške", height=400),
|
171 |
+
textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=False, scale=7),
|
172 |
theme="soft",
|
173 |
# examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],
|
174 |
# cache_examples=True,
|
175 |
retry_btn=None,
|
176 |
undo_btn=None,
|
177 |
+
clear_btn="Briši sve - razgovor ispočetka",
|
178 |
additional_inputs = [gr.Dropdown(["slovenski", "hrvatski", "srpski", "makedonski", "Eksperimentalna opcija"], value="srpski", label="Jezik", info="N/A"),
|
179 |
gr.File()
|
180 |
],
|