Skip to content

Commit fc66f7e

Browse files
committed
Update classifier.py
1 parent 0a656e5 commit fc66f7e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

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)