BrewInteractive/alpaca-tr
Viewer • Updated • 45.3k • 305 • 3
Model Name: E-Model-V1
Developer: ERENALP ÇETİNTÜRK
License: MIT
This model is a Turkish language chatbot fine-tuned from the TURKCELL/Turkcell-LLM-7b-v1 model. It is designed for casual conversation in Turkish. The model aims to provide engaging and coherent responses to user inputs.
This model is intended for casual conversation and entertainment purposes. It can be used to create a chatbot for personal use or as a component in a larger application where Turkish language interaction is required. It is not intended for use in critical applications such as healthcare, finance, or legal advice.
The model was fine-tuned on a combination of the following datasets:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
# Load the merged fine-tuned model and tokenizer from Hugging Face
model_dir = "MeowML/E-Model-V1"
model = AutoModelForCausalLM.from_pretrained(
model_dir,
torch_dtype=torch.float16, # Use FP16 for memory efficiency
device_map="auto" # Automatically map to GPU
)
tokenizer = AutoTokenizer.from_pretrained(model_dir)
# Ensure EOS token is set correctly
eos_token = tokenizer("<|im_end|>", add_special_tokens=False)["input_ids"][0]
if tokenizer.eos_token_id is None:
tokenizer.eos_token_id = eos_token
# System prompt
system_prompt = """E Model, Türkçe odaklı etik yapay zeka asistanıdır. Küfür, hakaret, ayrımcılık, yasa dışı içerik veya kişisel mahremiyet ihlali kesinlikle yapılmaz. Türk dilbilgisi, kültürel bağlam ve yasal standartlar hassasiyetle uygulanır. Model, tıbbi/hukuki/finansal danışmanlık, gerçek zamanlı veriler veya uzun mantık zincirleri gerektiren görevlerde sınırlıdır. Hassas bilgi paylaşımı önerilmez, kritik kararlarda insan uzmanı görüşü zorunludur. Anlamadığı konularda açıkça belirtir, geri bildirimlerle sürekli iyileştirilir. Eğitim verileri metin tabanlıdır, güncel olayları takip edemez. Yanlış yanıt riski olduğunda bağımsız doğrulama tavsiye edilir. Ticari kullanım ve hassas konular önceden izne tabidir. Tüm etkileşimler, modelin yeteneklerini aşmayacak ve toplumsal değerleri koruyacak şekilde yapılandırılır."""
# Chatbot loop
print("Merhaba! Size nasıl yardımcı olabilirim? (Çıkmak için 'çık' yazın)")
conversation_history = [{"role": "system", "content": system_prompt}] # Initialize with system prompt
while True:
# Get user input
user_input = input("Siz: ")
# Exit condition
if user_input.lower() == "çık":
print("Görüşmek üzere!")
break
# Add user input to conversation history
conversation_history.append({"role": "user", "content": user_input})
# Tokenize the conversation history
encodeds = tokenizer.apply_chat_template(conversation_history, return_tensors="pt")
model_inputs = encodeds.to(device)
# Generate response
generated_ids = model.generate(
model_inputs,
max_new_tokens=1024,
do_sample=True,
eos_token_id=eos_token,
temperature=0.7,
top_p=0.95
)
# Decode the response
generated_text = tokenizer.decode(generated_ids[0][model_inputs.shape[1]:], skip_special_tokens=True)
# Add assistant response to history
conversation_history.append({"role": "assistant", "content": generated_text})
# Print the response
print(f"Asistan: {generated_text}")
# Optional: Clear memory when done
del model
torch.cuda.empty_cache()