card: Swift usage via coreai-kit SafetyClassifier
Browse files
README.md
CHANGED
|
@@ -101,6 +101,18 @@ SUFFIX = "[/INST]"
|
|
| 101 |
|
| 102 |
**Not included:** the checkpoint's Pixtral vision tower (`image_size` 1540). Text only.
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
## Converting it yourself
|
| 105 |
|
| 106 |
The conversion venv here is transformers 4.57.6, which cannot load this checkpoint at all — the
|
|
|
|
| 101 |
|
| 102 |
**Not included:** the checkpoint's Pixtral vision tower (`image_size` 1540). Text only.
|
| 103 |
|
| 104 |
+
## Using it from Swift
|
| 105 |
+
|
| 106 |
+
```swift
|
| 107 |
+
let guard = try await SafetyClassifier(model: .shieldstral3B) // .shieldstral3BShort for S=256
|
| 108 |
+
let verdict = try await guard.check(message, policy: .selfHarm)
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
[coreai-kit](https://github.com/john-rocky/coreai-kit)'s `SafetyClassifier` owns the scaffolding,
|
| 112 |
+
the padding and the threshold. `reference.json` in each bundle ships the nine gated cases with
|
| 113 |
+
their fp32 probabilities, so any host — Swift, Python, yours — can check its own prompt
|
| 114 |
+
construction rather than trusting it.
|
| 115 |
+
|
| 116 |
## Converting it yourself
|
| 117 |
|
| 118 |
The conversion venv here is transformers 4.57.6, which cannot load this checkpoint at all — the
|