MCPcopy Create free account
hub / github.com/RightNow-AI/TIDE / tiny_runtime

Function tiny_runtime

tests/test_runtime.py:15–41  ·  view source on GitHub ↗

Create a TIDERuntime with a tiny model and random routers.

(tmp_path)

Source from the content-addressed store, hash-verified

13
14@pytest.fixture
15def tiny_runtime(tmp_path):
16 """Create a TIDERuntime with a tiny model and random routers."""
17 model = TinyModel(num_layers=8, dim=64, vocab_size=256)
18 hidden_dim = 64
19 bottleneck_dim = 32
20
21 # Create routers at checkpoint layers (3, 7)
22 routers = {
23 3: TokenRouter(hidden_dim, bottleneck_dim),
24 7: TokenRouter(hidden_dim, bottleneck_dim),
25 }
26
27 checkpoint = RouterCheckpoint(
28 routers=routers, hidden_dim=hidden_dim, bottleneck_dim=bottleneck_dim
29 )
30 router_path = str(tmp_path / "router.pt")
31 checkpoint.save(router_path)
32
33 config = TIDEConfig(
34 checkpoint_interval=4,
35 exit_threshold=0.5,
36 min_layers=0,
37 router_bottleneck_dim=bottleneck_dim,
38 )
39
40 runtime = TIDERuntime(model, router_path, config=config, use_cuda_kernels=False)
41 return runtime, model
42
43
44class TestTIDERuntimeOutput:

Callers

nothing calls this directly

Calls 6

saveMethod · 0.95
TinyModelClass · 0.90
TokenRouterClass · 0.90
RouterCheckpointClass · 0.90
TIDEConfigClass · 0.90
TIDERuntimeClass · 0.90

Tested by

no test coverage detected