Niladri Das 🦊 commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,118 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+

|
| 6 |
+
|
| 7 |
+
# Conversational AI Fine-Tuned Model
|
| 8 |
+
|
| 9 |
+
## Model Details
|
| 10 |
+
- **Model Name**: Conversational AI Fine-Tuned Model
|
| 11 |
+
- **Base Model**: bniladridas/conversational-ai-base-model
|
| 12 |
+
- **Model Type**: GPT-2-based conversational AI model
|
| 13 |
+
- **Max Sequence Length**: 256 tokens
|
| 14 |
+
|
| 15 |
+
## Intended Use
|
| 16 |
+
This model is designed to generate human-like responses for conversational applications, such as chatbots, virtual assistants, and dialogue systems.
|
| 17 |
+
|
| 18 |
+
## Training Data
|
| 19 |
+
The model was fine-tuned on the DailyDialog dataset, featuring:
|
| 20 |
+
- **Training Examples**: 11,118
|
| 21 |
+
- **Validation Examples**: 1,000
|
| 22 |
+
- **Test Examples**: 1,000
|
| 23 |
+
|
| 24 |
+
## Dataset Characteristics
|
| 25 |
+
- **Description**: A high-quality, multi-turn dialogue dataset covering everyday topics.
|
| 26 |
+
- **Features**: Includes dialogues, communication acts, and emotion annotations.
|
| 27 |
+
- **Citation**:
|
| 28 |
+
```
|
| 29 |
+
@InProceedings{li2017dailydialog,
|
| 30 |
+
author = {Li, Yanran and Su, Hui and Shen, Xiaoyu and Li, Wenjie and Cao, Ziqiang and Niu, Shuzi},
|
| 31 |
+
title = {DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset},
|
| 32 |
+
booktitle = {Proceedings of The 8th International Joint Conference on Natural Language Processing (IJCNLP 2017)},
|
| 33 |
+
year = {2017}
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Training Configuration
|
| 38 |
+
- **Learning Rate**: 2e-5
|
| 39 |
+
- **Batch Size**: 8 (for both training and evaluation)
|
| 40 |
+
- **Number of Epochs**: 3
|
| 41 |
+
- **Weight Decay**: 0.01
|
| 42 |
+
|
| 43 |
+
## Ethical Considerations
|
| 44 |
+
Inherited from the GPT-2 base model and the DailyDialog dataset, this model may reflect biases or limitations present in its training data. Caution is advised when using it in sensitive contexts, as it could produce biased or inappropriate responses.
|
| 45 |
+
|
| 46 |
+
## How to Use
|
| 47 |
+
|
| 48 |
+
### Using the Model Directly
|
| 49 |
+
```python
|
| 50 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 51 |
+
|
| 52 |
+
# Load model and tokenizer
|
| 53 |
+
model = AutoModelForCausalLM.from_pretrained("bniladridas/conversational-ai-fine-tuned")
|
| 54 |
+
tokenizer = AutoTokenizer.from_pretrained("bniladridas/conversational-ai-fine-tuned")
|
| 55 |
+
|
| 56 |
+
# Prepare input
|
| 57 |
+
input_text = "Hello, how are you?"
|
| 58 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
| 59 |
+
|
| 60 |
+
# Generate response
|
| 61 |
+
outputs = model.generate(**inputs)
|
| 62 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 63 |
+
print(response)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### Using the Terminal
|
| 67 |
+
Run the provided script to generate responses:
|
| 68 |
+
```bash
|
| 69 |
+
python3 generate_response.py --input "Hello, how are you?"
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Using the API
|
| 73 |
+
**Check API Status:**
|
| 74 |
+
```bash
|
| 75 |
+
curl http://localhost:8000/status
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
**Generate a Response:**
|
| 79 |
+
```bash
|
| 80 |
+
curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"input_text": "Hello, how are you?"}'
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
### Using FastAPI Documentation
|
| 84 |
+
Interact with the API via the browser at:
|
| 85 |
+
[http://localhost:8000/docs#/default/generate_response_chat_post](http://localhost:8000/docs#/default/generate_response_chat_post)
|
| 86 |
+
|
| 87 |
+
## Test Cases
|
| 88 |
+
The following tests were conducted to validate the model:
|
| 89 |
+
|
| 90 |
+
### Terminal Script Test:
|
| 91 |
+
```bash
|
| 92 |
+
python3 generate_response.py --input "Hello, how are you?"
|
| 93 |
+
```
|
| 94 |
+
**Output:**
|
| 95 |
+
```
|
| 96 |
+
Hello how are you? Fine thanks. How are you?
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
### API Status Check:
|
| 100 |
+
```bash
|
| 101 |
+
curl http://localhost:8000/status
|
| 102 |
+
```
|
| 103 |
+
**Output:**
|
| 104 |
+
```json
|
| 105 |
+
{"status": "API is running"}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
### API Chat Response:
|
| 109 |
+
```bash
|
| 110 |
+
curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"input_text": "Hello, how are you?"}'
|
| 111 |
+
```
|
| 112 |
+
**Output:**
|
| 113 |
+
```json
|
| 114 |
+
{"response": "Hello how are you? Fine thanks. How are you?"}
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## Example Usage
|
| 118 |
+
*Example interactions are not yet provided. Users can test the model with their own inputs using the methods above to see its conversational capabilities.*
|