Skip to content

Commit 6e7fe46

Browse files
authored
Merge pull request #61 from codelion/feat-update-model-card
Update classifier.py
2 parents 0a656e5 + eb30a25 commit 6e7fe46

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name="adaptive-classifier",
18-
version="0.1.0",
18+
version="0.1.1",
1919
author="codelion",
2020
author_email="codelion@okyasoft.com",
2121
description="A flexible, adaptive classification system for dynamic text classification",

src/adaptive_classifier/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .multilabel import MultiLabelAdaptiveClassifier, MultiLabelAdaptiveHead
55
from huggingface_hub import ModelHubMixin
66

7-
__version__ = "0.0.19"
7+
__version__ = "0.1.1"
88

99
__all__ = [
1010
"AdaptiveClassifier",

src/adaptive_classifier/classifier.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ def _save_pretrained(
549549
'id_to_label': {str(k): v for k, v in self.id_to_label.items()},
550550
'train_steps': self.train_steps,
551551
'training_history': self.training_history, # Save cumulative training counts
552-
'config': self.config.to_dict()
552+
'config': self.config.to_dict(),
553+
'library_name': 'adaptive-classifier' # Tell HuggingFace Hub this requires the adaptive-classifier library
553554
}
554555

555556
# Save examples in a separate file to keep config clean
@@ -924,7 +925,13 @@ def _generate_model_card(self) -> str:
924925
925926
This model is an instance of an [adaptive-classifier](https://github.com/codelion/adaptive-classifier) that allows for continuous learning and dynamic class addition.
926927
927-
You can install it with `pip install adaptive-classifier`.
928+
## Installation
929+
930+
**IMPORTANT:** To use this model, you must first install the `adaptive-classifier` library. You do **NOT** need `trust_remote_code=True`.
931+
932+
```bash
933+
pip install adaptive-classifier
934+
```
928935
929936
## Model Details
930937
@@ -941,23 +948,27 @@ def _generate_model_card(self) -> str:
941948
942949
## Usage
943950
951+
After installing the `adaptive-classifier` library, you can load and use this model:
952+
944953
```python
945954
from adaptive_classifier import AdaptiveClassifier
946955
947-
# Load the model
956+
# Load the model (no trust_remote_code needed!)
948957
classifier = AdaptiveClassifier.from_pretrained("adaptive-classifier/model-name")
949958
950959
# Make predictions
951960
text = "Your text here"
952961
predictions = classifier.predict(text)
953962
print(predictions) # List of (label, confidence) tuples
954963
955-
# Add new examples
964+
# Add new examples for continuous learning
956965
texts = ["Example 1", "Example 2"]
957966
labels = ["class1", "class2"]
958967
classifier.add_examples(texts, labels)
959968
```
960969
970+
**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.
971+
961972
## Training Details
962973
963974
- Training Steps: {self.train_steps}

0 commit comments

Comments
 (0)