transformers safetensors bloom text-generation finetune customer service catalan ca dataset:ericrisco/customer_service_chatbot_ca base_model:projecte-aina/FLOR-1.3B license:apache-2.0 autotrain_compatible endpoints_compatible text-generation-inference 4-bit bitsandbytes region:us
---
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.