Quickstart: Run a Model Zoo Model Locally¶
This guide walks you through setting up the DeepGate SDK locally, downloading a Model Zoo model, and exporting the schema JSON that Bitweaver needs to compile and benchmark your model. Once you have the schema, continue to Compile & Benchmark to upload it to Bitweaver and run it on real hardware.
Don't have a Bitweaver account yet? Get in touch.
1. Install the DeepGate SDK¶
Requires Python 3.10+ and PyTorch 2.6+. The package is deepgate on PyPI; the import name is dg.
2. Pick a model from the Zoo¶
The Model Zoo is available in the Bitweaver web app under Model Zoo. Pre-trained models live there with the Model-ID you can pass to dg.from_pretrained.
This guide uses wakeword, a 12-class keyword-spotting model trained on Speech Commands v2 (10 keywords + silence + unknown). The Zoo will be continuously populated with more models. The steps below apply to any of them.
3. Download the model¶
from_pretrained resolves the model ID and downloads model.py, model.pt, and config.json into a cache at ~/.cache/dg/models/wakeword/ (not your current directory). It then instantiates the model and loads the weights. Subsequent calls hit the cache without re-downloading.
4. Export the schema JSON¶
import torch
# Run one forward pass so the model records its input shape (required
# before save_pretrained can write schema.json).
model(torch.zeros(1, 1, 49, 10))
model.save_pretrained("./wakeword")
save_pretrained writes a fresh ./wakeword/ directory in your current working directory (separate from the cache used in step 3) containing four files:
| File | What it is |
|---|---|
model.pt |
Trained weights |
model.py |
Self-contained model architecture |
config.json |
Constructor kwargs |
schema.json |
I/O contract and layer layout, the file Bitweaver needs |
Input shape per model
The forward pass needs the model's expected input shape. For wakeword it's (1, 1, 49, 10) (batch × channels × MFCC frames × MFCC coefficients). Each Zoo model will document its expected input shape on Bitweaver's Model Zoo.
5. Continue to Compile & Benchmark¶
You now have ./wakeword/schema.json. Continue to:
- Compile & Benchmark: upload the schema, pick target boards, and review on-MCU performance.
- End-to-End Tutorial: Build and train your own model with
dgfrom scratch, then deploy through Bitweaver.