File size: 4,181 Bytes
33ae159
a7c29d5
33ae159
 
 
 
a7c29d5
 
33ae159
 
 
 
 
5ffa96c
 
7114159
a7c29d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33ae159
65cddc8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33ae159
65cddc8
33ae159
65cddc8
 
 
 
 
 
 
33ae159
65cddc8
33ae159
65cddc8
 
 
 
 
 
 
 
 
 
 
33ae159
65cddc8
 
33ae159
65cddc8
 
 
 
33ae159
65cddc8
 
33ae159
65cddc8
 
 
 
 
 
 
33ae159
65cddc8
a7c29d5
2aca745
 
 
33ae159
2aca745
 
33ae159
2aca745
a7c29d5
2aca745
33ae159
2aca745
 
 
 
33ae159
2aca745
 
 
33ae159
65cddc8
 
 
33ae159
a7c29d5
 
4de05d3
c83034c
33ae159
 
a7c29d5
 
33ae159
a7c29d5
2aca745
 
 
8e78730
2aca745
 
 
 
a7c29d5
8e78730
33ae159
 
 
a7c29d5
33ae159
a7c29d5
 
 
 
 
33ae159
a7c29d5
33ae159
a7c29d5
 
 
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
165
166
167
168
169
170
171
172
173
174
175
176
177
---
license: mit
language:
- zh
metrics:
- accuracy
- f1 (macro)
- f1 (micro)
base_model:
- google-bert/bert-base-chinese
pipeline_tag: text-classification
tags:
- Multi-label Text Classification
datasets:
- scfengv/TVL-general-layer-dataset
library_name: adapter-transformers
model-index:
- name: scfengv/TVL_GeneralLayerClassifier
  results:
  - task:
      type: multi-label text-classification
    dataset:
      name: scfengv/TVL-general-layer-dataset
      type: scfengv/TVL-general-layer-dataset
    metrics:
    - name: Accuracy
      type: Accuracy
      value: 0.952902
    - name: F1 score (Micro)
      type: F1 score (Micro)
      value: 0.968717
    - name: F1 score (Macro)
      type: F1 score (Macro)
      value: 0.970818
---
# Model Details of TVL_GeneralLayerClassifier

## Base Model
This model is fine-tuned from [google-bert/bert-base-chinese](https://huggingface.co/google-bert/bert-base-chinese).

## Model Architecture
- **Type**: BERT-based text classification model
- **Hidden Size**: 768
- **Number of Layers**: 12
- **Number of Attention Heads**: 12
- **Intermediate Size**: 3072
- **Max Sequence Length**: 512
- **Vocabulary Size**: 21,128

## Key Components
1. **Embeddings**
   - Word Embeddings
   - Position Embeddings
   - Token Type Embeddings
   - Layer Normalization

2. **Encoder**
   - 12 layers of:
     - Self-Attention Mechanism
     - Intermediate Dense Layer
     - Output Dense Layer
     - Layer Normalization

3. **Pooler**
   - Dense layer for sentence representation

4. **Classifier**
   - Output layer with 4 classes

## Training Hyperparameters

The model was trained using the following hyperparameters:

```
Learning rate: 1e-05
Batch size: 32
Number of epochs: 10
Optimizer: Adam
Loss function: torch.nn.BCEWithLogitsLoss()
```

## Training Infrastructure

- **Hardware Type:** NVIDIA Quadro RTX8000
- **Library:** PyTorch
- **Hours used:** 2hr 56mins

## Model Parameters
- Total parameters: ~102M (estimated)
- All parameters are in 32-bit floating point (F32) format

## Input Processing
- Uses BERT tokenization
- Supports sequences up to 512 tokens

## Output
- 4-class multi-label classification

## Performance Metrics
- Accuracy score: 0.952902
- F1 score (Micro): 0.968717
- F1 score (Macro): 0.970818

## Training Dataset
This model was trained on the [scfengv/TVL-general-layer-dataset](https://huggingface.co/datasets/scfengv/TVL-general-layer-dataset).

## Testing Dataset

- [scfengv/TVL-general-layer-dataset](https://huggingface.co/datasets/scfengv/TVL-general-layer-dataset)
  - validation
  - Remove Emoji
  - Emoji2Desc
  - Remove Punctuation

## Usage

```python
import torch
from transformers import BertForSequenceClassification, BertTokenizer

model = BertForSequenceClassification.from_pretrained("scfengv/TVL_GeneralLayerClassifier")
tokenizer = BertTokenizer.from_pretrained("scfengv/TVL_GeneralLayerClassifier")

# Prepare your text
text = "Your text here" ## Please refer to Dataset
inputs = tokenizer(text, return_tensors = "pt", padding = True, truncation = True, max_length = 512)

# Make prediction
with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.sigmoid(outputs.logits)

# Print predictions
print(predictions)
```

## Additional Notes
- This model is specifically designed for TVL general layer classification tasks.
- It's based on the Chinese BERT model, indicating it's optimized for Chinese text.

- **Hardware Type:** NVIDIA Quadro RTX8000
- **Library:** PyTorch
- **Hours used:** 2hr 56mins

### Training Data

- [scfengv/TVL-general-layer-dataset](https://huggingface.co/datasets/scfengv/TVL-general-layer-dataset)
  - train

### Training Hyperparameters

The model was trained using the following hyperparameters:

```
Learning rate: 1e-05
Batch size: 32
Number of epochs: 10
Optimizer: Adam
Loss function: torch.nn.BCEWithLogitsLoss()
```

## Evaluation

### Testing Data

- [scfengv/TVL-general-layer-dataset](https://huggingface.co/datasets/scfengv/TVL-general-layer-dataset)
  - validation
  - Remove Emoji
  - Emoji2Desc
  - Remove Punctuation

### Results (validation)

- Accuracy: 0.952902
- F1 Score (Micro): 0.968717
- F1 Score (Macro): 0.970818