Yehor commited on
Commit
9bd21b2
·
verified ·
1 Parent(s): 670ad0c

Upload model with adaptive-classifier

Browse files
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multilingual
3
+ tags:
4
+ - adaptive-classifier
5
+ - text-classification
6
+ - continuous-learning
7
+ license: apache-2.0
8
+ ---
9
+
10
+ # Adaptive Classifier
11
+
12
+ This model is an instance of an [adaptive-classifier](https://github.com/codelion/adaptive-classifier) that allows for continuous learning and dynamic class addition.
13
+
14
+ ## Installation
15
+
16
+ **IMPORTANT:** To use this model, you must first install the `adaptive-classifier` library. You do **NOT** need `trust_remote_code=True`.
17
+
18
+ ```bash
19
+ pip install adaptive-classifier
20
+ ```
21
+
22
+ ## Model Details
23
+
24
+ - Base Model: distilbert/distilbert-base-cased
25
+ - Number of Classes: 39
26
+ - Total Examples: 3961
27
+ - Embedding Dimension: 768
28
+
29
+ ## Class Distribution
30
+
31
+ ```
32
+ administrativnie_pravo: 31 examples (0.8%)
33
+ avtovlasnykam: 151 examples (3.8%)
34
+ bankivska_diialnist: 101 examples (2.5%)
35
+ dierzhavni_zakupivli: 2 examples (0.1%)
36
+ doghovirni_vidnosini: 41 examples (1.0%)
37
+ dovircha_vlastnist: 7 examples (0.2%)
38
+ ekologiya: 3 examples (0.1%)
39
+ gospodarskie_pravo: 38 examples (1.0%)
40
+ gromadianski_pravovidnosini: 32 examples (0.8%)
41
+ immighratsiia_iemighratsiia: 107 examples (2.7%)
42
+ inshe: 858 examples (21.7%)
43
+ intieliektualna_vlasnist: 22 examples (0.6%)
44
+ investitsii: 5 examples (0.1%)
45
+ korporativnie_pravo: 12 examples (0.3%)
46
+ kriminalnie_pravo: 81 examples (2.0%)
47
+ litsienzuvannia: 9 examples (0.2%)
48
+ medicina: 67 examples (1.7%)
49
+ mizhnarodni_pravovidnosini: 12 examples (0.3%)
50
+ mytne_pravo: 3 examples (0.1%)
51
+ nierukhomist: 97 examples (2.4%)
52
+ notarialni_pytanniia: 19 examples (0.5%)
53
+ opodatkuvannia: 131 examples (3.3%)
54
+ pidpriemnicka_dialnist: 43 examples (1.1%)
55
+ piensiiata_sotsialni_viplati: 154 examples (3.9%)
56
+ pratsevlashtuvvannya: 181 examples (4.6%)
57
+ prava_spozhivachiv: 30 examples (0.8%)
58
+ prava_vnutrishno_pieriemishchienikh_osib: 111 examples (2.8%)
59
+ reklama: 2 examples (0.1%)
60
+ reyestraciya_likvidaciya_bankrutstvo: 78 examples (2.0%)
61
+ simejne_pravo: 288 examples (7.3%)
62
+ sotsialnyj_zakhist: 172 examples (4.3%)
63
+ spadkove_pravo: 80 examples (2.0%)
64
+ strakhuvannya: 2 examples (0.1%)
65
+ sudova_praktika: 154 examples (3.9%)
66
+ tsivilne_pravo: 117 examples (3.0%)
67
+ vighotovliennia_produktsiyi_ta_nadannia_poslugh: 4 examples (0.1%)
68
+ viiskovie_pravo: 594 examples (15.0%)
69
+ zhitlovi_pravovidnosini: 58 examples (1.5%)
70
+ ziemielnie_pravo: 64 examples (1.6%)
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ After installing the `adaptive-classifier` library, you can load and use this model:
76
+
77
+ ```python
78
+ from adaptive_classifier import AdaptiveClassifier
79
+
80
+ # Load the model (no trust_remote_code needed!)
81
+ classifier = AdaptiveClassifier.from_pretrained("adaptive-classifier/model-name")
82
+
83
+ # Make predictions
84
+ text = "Your text here"
85
+ predictions = classifier.predict(text)
86
+ print(predictions) # List of (label, confidence) tuples
87
+
88
+ # Add new examples for continuous learning
89
+ texts = ["Example 1", "Example 2"]
90
+ labels = ["class1", "class2"]
91
+ classifier.add_examples(texts, labels)
92
+ ```
93
+
94
+ **Note:** This model uses the `adaptive-classifier` library distributed via PyPI. You do **NOT** need to set `trust_remote_code=True` - just install the library first.
95
+
96
+ ## Training Details
97
+
98
+ - Training Steps: 1
99
+ - Examples per Class: See distribution above
100
+ - Prototype Memory: Active
101
+ - Neural Adaptation: Active
102
+
103
+ ## Limitations
104
+
105
+ This model:
106
+ - Requires at least 3 examples per class
107
+ - Has a maximum of 1000 examples per class
108
+ - Updates prototypes every 10 examples
109
+
110
+ ## Citation
111
+
112
+ ```bibtex
113
+ @software{adaptive_classifier,
114
+ title = {Adaptive Classifier: Dynamic Text Classification with Continuous Learning},
115
+ author = {Sharma, Asankhaya},
116
+ year = {2025},
117
+ publisher = {GitHub},
118
+ url = {https://github.com/codelion/adaptive-classifier}
119
+ }
120
+ ```
config.json ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "config": {
3
+ "batch_size": 4,
4
+ "cost_coefficients": {},
5
+ "cost_function_type": "separable",
6
+ "device_map": "auto",
7
+ "early_stopping_patience": 2,
8
+ "enable_strategic_mode": false,
9
+ "epochs": 20,
10
+ "ewc_lambda": 100.0,
11
+ "gradient_checkpointing": false,
12
+ "learning_rate": 2e-05,
13
+ "max_examples_per_class": 1000,
14
+ "max_length": 2048,
15
+ "min_confidence": 0.1,
16
+ "min_examples_per_class": 3,
17
+ "neural_weight": 0.3,
18
+ "num_representative_examples": 5,
19
+ "prototype_update_frequency": 10,
20
+ "prototype_weight": 0.7,
21
+ "quantization": null,
22
+ "similarity_threshold": 0.6,
23
+ "strategic_blend_regular_weight": 0.6,
24
+ "strategic_blend_strategic_weight": 0.4,
25
+ "strategic_lambda": 0.1,
26
+ "strategic_prediction_head_weight": 0.5,
27
+ "strategic_prediction_proto_weight": 0.5,
28
+ "strategic_robust_head_weight": 0.2,
29
+ "strategic_robust_proto_weight": 0.8,
30
+ "strategic_training_frequency": 10,
31
+ "warmup_steps": 0
32
+ },
33
+ "embedding_dim": 768,
34
+ "id_to_label": {
35
+ "0": "administrativnie_pravo",
36
+ "1": "avtovlasnykam",
37
+ "10": "inshe",
38
+ "11": "intieliektualna_vlasnist",
39
+ "12": "investitsii",
40
+ "13": "korporativnie_pravo",
41
+ "14": "kriminalnie_pravo",
42
+ "15": "litsienzuvannia",
43
+ "16": "medicina",
44
+ "17": "mizhnarodni_pravovidnosini",
45
+ "18": "mytne_pravo",
46
+ "19": "nierukhomist",
47
+ "2": "bankivska_diialnist",
48
+ "20": "notarialni_pytanniia",
49
+ "21": "opodatkuvannia",
50
+ "22": "pidpriemnicka_dialnist",
51
+ "23": "piensiiata_sotsialni_viplati",
52
+ "24": "pratsevlashtuvvannya",
53
+ "25": "prava_spozhivachiv",
54
+ "26": "prava_vnutrishno_pieriemishchienikh_osib",
55
+ "27": "reklama",
56
+ "28": "reyestraciya_likvidaciya_bankrutstvo",
57
+ "29": "simejne_pravo",
58
+ "3": "dierzhavni_zakupivli",
59
+ "30": "sotsialnyj_zakhist",
60
+ "31": "spadkove_pravo",
61
+ "32": "strakhuvannya",
62
+ "33": "sudova_praktika",
63
+ "34": "tsivilne_pravo",
64
+ "35": "vighotovliennia_produktsiyi_ta_nadannia_poslugh",
65
+ "36": "viiskovie_pravo",
66
+ "37": "zhitlovi_pravovidnosini",
67
+ "38": "ziemielnie_pravo",
68
+ "4": "doghovirni_vidnosini",
69
+ "5": "dovircha_vlastnist",
70
+ "6": "ekologiya",
71
+ "7": "gospodarskie_pravo",
72
+ "8": "gromadianski_pravovidnosini",
73
+ "9": "immighratsiia_iemighratsiia"
74
+ },
75
+ "label_to_id": {
76
+ "administrativnie_pravo": 0,
77
+ "avtovlasnykam": 1,
78
+ "bankivska_diialnist": 2,
79
+ "dierzhavni_zakupivli": 3,
80
+ "doghovirni_vidnosini": 4,
81
+ "dovircha_vlastnist": 5,
82
+ "ekologiya": 6,
83
+ "gospodarskie_pravo": 7,
84
+ "gromadianski_pravovidnosini": 8,
85
+ "immighratsiia_iemighratsiia": 9,
86
+ "inshe": 10,
87
+ "intieliektualna_vlasnist": 11,
88
+ "investitsii": 12,
89
+ "korporativnie_pravo": 13,
90
+ "kriminalnie_pravo": 14,
91
+ "litsienzuvannia": 15,
92
+ "medicina": 16,
93
+ "mizhnarodni_pravovidnosini": 17,
94
+ "mytne_pravo": 18,
95
+ "nierukhomist": 19,
96
+ "notarialni_pytanniia": 20,
97
+ "opodatkuvannia": 21,
98
+ "pidpriemnicka_dialnist": 22,
99
+ "piensiiata_sotsialni_viplati": 23,
100
+ "pratsevlashtuvvannya": 24,
101
+ "prava_spozhivachiv": 25,
102
+ "prava_vnutrishno_pieriemishchienikh_osib": 26,
103
+ "reklama": 27,
104
+ "reyestraciya_likvidaciya_bankrutstvo": 28,
105
+ "simejne_pravo": 29,
106
+ "sotsialnyj_zakhist": 30,
107
+ "spadkove_pravo": 31,
108
+ "strakhuvannya": 32,
109
+ "sudova_praktika": 33,
110
+ "tsivilne_pravo": 34,
111
+ "vighotovliennia_produktsiyi_ta_nadannia_poslugh": 35,
112
+ "viiskovie_pravo": 36,
113
+ "zhitlovi_pravovidnosini": 37,
114
+ "ziemielnie_pravo": 38
115
+ },
116
+ "library_name": "adaptive-classifier",
117
+ "model_name": "distilbert/distilbert-base-cased",
118
+ "train_steps": 1,
119
+ "training_history": {
120
+ "administrativnie_pravo": 31,
121
+ "avtovlasnykam": 151,
122
+ "bankivska_diialnist": 101,
123
+ "dierzhavni_zakupivli": 2,
124
+ "doghovirni_vidnosini": 41,
125
+ "dovircha_vlastnist": 7,
126
+ "ekologiya": 3,
127
+ "gospodarskie_pravo": 38,
128
+ "gromadianski_pravovidnosini": 32,
129
+ "immighratsiia_iemighratsiia": 107,
130
+ "inshe": 858,
131
+ "intieliektualna_vlasnist": 22,
132
+ "investitsii": 5,
133
+ "korporativnie_pravo": 12,
134
+ "kriminalnie_pravo": 81,
135
+ "litsienzuvannia": 9,
136
+ "medicina": 67,
137
+ "mizhnarodni_pravovidnosini": 12,
138
+ "mytne_pravo": 3,
139
+ "nierukhomist": 97,
140
+ "notarialni_pytanniia": 19,
141
+ "opodatkuvannia": 131,
142
+ "pidpriemnicka_dialnist": 43,
143
+ "piensiiata_sotsialni_viplati": 154,
144
+ "pratsevlashtuvvannya": 181,
145
+ "prava_spozhivachiv": 30,
146
+ "prava_vnutrishno_pieriemishchienikh_osib": 111,
147
+ "reklama": 2,
148
+ "reyestraciya_likvidaciya_bankrutstvo": 78,
149
+ "simejne_pravo": 288,
150
+ "sotsialnyj_zakhist": 172,
151
+ "spadkove_pravo": 80,
152
+ "strakhuvannya": 2,
153
+ "sudova_praktika": 154,
154
+ "tsivilne_pravo": 117,
155
+ "vighotovliennia_produktsiyi_ta_nadannia_poslugh": 4,
156
+ "viiskovie_pravo": 594,
157
+ "zhitlovi_pravovidnosini": 58,
158
+ "ziemielnie_pravo": 64
159
+ }
160
+ }
examples.json ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61146512e436a0cf0ec73969e3f89302788d2b5579b9036640bdde40d72ab635
3
+ size 3727684
onnx/config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "gelu",
3
+ "architectures": [
4
+ "DistilBertForMaskedLM"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "dim": 768,
8
+ "dropout": 0.1,
9
+ "hidden_dim": 3072,
10
+ "initializer_range": 0.02,
11
+ "max_position_embeddings": 512,
12
+ "model_type": "distilbert",
13
+ "n_heads": 12,
14
+ "n_layers": 6,
15
+ "output_past": true,
16
+ "pad_token_id": 0,
17
+ "qa_dropout": 0.1,
18
+ "seq_classif_dropout": 0.2,
19
+ "sinusoidal_pos_embds": false,
20
+ "tie_weights_": true,
21
+ "transformers_version": "4.55.4",
22
+ "vocab_size": 28996
23
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef959177dc7a7a88a7c9d905ab62814f7a5db356652361e09e294cf83481f2b7
3
+ size 260856969
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb8bd747105195b4d74435ee99ac9607a352c85073cf26198b07b289abebde83
3
+ size 65567815
onnx/ort_config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "one_external_file": true,
3
+ "opset": null,
4
+ "optimization": {},
5
+ "quantization": {
6
+ "activations_dtype": "QUInt8",
7
+ "activations_symmetric": false,
8
+ "format": "QOperator",
9
+ "is_static": false,
10
+ "mode": "IntegerOps",
11
+ "nodes_to_exclude": [],
12
+ "nodes_to_quantize": [],
13
+ "operators_to_quantize": [
14
+ "Conv",
15
+ "MatMul",
16
+ "Attention",
17
+ "LSTM",
18
+ "Gather",
19
+ "Transpose",
20
+ "EmbedLayerNormalization"
21
+ ],
22
+ "per_channel": false,
23
+ "qdq_add_pair_to_weight": false,
24
+ "qdq_dedicated_pair": false,
25
+ "qdq_op_type_per_channel_support_to_axis": {
26
+ "MatMul": 1
27
+ },
28
+ "reduce_range": false,
29
+ "weights_dtype": "QInt8",
30
+ "weights_symmetric": true
31
+ },
32
+ "use_external_data_format": false
33
+ }
onnx/special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
onnx/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
onnx/tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": false,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "DistilBertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
onnx/vocab.txt ADDED
The diff for this file is too large to render. See raw diff