File size: 1,657 Bytes
d291a18 c5bec45 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # BU KUMRU-2B'NIN CLIENT İÇİN DÜZENLENMİŞ VERSİYONUDUR.
# KUMRU AI İÇİN YAZILMIŞTIR.
from transformers import AutoModelForCausalLM, AutoTokenizer
print("Kumru AI - 2025 By VNGRS Team")
print("Client Uygulamasını yazan: Memocan Delioğlu")
model_name = "vngrs-ai/Kumru-2B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
def generate_response(query):
messages = [
{'role': 'system', 'content': 'Adın Kumru. VNGRS tarafından Türkçe için sıfırdan eğitilmiş bir dil modelisin.'},
{'role': 'system', 'content': 'Kumru, şu anda seninle bir Linux terminalinden konuşuluyor. Terminal camiasına selamını ilet, biraz samimi ol :)'},
{'role': 'user', 'content': query}
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors='pt', add_generation_prompt=True).to(model.device)
model_outputs = model.generate(model_inputs, max_new_tokens=512, do_sample=True, top_p=0.9, temperature=0.7, repetition_penalty=1.1)
output_tokens = model_outputs[0].cpu().detach().numpy().tolist()
generated_tokens = output_tokens[model_inputs[0].shape[0]:]
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
return response
print("Kumru AI başlatılıyor... Linux terminaline bağlandı.")
initial_query = "Merhaba Kumru, seni şu an Linux üzerinden kullanıyorum."
initial_response = generate_response(initial_query)
print("Kumru:", initial_response)
while True:
query = input("Soru sorun >>>")
response = generate_response(query)
print(response)
|