Upload model with adaptive-classifier
Browse files- README.md +110 -0
- config.json +159 -0
- examples.json +0 -0
- model.safetensors +3 -0
- onnx/config.json +45 -0
- onnx/model.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
- onnx/ort_config.json +33 -0
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
You can install it with `pip install adaptive-classifier`.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
- Base Model: Goader/modern-liberta-large
|
| 19 |
+
- Number of Classes: 39
|
| 20 |
+
- Total Examples: 2904
|
| 21 |
+
- Embedding Dimension: 1024
|
| 22 |
+
|
| 23 |
+
## Class Distribution
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
0: 474 examples (16.3%)
|
| 27 |
+
1: 2 examples (0.1%)
|
| 28 |
+
2: 56 examples (1.9%)
|
| 29 |
+
3: 1 examples (0.0%)
|
| 30 |
+
4: 79 examples (2.7%)
|
| 31 |
+
5: 26 examples (0.9%)
|
| 32 |
+
6: 53 examples (1.8%)
|
| 33 |
+
7: 59 examples (2.0%)
|
| 34 |
+
8: 82 examples (2.8%)
|
| 35 |
+
9: 18 examples (0.6%)
|
| 36 |
+
10: 33 examples (1.1%)
|
| 37 |
+
11: 34 examples (1.2%)
|
| 38 |
+
12: 107 examples (3.7%)
|
| 39 |
+
13: 123 examples (4.2%)
|
| 40 |
+
14: 400 examples (13.8%)
|
| 41 |
+
15: 124 examples (4.3%)
|
| 42 |
+
16: 63 examples (2.2%)
|
| 43 |
+
17: 24 examples (0.8%)
|
| 44 |
+
18: 1 examples (0.0%)
|
| 45 |
+
19: 142 examples (4.9%)
|
| 46 |
+
20: 150 examples (5.2%)
|
| 47 |
+
21: 4 examples (0.1%)
|
| 48 |
+
22: 7 examples (0.2%)
|
| 49 |
+
23: 62 examples (2.1%)
|
| 50 |
+
24: 36 examples (1.2%)
|
| 51 |
+
25: 27 examples (0.9%)
|
| 52 |
+
26: 80 examples (2.8%)
|
| 53 |
+
27: 89 examples (3.1%)
|
| 54 |
+
28: 4 examples (0.1%)
|
| 55 |
+
29: 15 examples (0.5%)
|
| 56 |
+
30: 117 examples (4.0%)
|
| 57 |
+
31: 48 examples (1.7%)
|
| 58 |
+
32: 7 examples (0.2%)
|
| 59 |
+
33: 1 examples (0.0%)
|
| 60 |
+
34: 237 examples (8.2%)
|
| 61 |
+
35: 2 examples (0.1%)
|
| 62 |
+
36: 9 examples (0.3%)
|
| 63 |
+
37: 10 examples (0.3%)
|
| 64 |
+
38: 98 examples (3.4%)
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Usage
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from adaptive_classifier import AdaptiveClassifier
|
| 71 |
+
|
| 72 |
+
# Load the model
|
| 73 |
+
classifier = AdaptiveClassifier.from_pretrained("adaptive-classifier/model-name")
|
| 74 |
+
|
| 75 |
+
# Make predictions
|
| 76 |
+
text = "Your text here"
|
| 77 |
+
predictions = classifier.predict(text)
|
| 78 |
+
print(predictions) # List of (label, confidence) tuples
|
| 79 |
+
|
| 80 |
+
# Add new examples
|
| 81 |
+
texts = ["Example 1", "Example 2"]
|
| 82 |
+
labels = ["class1", "class2"]
|
| 83 |
+
classifier.add_examples(texts, labels)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Training Details
|
| 87 |
+
|
| 88 |
+
- Training Steps: 1
|
| 89 |
+
- Examples per Class: See distribution above
|
| 90 |
+
- Prototype Memory: Active
|
| 91 |
+
- Neural Adaptation: Active
|
| 92 |
+
|
| 93 |
+
## Limitations
|
| 94 |
+
|
| 95 |
+
This model:
|
| 96 |
+
- Requires at least 3 examples per class
|
| 97 |
+
- Has a maximum of 1000 examples per class
|
| 98 |
+
- Updates prototypes every 100 examples
|
| 99 |
+
|
| 100 |
+
## Citation
|
| 101 |
+
|
| 102 |
+
```bibtex
|
| 103 |
+
@software{adaptive_classifier,
|
| 104 |
+
title = {Adaptive Classifier: Dynamic Text Classification with Continuous Learning},
|
| 105 |
+
author = {Sharma, Asankhaya},
|
| 106 |
+
year = {2025},
|
| 107 |
+
publisher = {GitHub},
|
| 108 |
+
url = {https://github.com/codelion/adaptive-classifier}
|
| 109 |
+
}
|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": {
|
| 3 |
+
"batch_size": 32,
|
| 4 |
+
"cost_coefficients": {},
|
| 5 |
+
"cost_function_type": "separable",
|
| 6 |
+
"device_map": "auto",
|
| 7 |
+
"early_stopping_patience": 3,
|
| 8 |
+
"enable_strategic_mode": false,
|
| 9 |
+
"epochs": 10,
|
| 10 |
+
"ewc_lambda": 100.0,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"learning_rate": 0.001,
|
| 13 |
+
"max_examples_per_class": 1000,
|
| 14 |
+
"max_length": 512,
|
| 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": 100,
|
| 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": 1024,
|
| 34 |
+
"id_to_label": {
|
| 35 |
+
"0": 0,
|
| 36 |
+
"1": 1,
|
| 37 |
+
"10": 10,
|
| 38 |
+
"11": 11,
|
| 39 |
+
"12": 12,
|
| 40 |
+
"13": 13,
|
| 41 |
+
"14": 14,
|
| 42 |
+
"15": 15,
|
| 43 |
+
"16": 16,
|
| 44 |
+
"17": 17,
|
| 45 |
+
"18": 18,
|
| 46 |
+
"19": 19,
|
| 47 |
+
"2": 2,
|
| 48 |
+
"20": 20,
|
| 49 |
+
"21": 21,
|
| 50 |
+
"22": 22,
|
| 51 |
+
"23": 23,
|
| 52 |
+
"24": 24,
|
| 53 |
+
"25": 25,
|
| 54 |
+
"26": 26,
|
| 55 |
+
"27": 27,
|
| 56 |
+
"28": 28,
|
| 57 |
+
"29": 29,
|
| 58 |
+
"3": 3,
|
| 59 |
+
"30": 30,
|
| 60 |
+
"31": 31,
|
| 61 |
+
"32": 32,
|
| 62 |
+
"33": 33,
|
| 63 |
+
"34": 34,
|
| 64 |
+
"35": 35,
|
| 65 |
+
"36": 36,
|
| 66 |
+
"37": 37,
|
| 67 |
+
"38": 38,
|
| 68 |
+
"4": 4,
|
| 69 |
+
"5": 5,
|
| 70 |
+
"6": 6,
|
| 71 |
+
"7": 7,
|
| 72 |
+
"8": 8,
|
| 73 |
+
"9": 9
|
| 74 |
+
},
|
| 75 |
+
"label_to_id": {
|
| 76 |
+
"0": 0,
|
| 77 |
+
"1": 1,
|
| 78 |
+
"2": 2,
|
| 79 |
+
"3": 3,
|
| 80 |
+
"4": 4,
|
| 81 |
+
"5": 5,
|
| 82 |
+
"6": 6,
|
| 83 |
+
"7": 7,
|
| 84 |
+
"8": 8,
|
| 85 |
+
"9": 9,
|
| 86 |
+
"10": 10,
|
| 87 |
+
"11": 11,
|
| 88 |
+
"12": 12,
|
| 89 |
+
"13": 13,
|
| 90 |
+
"14": 14,
|
| 91 |
+
"15": 15,
|
| 92 |
+
"16": 16,
|
| 93 |
+
"17": 17,
|
| 94 |
+
"18": 18,
|
| 95 |
+
"19": 19,
|
| 96 |
+
"20": 20,
|
| 97 |
+
"21": 21,
|
| 98 |
+
"22": 22,
|
| 99 |
+
"23": 23,
|
| 100 |
+
"24": 24,
|
| 101 |
+
"25": 25,
|
| 102 |
+
"26": 26,
|
| 103 |
+
"27": 27,
|
| 104 |
+
"28": 28,
|
| 105 |
+
"29": 29,
|
| 106 |
+
"30": 30,
|
| 107 |
+
"31": 31,
|
| 108 |
+
"32": 32,
|
| 109 |
+
"33": 33,
|
| 110 |
+
"34": 34,
|
| 111 |
+
"35": 35,
|
| 112 |
+
"36": 36,
|
| 113 |
+
"37": 37,
|
| 114 |
+
"38": 38
|
| 115 |
+
},
|
| 116 |
+
"model_name": "Goader/modern-liberta-large",
|
| 117 |
+
"train_steps": 1,
|
| 118 |
+
"training_history": {
|
| 119 |
+
"0": 474,
|
| 120 |
+
"1": 2,
|
| 121 |
+
"2": 56,
|
| 122 |
+
"3": 1,
|
| 123 |
+
"4": 79,
|
| 124 |
+
"5": 26,
|
| 125 |
+
"6": 53,
|
| 126 |
+
"7": 59,
|
| 127 |
+
"8": 82,
|
| 128 |
+
"9": 18,
|
| 129 |
+
"10": 33,
|
| 130 |
+
"11": 34,
|
| 131 |
+
"12": 107,
|
| 132 |
+
"13": 123,
|
| 133 |
+
"14": 400,
|
| 134 |
+
"15": 124,
|
| 135 |
+
"16": 63,
|
| 136 |
+
"17": 24,
|
| 137 |
+
"18": 1,
|
| 138 |
+
"19": 142,
|
| 139 |
+
"20": 150,
|
| 140 |
+
"21": 4,
|
| 141 |
+
"22": 7,
|
| 142 |
+
"23": 62,
|
| 143 |
+
"24": 36,
|
| 144 |
+
"25": 27,
|
| 145 |
+
"26": 80,
|
| 146 |
+
"27": 89,
|
| 147 |
+
"28": 4,
|
| 148 |
+
"29": 15,
|
| 149 |
+
"30": 117,
|
| 150 |
+
"31": 48,
|
| 151 |
+
"32": 7,
|
| 152 |
+
"33": 1,
|
| 153 |
+
"34": 237,
|
| 154 |
+
"35": 2,
|
| 155 |
+
"36": 9,
|
| 156 |
+
"37": 10,
|
| 157 |
+
"38": 98
|
| 158 |
+
}
|
| 159 |
+
}
|
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:3ad88378b82b3355b340e600133838ecdacdb76315919694a79750f5048a0592
|
| 3 |
+
size 6541012
|
onnx/config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"ModernBertForMaskedLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 50281,
|
| 8 |
+
"classifier_activation": "gelu",
|
| 9 |
+
"classifier_bias": false,
|
| 10 |
+
"classifier_dropout": 0.0,
|
| 11 |
+
"classifier_pooling": "mean",
|
| 12 |
+
"cls_token_id": 2,
|
| 13 |
+
"decoder_bias": true,
|
| 14 |
+
"deterministic_flash_attn": false,
|
| 15 |
+
"embedding_dropout": 0.0,
|
| 16 |
+
"eos_token_id": 50282,
|
| 17 |
+
"global_attn_every_n_layers": 3,
|
| 18 |
+
"global_rope_theta": 160000,
|
| 19 |
+
"gradient_checkpointing": false,
|
| 20 |
+
"hidden_activation": "gelu",
|
| 21 |
+
"hidden_size": 1024,
|
| 22 |
+
"initializer_cutoff_factor": 2.0,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 2624,
|
| 25 |
+
"layer_norm_eps": 1e-05,
|
| 26 |
+
"local_attention": 128,
|
| 27 |
+
"local_rope_theta": 10000,
|
| 28 |
+
"max_position_embeddings": 8192,
|
| 29 |
+
"mlp_bias": false,
|
| 30 |
+
"mlp_dropout": 0.0,
|
| 31 |
+
"model_type": "modernbert",
|
| 32 |
+
"norm_bias": false,
|
| 33 |
+
"norm_eps": 1e-05,
|
| 34 |
+
"num_attention_heads": 16,
|
| 35 |
+
"num_hidden_layers": 28,
|
| 36 |
+
"pad_token_id": 0,
|
| 37 |
+
"position_embedding_type": "absolute",
|
| 38 |
+
"repad_logits_with_grad": false,
|
| 39 |
+
"sep_token_id": 3,
|
| 40 |
+
"sparse_pred_ignore_index": -100,
|
| 41 |
+
"sparse_prediction": false,
|
| 42 |
+
"torch_dtype": "float32",
|
| 43 |
+
"transformers_version": "4.53.3",
|
| 44 |
+
"vocab_size": 64000
|
| 45 |
+
}
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e714caa4a50be3bcb7d440c7d265d15c4b0cca728055eb587cd7bf12d78fd5f2
|
| 3 |
+
size 1635488755
|
onnx/model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5994c43e70dd9abcb3ec3583eb934a8e7fa8d33f00672256650f3c7cf4a9eb6f
|
| 3 |
+
size 409885430
|
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 |
+
}
|