Text Generation
Safetensors
Turkish
mistral
chemistry
conversational
ErenalpCet commited on
Commit
1996549
·
verified ·
1 Parent(s): c1a59d8

Update README.md

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