Vurtnec commited on
Commit
2d46ad6
·
verified ·
1 Parent(s): f15e775

Add model card with evaluation results

Browse files
Files changed (1) hide show
  1. README.md +123 -39
README.md CHANGED
@@ -1,59 +1,143 @@
1
  ---
 
2
  base_model: HuggingFaceTB/SmolLM2-135M
3
- library_name: transformers
4
- model_name: eot-detector-smollm2
5
  tags:
6
- - generated_from_trainer
7
- - trl
8
- - hf_jobs
9
- - sft
10
- licence: license
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
- # Model Card for eot-detector-smollm2
14
 
15
- This model is a fine-tuned version of [HuggingFaceTB/SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M).
16
- It has been trained using [TRL](https://github.com/huggingface/trl).
17
 
18
- ## Quick start
19
 
20
- ```python
21
- from transformers import pipeline
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
24
- generator = pipeline("text-generation", model="Vurtnec/eot-detector-smollm2", device="cuda")
25
- output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
26
- print(output["generated_text"])
27
  ```
28
 
29
- ## Training procedure
 
 
 
 
 
 
 
 
 
30
 
31
-
 
 
32
 
 
 
 
33
 
34
- This model was trained with SFT.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- ### Framework versions
37
 
38
- - TRL: 0.25.1
39
- - Transformers: 4.57.3
40
- - Pytorch: 2.9.1
41
- - Datasets: 4.4.1
42
- - Tokenizers: 0.22.1
43
 
44
- ## Citations
45
 
 
 
 
46
 
 
47
 
48
- Cite TRL as:
49
-
50
- ```bibtex
51
- @misc{vonwerra2022trl,
52
- title = {{TRL: Transformer Reinforcement Learning}},
53
- author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
54
- year = 2020,
55
- journal = {GitHub repository},
56
- publisher = {GitHub},
57
- howpublished = {\url{https://github.com/huggingface/trl}}
58
- }
59
- ```
 
1
  ---
2
+ license: apache-2.0
3
  base_model: HuggingFaceTB/SmolLM2-135M
 
 
4
  tags:
5
+ - end-of-turn-detection
6
+ - turn-taking
7
+ - voice-ai
8
+ - lora
9
+ - peft
10
+ datasets:
11
+ - Vurtnec/eot-detection-dataset
12
+ language:
13
+ - en
14
+ pipeline_tag: text-generation
15
+ model-index:
16
+ - name: eot-detector-smollm2
17
+ results:
18
+ - task:
19
+ type: text-classification
20
+ name: End-of-Turn Detection
21
+ dataset:
22
+ name: EOT Detection Test Set
23
+ type: Vurtnec/eot-detection-testset
24
+ metrics:
25
+ - name: Accuracy
26
+ type: accuracy
27
+ value: 0.7667
28
+ - name: Precision
29
+ type: precision
30
+ value: 1.0
31
+ - name: Recall
32
+ type: recall
33
+ value: 0.5333
34
+ - name: F1
35
+ type: f1
36
+ value: 0.6957
37
  ---
38
 
39
+ # EOT Detector - SmolLM2 135M
40
 
41
+ A fine-tuned model for **End-of-Turn (EOT) detection** in conversations, based on [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M).
 
42
 
43
+ ## Model Description
44
 
45
+ This model predicts whether a user has finished speaking in a conversation (end-of-turn) or is still continuing. It's designed for voice AI applications where accurate turn-taking is critical to avoid interrupting users.
46
+
47
+ ### Key Features
48
+ - **Base Model**: SmolLM2-135M (135M parameters)
49
+ - **Fine-tuning Method**: LoRA (r=4, alpha=8)
50
+ - **Task**: Binary classification (complete vs incomplete turn)
51
+ - **Inference Speed**: ~10ms on CPU
52
+
53
+ ## Training Details
54
+
55
+ | Parameter | Value |
56
+ |-----------|-------|
57
+ | Base Model | HuggingFaceTB/SmolLM2-135M |
58
+ | LoRA Rank | 4 |
59
+ | LoRA Alpha | 8 |
60
+ | Learning Rate | 2e-4 |
61
+ | Epochs | 3 |
62
+ | Training Samples | 50 |
63
+ | Hardware | T4 GPU |
64
+
65
+ ## Evaluation Results
66
+
67
+ Evaluated on [Vurtnec/eot-detection-testset](https://huggingface.co/datasets/Vurtnec/eot-detection-testset) (30 samples):
68
+
69
+ | Metric | Value |
70
+ |--------|-------|
71
+ | **Accuracy** | 76.67% |
72
+ | **Precision** | 100% |
73
+ | **Recall** | 53.33% |
74
+ | **F1 Score** | 69.57% |
75
+
76
+ ### Classification Report
77
+
78
+ ```
79
+ precision recall f1-score support
80
+
81
+ Incomplete 0.68 1.00 0.81 15
82
+ Complete 1.00 0.53 0.70 15
83
 
84
+ accuracy 0.77 30
85
+ macro avg 0.84 0.77 0.75 30
 
 
86
  ```
87
 
88
+ ### Analysis
89
+ - **High Precision (100%)**: When the model predicts "complete", it's always correct
90
+ - **Lower Recall (53%)**: The model is conservative, sometimes missing completed turns
91
+ - This is preferable for voice AI: better to wait slightly longer than to interrupt users
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ from transformers import AutoModelForCausalLM, AutoTokenizer
97
+ from peft import PeftModel
98
 
99
+ # Load model
100
+ base_model = "HuggingFaceTB/SmolLM2-135M"
101
+ adapter_model = "Vurtnec/eot-detector-smollm2"
102
 
103
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
104
+ model = AutoModelForCausalLM.from_pretrained(base_model)
105
+ model = PeftModel.from_pretrained(model, adapter_model)
106
 
107
+ # Format input
108
+ def format_conversation(messages):
109
+ text = ""
110
+ for msg in messages:
111
+ text += f"<|im_start|>{msg['role']}\n{msg['content']}<|im_end|>\n"
112
+ text += "<|im_start|>label\n"
113
+ return text
114
+
115
+ # Example
116
+ messages = [
117
+ {"role": "user", "content": "Hi, I need help"},
118
+ {"role": "assistant", "content": "Sure, what do you need?"},
119
+ {"role": "user", "content": "Well, um..."}
120
+ ]
121
+
122
+ input_text = format_conversation(messages)
123
+ inputs = tokenizer(input_text, return_tensors="pt")
124
+ outputs = model.generate(**inputs, max_new_tokens=10)
125
+ result = tokenizer.decode(outputs[0])
126
+
127
+ # Check for <|eot|> (complete) or <|continue|> (incomplete)
128
+ ```
129
 
130
+ ## Datasets
131
 
132
+ - **Training**: [Vurtnec/eot-detection-dataset](https://huggingface.co/datasets/Vurtnec/eot-detection-dataset) (50 samples)
133
+ - **Testing**: [Vurtnec/eot-detection-testset](https://huggingface.co/datasets/Vurtnec/eot-detection-testset) (30 samples)
 
 
 
134
 
135
+ ## Limitations
136
 
137
+ - Trained on limited English data (50 samples)
138
+ - May not generalize well to domain-specific conversations
139
+ - Conservative prediction style (prefers "incomplete" when uncertain)
140
 
141
+ ## License
142
 
143
+ Apache 2.0