ErenalpCet commited on
Commit
189deb6
·
verified ·
1 Parent(s): 681a9c2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +171 -3
README.md CHANGED
@@ -1,3 +1,171 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - BrewInteractive/alpaca-tr
5
+ - ituperceptron/turkish_medical_reasoning
6
+ language:
7
+ - tr
8
+ base_model:
9
+ - TURKCELL/Turkcell-LLM-7b-v1
10
+ pipeline_tag: text-generation
11
+ tags:
12
+ - chemistry
13
+ ---
14
+
15
+ ## Model Card: Turkish Chatbot
16
+
17
+ **Model Name:** E-Model-V2
18
+
19
+ **Developer:** ERENALP ÇETİNTÜRK
20
+
21
+ **Contact:** [email protected]
22
+
23
+ **License:** MIT
24
+
25
+ ### 1. Model Description
26
+ This model is a fine-tuned version of the TURKCELL/Turkcell-LLM-7b-v1 , specifically optimized for casual conversation in Turkish.
27
+ It has been trained for twice as long as its predecessor, resulting in enhanced conversational abilities and a deeper understanding of Turkish language nuances.
28
+ Designed to engage users in natural, coherent, and enjoyable interactions, this chatbot is ideal for everyday conversations.
29
+
30
+ * **Model Type:** Llama (fine-tuned)
31
+ * **Language(s):** Turkish
32
+ * **Finetuned from model:** TURKCELL/Turkcell-LLM-7b-v1
33
+
34
+ ### 2. Intended Use
35
+
36
+ This model is intended for casual conversation and entertainment purposes.
37
+ It can be used to create a chatbot for personal use or as a component in a
38
+ larger application where Turkish language interaction is required. It is
39
+ *not* intended for use in critical applications such as healthcare,
40
+ finance, or legal advice.
41
+
42
+ ### 3. Factors
43
+
44
+ * **Domain:** General conversation
45
+ * **User Demographics:** No specific demographic targeting.
46
+ * **Input Length:** The model is designed to handle relatively short
47
+ input sequences. Longer inputs may lead to degraded performance.
48
+
49
+ ### 4. Bias, Risks, and Limitations
50
+
51
+ * **Bias:** The model may exhibit biases present in the training data.
52
+ This could manifest as stereotypical responses or unequal treatment of
53
+ different topics.
54
+ * **Hallucinations:** The model may generate factually incorrect or
55
+ nonsensical responses.
56
+ * **Safety:** The model may generate inappropriate or offensive content,
57
+ although efforts have been made to mitigate this risk.
58
+ * **Limited Knowledge:** The model's knowledge is limited to the data it
59
+ was trained on. It may not be able to answer questions about current
60
+ events or specialized topics.
61
+ * **Turkish Specificity:** The model is specifically trained for Turkish
62
+ and will not perform well with other languages.
63
+
64
+ ### 5. Training Details
65
+
66
+ #### Training Data
67
+
68
+ The model was fine-tuned on a combination of the following datasets:
69
+
70
+ * BrewInteractive/alpaca-tr
71
+ * ituperceptron/turkish_medical_reasoning
72
+
73
+ #### Training Procedure
74
+
75
+ * **Training Regime:** Fine-tuning
76
+ * **Hyperparameters:**
77
+ * Learning Rate: 2e-5
78
+ * Batch Size: 13135
79
+ * Epochs: 1
80
+ * Optimizer: AdamW
81
+ * **Preprocessing:** The training data was preprocessed by tokenizers.
82
+
83
+ ### 6. How to Use the Model (Inference Code)
84
+
85
+ ```python
86
+ import torch
87
+ from transformers import AutoModelForCausalLM, AutoTokenizer
88
+
89
+ device = "cuda"
90
+
91
+ # Load the merged fine-tuned model and tokenizer
92
+ model_dir = "E-Model-V1"
93
+ model = AutoModelForCausalLM.from_pretrained(
94
+ model_dir,
95
+ torch_dtype=torch.float16, # Use FP16 for memory efficiency
96
+ device_map="auto" # Automatically map to GPU
97
+ )
98
+ tokenizer = AutoTokenizer.from_pretrained(model_dir)
99
+
100
+ # Ensure EOS token is set correctly
101
+ eos_token = tokenizer("<|im_end|>", add_special_tokens=False)["input_ids"][0]
102
+ if tokenizer.eos_token_id is None:
103
+ tokenizer.eos_token_id = eos_token
104
+
105
+ # Move model to device (if not already mapped)
106
+ model.to(device)
107
+
108
+ # System prompt
109
+ 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."""
110
+
111
+ # Chatbot loop
112
+ print("Merhaba! Size nasıl yardımcı olabilirim? (Çıkmak için 'çık' yazın)")
113
+ conversation_history = [{"role": "system", "content": system_prompt}] # Initialize with system prompt
114
+
115
+ while True:
116
+ # Get user input
117
+ user_input = input("Siz: ")
118
+
119
+ # Exit condition
120
+ if user_input.lower() == "çık":
121
+ print("Görüşmek üzere!")
122
+ break
123
+
124
+ # Add user input to conversation history
125
+ conversation_history.append({"role": "user", "content": user_input})
126
+
127
+ # Tokenize the conversation history
128
+ encodeds = tokenizer.apply_chat_template(conversation_history, return_tensors="pt")
129
+ model_inputs = encodeds.to(device)
130
+
131
+ # Generate response
132
+ generated_ids = model.generate(
133
+ model_inputs,
134
+ max_new_tokens=1024,
135
+ do_sample=True,
136
+ eos_token_id=eos_token,
137
+ temperature=0.7,
138
+ top_p=0.95
139
+ )
140
+
141
+ # Decode the response
142
+ generated_text = tokenizer.decode(generated_ids[0][model_inputs.shape[1]:], skip_special_tokens=True)
143
+
144
+ # Add assistant response to history
145
+ conversation_history.append({"role": "assistant", "content": generated_text})
146
+
147
+ # Print the response
148
+ print(f"Asistan: {generated_text}")
149
+
150
+ # Optional: Clear memory when done
151
+ del model
152
+ torch.cuda.empty_cache()
153
+ ```
154
+
155
+ ### 9. Ethical Considerations
156
+
157
+ * **Responsible Use:** This model should be used responsibly and
158
+ ethically.
159
+ * **Transparency:** Users should be informed that they are interacting
160
+ with an AI chatbot.
161
+ * **Bias Mitigation:** Efforts should be made to mitigate bias in the
162
+ model's responses.
163
+
164
+ ### 10. Limitations and Future Work
165
+
166
+ * **Context Length:** The model has a limited context length, which may
167
+ affect its ability to handle long conversations.
168
+ * **Knowledge Updates:** The model's knowledge is static and needs to be
169
+ updated periodically.
170
+ * **Future Work:** Future work could focus on improving the model's
171
+ context length, knowledge updates, and bias mitigation.