redimnet2 / README.md
quazim's picture
docs: use PNG On-Device Apple SDK banner
1e453ae verified
|
Raw
History Blame Contribute Delete
4.66 kB
---
license: apache-2.0
library_name: coreml
tags:
- speaker-verification
- speaker-embedding
- apple-silicon
- on-device
- coreml
- ios
- macos
- thestage-apple-sdk
---
# ReDimNet2 Speaker Embedding (Apple Silicon)
![On-Device Apple SDK](assets/on-device-apple-sdk-banner.png)
[TheStage Apple SDK](https://github.com/TheStageAI/AppleSDK)
**Original model:** [ReDimNet2](https://github.com/PalabraAI/redimnet2) (Palabra AI) · [paper](https://arxiv.org/abs/2603.11841)
On-device **speaker embedding** for enrollment and cosine verification, packaged by **TheStage AI** for Apple Silicon. Produces a **192-d L2-normalized** vector from 16 kHz mono audio.
| | |
| --- | --- |
| Runtime | TheStage Apple SDK (`SpeakerEmbedding`) |
| Embedding dim | **192** (L2-normalized) |
| Window | **2.0 s** (32 000 samples @ 16 kHz) |
| Default device | **CPU** |
| HF engines | `TheStageAI/redimnet2` |
## Overview
---
Used by `TheStageVoiceAgent` for speaker ID (`config.speaker_id = "TheStageAI/redimnet2"`).
## System Requirements
---
| **Property** | **Value** |
| --- | --- |
| **Hardware** | Apple Silicon Mac, or physical iPhone / iPad |
| **macOS** | 15.0+ |
| **iOS** | 18.0+ |
| **Xcode** | 16.0+ |
| **Swift** | 6.0+ |
| **Flutter** (optional) | 3.24+ |
> Simulator is **not** supported — run on real Apple Silicon hardware.
## TheStage AI Access Token
---
Create a token at [app.thestage.ai](https://app.thestage.ai) and pass it to the SDK:
```swift
try await TheStageAI.shared.initialize(apiToken: "th_…")
```
```dart
await TheStageFlutterSDK.initialize(api_token: 'th_…');
```
Token is checked online in `initialize` (once per app process when reachable). Inference runs fully on-device. Offline initialize fails — reconnect and call `initialize` again.
## TheStage Apple SDK
---
Docs: [TheStage Apple SDK · Speaker embedding](https://docs.thestage.ai)
### Installation (SwiftPM)
In Xcode: **File → Add Package Dependencies…**, paste `https://github.com/TheStageAI/AppleSDK.git`, and add the `TheStageSDK` product. Or in `Package.swift`:
```swift
.package(
url: "https://github.com/TheStageAI/AppleSDK.git",
exact: Version(1, 1, 0)
)
```
### Installation (Flutter / iOS)
```yaml
# pubspec.yaml
dependencies:
thestage_apple_sdk:
git:
url: https://github.com/TheStageAI/AppleSDK.git
path: plugin/thestage_apple_sdk
ref: 1.1.0
```
### Swift
```swift
import TheStageSDK
try await TheStageAI.shared.initialize(apiToken: "th_…")
let sid = try await SpeakerEmbedding(
engines_path: "TheStageAI/redimnet2"
)
// Enroll
let enroll = try sid.infer(audio: pcm_16k_mono)
// enroll.embedding: [Float] length 192
// Or via singleton JSON (same shape as Flutter):
try await TheStageAI.shared.start_model(
model_name: "speaker_id",
engines_path: "TheStageAI/redimnet2",
model_type: "thestage_speaker_embedding"
)
let out = try TheStageAI.shared.infer(
model_name: "speaker_id",
input_json: ["audio": pcm_16k_mono]
)
```
### Flutter (iOS)
```dart
await TheStageFlutterSDK.start_model(
model_name: 'speaker_id',
engines_path: 'TheStageAI/redimnet2',
);
final enrolled = await TheStageFlutterSDK.infer(
model_name: 'speaker_id',
input_json: {'audio': pcm16k},
);
final embedding = (enrolled[0]['embedding'] as List).cast<double>();
final check = await TheStageFlutterSDK.infer(
model_name: 'speaker_id',
input_json: {
'audio': pcm16k,
'embedding': embedding,
},
);
final similarity = check[0]['similarity'] as double;
```
### Audio contract
| | |
| --- | --- |
| Sample rate | **16 kHz** mono Float |
| Window | **2.0 s** — pad/trim trailing |
| Output | 192-d L2-normalized embedding; optional cosine `similarity` when a reference embedding is passed |
## Acknowledgments
---
This work builds on **ReDimNet2** by Palabra AI: [https://github.com/PalabraAI/redimnet2](https://github.com/PalabraAI/redimnet2).
Paper: [https://arxiv.org/abs/2603.11841](https://arxiv.org/abs/2603.11841).
Based on ReDimNet2 (Palabra AI). This Apple Silicon package is produced by TheStage AI; it is not an official Palabra AI release.
## Links
---
* __Original model (GitHub)__: [PalabraAI/redimnet2](https://github.com/PalabraAI/redimnet2)
* __Paper__: [https://arxiv.org/abs/2603.11841](https://arxiv.org/abs/2603.11841)
* __Platform__: [app.thestage.ai](https://app.thestage.ai)
* __TheStage Apple SDK__: [github.com/TheStageAI/AppleSDK](https://github.com/TheStageAI/AppleSDK)
* __Docs__: [docs.thestage.ai](https://docs.thestage.ai)
* __Subscribe for updates__: [TheStageAI X](https://x.com/TheStageAI)
* __Contact email__: contact@thestage.ai