Quantized GGUF model files for
phi-2-chat-turkish from
malhajar
malhajar/phi-2-chat-turkish is a finetuned version of phi-2 using SFT Training.
This model can answer information in turkish language as it is finetuned on a turkish dataset specifically
Turkish-Alpaca
### Instruction:
<prompt> (without the <>)
### Response:
Use the code sample provided in the original post to interact with the model.
1 from transformers import AutoTokenizer , AutoModelForCausalLM
2
3 model_id = "malhajar/phi-2-chat-turkish"
4 model = AutoModelForCausalLM . from_pretrained ( model_name_or_path ,
5 device_map = "auto" ,
6 torch_dtype = torch . float16 ,
7 revision = "main" )
8
9 tokenizer = AutoTokenizer . from_pretrained ( model_id )
10
11 question : "Türkiyenin en büyük şehir nedir?"
12 # For generating a response
13 prompt = f'''
14 ### Instruction: { question } ### Response:
15 '''
16 input_ids = tokenizer ( prompt , return_tensors = "pt" ) . input_ids
17 output = model . generate ( inputs = input_ids , max_new_tokens = 512 , pad_token_id = tokenizer . eos_token_id , top_k = 50 , do_sample = True , repetition_penalty = 1.3
18 top_p = 0.95 , trust_remote_code = True , )
19 response = tokenizer . decode ( output [ 0 ] )
20
21 print ( response )