Instructions to use Syigen/rgcm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Syigen/rgcm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Syigen/rgcm")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Syigen/rgcm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload Concept Memory base model
Browse files- README.md +12 -3
- config.json +5 -3
- example.py +57 -0
- model.pt +2 -2
README.md
CHANGED
|
@@ -23,6 +23,7 @@ not a language model pretrained from scratch. Its text encoder is
|
|
| 23 |
- `model.pt`: PyTorch state dictionary and training metadata.
|
| 24 |
- `config.json`: encoder, task, and training run metadata.
|
| 25 |
- `concept_memory/`: the minimal model runtime modules needed for inference.
|
|
|
|
| 26 |
|
| 27 |
## Run a prediction
|
| 28 |
|
|
@@ -32,6 +33,12 @@ Use Python 3.11 or newer. Install the runtime dependencies:
|
|
| 32 |
pip install torch transformers huggingface_hub
|
| 33 |
```
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
Download this model repository. It contains only the small `concept_memory`
|
| 36 |
runtime package needed to load the checkpoint, rather than the full training
|
| 37 |
project. Then construct a question with the criteria you want the model to
|
|
@@ -100,8 +107,10 @@ is not directly compatible with `transformers.AutoModel.from_pretrained`.
|
|
| 100 |
"noul"
|
| 101 |
],
|
| 102 |
"encoder": "sentence-transformers/all-mpnet-base-v2",
|
| 103 |
-
"epochs":
|
| 104 |
-
"batch_size":
|
| 105 |
-
"seed": 42
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
```
|
|
|
|
| 23 |
- `model.pt`: PyTorch state dictionary and training metadata.
|
| 24 |
- `config.json`: encoder, task, and training run metadata.
|
| 25 |
- `concept_memory/`: the minimal model runtime modules needed for inference.
|
| 26 |
+
- `example.py`: a runnable end to end Choice prediction example.
|
| 27 |
|
| 28 |
## Run a prediction
|
| 29 |
|
|
|
|
| 33 |
pip install torch transformers huggingface_hub
|
| 34 |
```
|
| 35 |
|
| 36 |
+
Run the standalone example with:
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
python example.py
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
Download this model repository. It contains only the small `concept_memory`
|
| 43 |
runtime package needed to load the checkpoint, rather than the full training
|
| 44 |
project. Then construct a question with the criteria you want the model to
|
|
|
|
| 107 |
"noul"
|
| 108 |
],
|
| 109 |
"encoder": "sentence-transformers/all-mpnet-base-v2",
|
| 110 |
+
"epochs": 50,
|
| 111 |
+
"batch_size": 32,
|
| 112 |
+
"seed": 42,
|
| 113 |
+
"model_version": "base-20261003-171325Z",
|
| 114 |
+
"generated_at": "2026-10-03T17:13:25Z"
|
| 115 |
}
|
| 116 |
```
|
config.json
CHANGED
|
@@ -10,7 +10,9 @@
|
|
| 10 |
"noul"
|
| 11 |
],
|
| 12 |
"encoder": "sentence-transformers/all-mpnet-base-v2",
|
| 13 |
-
"epochs":
|
| 14 |
-
"batch_size":
|
| 15 |
-
"seed": 42
|
|
|
|
|
|
|
| 16 |
}
|
|
|
|
| 10 |
"noul"
|
| 11 |
],
|
| 12 |
"encoder": "sentence-transformers/all-mpnet-base-v2",
|
| 13 |
+
"epochs": 50,
|
| 14 |
+
"batch_size": 32,
|
| 15 |
+
"seed": 42,
|
| 16 |
+
"model_version": "base-20261003-171325Z",
|
| 17 |
+
"generated_at": "2026-10-03T17:13:25Z"
|
| 18 |
}
|
example.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Download the Hugging Face checkpoint and run one typed Choice prediction."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import sys
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
import torch
|
| 9 |
+
from huggingface_hub import snapshot_download
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
REPO_ID = "Syigen/rgcm"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def main() -> None:
|
| 16 |
+
repo_path = Path(snapshot_download(REPO_ID))
|
| 17 |
+
# The model repo ships this small runtime package beside the checkpoint.
|
| 18 |
+
sys.path.insert(0, str(repo_path))
|
| 19 |
+
|
| 20 |
+
from concept_memory import ConceptMemoryModel
|
| 21 |
+
from concept_memory.types import Question
|
| 22 |
+
|
| 23 |
+
checkpoint = repo_path / "model.pt"
|
| 24 |
+
payload = torch.load(checkpoint, map_location="cpu", weights_only=False)
|
| 25 |
+
|
| 26 |
+
model = ConceptMemoryModel.from_pretrained(
|
| 27 |
+
payload["encoder"],
|
| 28 |
+
decision_size=payload["decision_size"],
|
| 29 |
+
max_length=payload["max_length"],
|
| 30 |
+
)
|
| 31 |
+
model.load_state_dict(payload["model_state_dict"])
|
| 32 |
+
model.eval()
|
| 33 |
+
|
| 34 |
+
question = Question(
|
| 35 |
+
id="intent",
|
| 36 |
+
type="choice",
|
| 37 |
+
instructions="Which team should handle this customer request?",
|
| 38 |
+
criteria=[
|
| 39 |
+
{"id": "billing", "description": "Payment or subscription issues"},
|
| 40 |
+
{"id": "technical", "description": "Bugs or integration problems"},
|
| 41 |
+
{"id": "sales", "description": "Pricing or account questions"},
|
| 42 |
+
],
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
with torch.inference_mode():
|
| 46 |
+
result = model.predict(
|
| 47 |
+
"Stripe integration keeps failing after several attempts.", [question]
|
| 48 |
+
)[0]
|
| 49 |
+
|
| 50 |
+
criteria = question.normalized_criteria()
|
| 51 |
+
predicted = criteria[result.prediction.item()]
|
| 52 |
+
print(f"Prediction: {predicted.id} - {predicted.description}")
|
| 53 |
+
print("Probabilities:", result.probabilities.tolist())
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
if __name__ == "__main__":
|
| 57 |
+
main()
|
model.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58255c1ecc04e59a5e5545788ce320fcce3695db0231e839b81a9a14dcf2911e
|
| 3 |
+
size 441699103
|