File size: 5,440 Bytes
cb212a1 fd6bddc cb212a1 e8ffb69 cb212a1 6c412e7 b9c265d a4d3e62 6c412e7 cb212a1 b9c265d cb212a1 4d93cf4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 40cc8b3 19786f4 4d93cf4 19786f4 cb212a1 19786f4 84885e2 c47aa71 84885e2 19786f4 84885e2 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 84885e2 4d93cf4 19786f4 cb212a1 19786f4 4d93cf4 19786f4 84885e2 19786f4 40cc8b3 19786f4 84885e2 cb212a1 1168d51 cb212a1 4d93cf4 cb212a1 4d93cf4 19786f4 de742f8 19786f4 5b233c2 19786f4 |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
---
library_name: transformers
tags: []
---
# Model Card
<!-- Provide a quick summary of what the model is/does. -->
### Model Description
<!-- Provide a longer summary of what this model is. -->
This is a fine-tuned version of **DeepSeek-R1-Distill-Llama-8B**, optimized for **telecom-related queries**. The model has been fine-tuned to provide **concise and factual answers**, ensuring that it **does role-play as a customer service agent**.
- **Developed by:** Mohamed Abdulaziz
- **Model type:** Fine-tune-DeepSeek-R1-Distill-Llama-8B
- **Framework Used:** Unsloth for fine tuning and wandb for performance monitoring
- **License:** MIT License
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
This model is designed for **customer support automation in the telecom industry**. It assists in:
- Answering common user queries about **5G, network issues, billing, and services**.
- Providing **concise and factually correct responses**.
- Reducing **workload on human support agents** by handling routine inquiries.
### **Who can use this model?**
- **Telecom companies**: Automate customer service via chatbots.
- **Developers & researchers**: Fine-tune and adapt for different use cases.
- **Call centers**: Support agents in handling user requests efficiently.
### **Who might be affected?**
- **End-users** interacting with telecom chatbots.
- **Support agents** using AI-assisted tools.
- **Developers & data scientists** fine-tuning and deploying the model.
## How to Get Started with the Model
### **1️⃣ Import necessary libraries**
```python
import torch
from unsloth import FastLanguageModel
from transformers import AutoTokenizer
```
### **2️⃣ Define model path**
```python
model_path = "moo100/DeepSeek-R1-telecom-chatbot"
```
### **3️⃣ Load the model and tokenizer**
```python
model, tokenizer = FastLanguageModel.from_pretrained(
model_path,
max_seq_length=1024, # training length equal to 2048 but you can choose less than that to avoid OOM
dtype=None # Uses default precision
)
```
### **4️⃣ Optimize model for fast inference with Unsloth**
```python
model = FastLanguageModel.for_inference(model)
```
### **5️⃣ Move model to GPU if available, otherwise use CPU**
```python
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
```
### **6️⃣ Define system instruction to guide model responses**
```python
system_instruction = """You are an AI assistant. Answer user questions concisely and factually.
Do NOT role-play as a customer service agent. Only answer the user's query."""
```
### **7️⃣ Define user input (Replace with any query)**
```python
user_input = "What are the benefits of 5G?"
```
### **8️⃣ Construct full prompt with instructions and user query**
```python
full_prompt = f"{system_instruction}\n\nUser: {user_input}\nAssistant:"
```
### **9️⃣ Tokenize input prompt**
```python
inputs = tokenizer(full_prompt, return_tensors="pt").to(device)
```
### **🔟 Generate model response with controlled stopping criteria**
```python
outputs = model.generate(
input_ids=inputs.input_ids, # Encoded input tokens
attention_mask=inputs.attention_mask, # Mask for input length
max_new_tokens=100, # Limits response length
do_sample=True, # Enables randomness for variability
temperature=0.5, # Controls randomness level
top_k=50, # Samples from top 50 probable words
eos_token_id=tokenizer.eos_token_id, # Stops at end-of-sentence token
)
```
### **1️⃣1️⃣ Decode and extract only the newly generated response**
```python
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
```
### **1️⃣2️⃣ Print the AI-generated response**
```python
print(response.split("\n")[0].strip())
```
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
talkmap/telecom-conversation-corpus
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
- **Loss Curve:** Shows a steady decline, indicating model convergence.
- **Learning Rate Schedule:** Linear decay applied.
- **Gradient Norm:** Slight increase, but under control.
- **Global Steps & Epochs:** Indicates training progress.
Below are the training metrics recorded during fine-tuning:
https://drive.google.com/file/d/1-SOfG8K3Qt2WSEuyj3kFhGYOYMB5Gk2r/view?usp=sharing
# Evaluation
## Methodology
The chatbot was evaluated using Meta-Llama-3.3-70B-Instruct, assessing relevance, correctness, and fluency of its responses.
## Results
Meta-Llama-3.3-70B-Instruct Evaluation:
Relevance: 9/10
The response is highly relevant to the user’s query about 5G benefits, providing a concise and informative summary.
Correctness: 10/10
The response is factually accurate, highlighting key advantages such as faster data speeds, lower latency, increased capacity, and broader device compatibility.
Fluency: 9/10
The response is well-structured, grammatically sound, and easy to understand. Minor refinements could further enhance readability.
|