File size: 3,991 Bytes
41316d6
00c4e0c
 
 
 
 
 
 
 
 
 
 
 
41316d6
00c4e0c
 
e8021ac
41316d6
 
00c4e0c
41316d6
00c4e0c
41316d6
 
 
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
 
 
 
41316d6
00c4e0c
 
41316d6
00c4e0c
 
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
 
 
 
 
 
 
 
 
 
 
41316d6
00c4e0c
41316d6
00c4e0c
 
 
 
 
41316d6
00c4e0c
 
 
 
 
 
41316d6
00c4e0c
41316d6
00c4e0c
 
41316d6
00c4e0c
41316d6
00c4e0c
 
41316d6
00c4e0c
41316d6
00c4e0c
 
d1a3a99
00c4e0c
 
 
d1a3a99
41316d6
00c4e0c
41316d6
00c4e0c
 
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
 
 
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
00c4e0c
41316d6
e8021ac
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
---
license: apache-2.0
base_model: projecte-aina/FLOR-1.3B
datasets:
- ericrisco/customer_service_chatbot_ca
tags:
- finetune
- bloom
- customer service
- catalan
model-index:
- name: FLOR-1.3B-xat
  results: []
library_name: transformers
language:
- ca
pipeline_tag: text-generation
---

# FLOR-1.3B Customer Service Chatbot (Catalan)

This project fine-tunes the [`projecte-aina/FLOR-1.3B`](/projecte-aina/FLOR-1.3B) model from [Projecte Aina](/projecte-aina) specifically for a customer service chatbot in Catalan, utilizing the dataset [`ericrisco/customer_service_chatbot_ca`](/ericrisco/customer_service_chatbot_ca). The model is fine-tuned to understand and generate responses in Catalan, aiming to provide helpful and contextually relevant answers.

## Model Details

**Base Model:** `projecte-aina/FLOR-1.3B`

**Fine-tuning Dataset:** `ericrisco/customer_service_chatbot_ca`

**Language:** Catalan

## How to use it

```
<|startoftext|>
### Instruction
Below is an instruction that describes a task. You are a helpfull customer service assistant. Answer always in catalan.

### Context
Com puc accedir a la meva factura?

### Answer
```

## Training and Fine-tuning Details

### Training Configuration

- **TrainingArguments**:
  - `output_dir`: flor1-3B-customerservice-instruct-tune-500s
  - `max_steps`: 500 (Training is step-based rather than epoch-based)
  - `per_device_train_batch_size`: 4
  - `warmup_steps`: 0.03
  - `logging_steps`: 10
  - `save_strategy`: epoch
  - `evaluation_strategy`: steps
  - `eval_steps`: 20
  - `learning_rate`: 2e-4
  - `lr_scheduler_type`: constant

### Model Preparation and Quantization

- **BitsAndBytesConfig**:
  - 4-bit quantization is enabled to optimize the model size and inference speed.
  - `bnb_4bit_quant_type`: nf4
  - `bnb_double_quant`: True
  - `bnb_4bit_compute_dtype`: torch.float16

- **LoRA Configuration (for Parameter-Efficient Fine-tuning)**:
  - `lora_alpha`: 16
  - `lora_dropout`: 0.1
  - `lora_r`: 64
  - `bias`: none
  - `task_type`: CAUSAL_LM

### Tokenizer

- The tokenizer from the base model `projecte-aina/FLOR-1.3B` is used.
- Padding token is set to the unknown token, and padding is done to the right.

### Dataset

- The dataset used for training and evaluation is `ericrisco/customer_service_chatbot_ca`.
- The data is structured to provide context, instructions, and expected responses for a customer service scenario in Catalan.

### Custom Prompt Formatting

- Custom prompts are created to structure the input and output in a way that is beneficial for a customer service chatbot.
- Each prompt includes:
  - Beginning of the sequence token (`<|startoftext|>`)
  - Instruction text (defining the role and language of the model)
  - Input text (customer's message)
  - Expected response text
  - End of the sequence token (`<|endoftext|>`)

### Training Process

- The model is trained using the `SFTTrainer` from the `trl` library, allowing for supervised fine-tuning on the task-specific dataset.
- Training is performed with the specified parameters, focusing on a conversational structure and language understanding.

## Usage

After fine-tuning, the model can generate responses to customer service inquiries in Catalan. To use the model, you should:

1. Load the model and tokenizer.
2. Prepare the input according to the custom prompt format.
3. Generate the response using the model.

Detailed instructions and examples can be added to demonstrate the usage of the fine-tuned model.

## Conclusion

The `projecte-aina/FLOR-1.3B` model, fine-tuned on the `ericrisco/customer_service_chatbot_ca` dataset, is expected to deliver responsive and contextually aware customer service interactions in Catalan. The fine-tuning process, coupled with parameter-efficient techniques and quantization, ensures that the model remains efficient while being effective in its designated task.

For further details, questions, or contributions, please refer to the project repository or contact the maintainers.