malhajar commited on
Commit
7414022
1 Parent(s): ddfca17

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -0
README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - TFLai/Turkish-Alpaca
4
+ language:
5
+ - tr
6
+ ---
7
+
8
+ # Model Card for Model ID
9
+
10
+ <!-- Provide a quick summary of what the model is/does. -->
11
+ malhajar/phi-2-chat-turkish is a finetuned version of phi-2 using SFT Training.
12
+ This model can answer information in turkish language as it is finetuned on a turkish dataset specifically [`Turkish-Alpaca`]( https://huggingface.co/datasets/TFLai/Turkish-Alpaca)
13
+
14
+ ### Model Description
15
+
16
+ - **Developed by:** [`Mohamad Alhajar`](https://www.linkedin.com/in/muhammet-alhajar/)
17
+ - **Language(s) (NLP):** Turkish
18
+ - **Finetuned from model:** [`microsoft/phi-2`](https://huggingface.co/microsoft/phi-2)
19
+
20
+ ### Prompt Template
21
+
22
+ ```
23
+ <s>[INST] <prompt> [/INST] </s>
24
+ ```
25
+
26
+ ## How to Get Started with the Model
27
+
28
+ Use the code sample provided in the original post to interact with the model.
29
+ ```python
30
+ from transformers import AutoTokenizer,AutoModelForCausalLM
31
+
32
+ model_id = "malhajar/phi-2-chat-turkish"
33
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
34
+ device_map="auto",
35
+ torch_dtype=torch.float16,
36
+ revision="main")
37
+
38
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
39
+
40
+ question: "Türkiyenin en büyük şehir nedir?"
41
+ # For generating a response
42
+ prompt = '''
43
+ <s>[INST] {question} [/INST]
44
+ '''
45
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
46
+ 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
47
+ top_p=0.95,trust_remote_code=True,)
48
+ response = tokenizer.decode(output[0])
49
+
50
+ print(response)
51
+ ```