Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,9 +9,29 @@ print("Model yükleniyor, biraz sürebilir...")
|
|
| 9 |
pipe = pipeline("text-generation", model=model_id)
|
| 10 |
|
| 11 |
def generate_text(prompt):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Modele prompt'u verip cevabı alıyoruz
|
| 13 |
-
result = pipe(
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Gradio arayüzünü oluşturuyoruz
|
| 17 |
iface = gr.Interface(
|
|
@@ -19,7 +39,7 @@ iface = gr.Interface(
|
|
| 19 |
inputs=gr.Textbox(lines=5, placeholder="Buraya bir şeyler yaz kanka..."),
|
| 20 |
outputs="text",
|
| 21 |
title="SykoLLM-V5.6 Test Alanı",
|
| 22 |
-
description="
|
| 23 |
)
|
| 24 |
|
| 25 |
iface.launch()
|
|
|
|
| 9 |
pipe = pipeline("text-generation", model=model_id)
|
| 10 |
|
| 11 |
def generate_text(prompt):
|
| 12 |
+
# EFSANE DOKUNUŞ: Senin eğitim formatını buraya uyguluyoruz!
|
| 13 |
+
# Model artık nerede başlayıp nerede biteceğini bilecek.
|
| 14 |
+
formatted_prompt = f"<|user|>\n{prompt}<|end|>\n<|assistant|>\n"
|
| 15 |
+
|
| 16 |
# Modele prompt'u verip cevabı alıyoruz
|
| 17 |
+
result = pipe(
|
| 18 |
+
formatted_prompt,
|
| 19 |
+
max_new_tokens=150,
|
| 20 |
+
do_sample=True,
|
| 21 |
+
temperature=0.2,
|
| 22 |
+
repetition_penalty=1.18, # Tekrar cezasını 1.18 yaptık
|
| 23 |
+
num_return_sequences=1,
|
| 24 |
+
return_full_text=False # Bu ayar sayesinde model bizim sorumuzu cevaba katmıyor
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
generated = result[0]['generated_text']
|
| 28 |
+
|
| 29 |
+
# Model cevap vermeyi bitirdiğinde muhtemelen sonuna <|end|> koyacaktır.
|
| 30 |
+
# Kullanıcı bunu görmesin diye o kısmı kesip atıyoruz.
|
| 31 |
+
if "<|end|>" in generated:
|
| 32 |
+
generated = generated.split("<|end|>")[0]
|
| 33 |
+
|
| 34 |
+
return generated.strip()
|
| 35 |
|
| 36 |
# Gradio arayüzünü oluşturuyoruz
|
| 37 |
iface = gr.Interface(
|
|
|
|
| 39 |
inputs=gr.Textbox(lines=5, placeholder="Buraya bir şeyler yaz kanka..."),
|
| 40 |
outputs="text",
|
| 41 |
title="SykoLLM-V5.6 Test Alanı",
|
| 42 |
+
description="Özel token'larla güçlendirilmiş 447M parametreli model!"
|
| 43 |
)
|
| 44 |
|
| 45 |
iface.launch()
|