Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
881ccca
cuda: a process-wide cap on DeviceBuffer and pinned HostBuffer bytes
plotarmordev Oct 16, 2026
b00dd4e
drama: the temporal codebook tower
plotarmordev Oct 16, 2026
c8af505
drama: the speech codec, with codec.pth read without Python
plotarmordev Oct 16, 2026
e192c0f
engine_api: speech requests, speech info and a submit_speech hook
plotarmordev Oct 16, 2026
ab45904
native: Drama 3 (fish_omni) on CUDA
plotarmordev Oct 16, 2026
7553d00
server: POST /v1/audio/speech
plotarmordev Oct 16, 2026
8ba4307
tests: Drama 3 backbone and tower oracles, replays and stage traces
plotarmordev Oct 16, 2026
20249e9
drama: incremental codec decode, bit-identical to the whole decode
plotarmordev Oct 16, 2026
93fcaab
tests: Drama 3 codec oracle, replays and stage trace
plotarmordev Oct 16, 2026
d84284d
engine_api: audio events, so a speech engine can publish PCM while it…
plotarmordev Oct 16, 2026
71c31a9
build: Drama 3 backbone and tower kernels, the drama module, the nati…
plotarmordev Oct 16, 2026
588f1f1
server: stream: true on /v1/audio/speech sends raw PCM chunks as they…
plotarmordev Oct 16, 2026
10796d4
build: the Drama 3 codec kernels and the codec tool steps
plotarmordev Oct 16, 2026
8bc6814
tests: tf-drama-codec-stream-oracle, whole against chunked codec decodes
plotarmordev Oct 16, 2026
40c7c87
core: a direct read the file system refuses goes through the page cache
plotarmordev Oct 16, 2026
23a7fcc
cuda: Module.holds, whether a loaded image defines a device global
plotarmordev Oct 16, 2026
6f85731
drama: the Drama 3 text backbone on CUDA
plotarmordev Oct 16, 2026
fdee05c
Merge upstream main (6ee828c2) into feat/drama3-cuda
plotarmordev Oct 17, 2026
0f81a2b
Merge align/920-merge-main (upstream main 6ee828c2) into feat/drama3-…
plotarmordev Oct 17, 2026
65cd256
engine_api and native/cuda.zig back under 600 lines: speech and visio…
plotarmordev Oct 17, 2026
f5aa7a5
Merge align/920-merge-main into feat/drama3-streaming: speech and vis…
plotarmordev Oct 17, 2026
118086a
core: lane tests ignore the speech audio event
plotarmordev Oct 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
engine_api: speech requests, speech info and a submit_speech hook
An engine may now synthesize speech: SpeechRequest carries a prompt, sampling settings and caller-owned PCM,
Info.speech describes the audio it produces, and Info.text_generation lets a speech-only engine refuse the text
routes. Text submit gains error.Unsupported, which the chat route reports as a request error.
  • Loading branch information
plotarmordev committed Oct 16, 2026
commit e192c0f116d88836fd5178de49c47efe5b5486d5
34 changes: 33 additions & 1 deletion zig/src/core/engine_api.zig
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ pub const Request = struct {
prompt_logprobs: ?u8 = null,
};

/// Mono PCM written before a successful speech request's finished event.
pub const SpeechResult = struct { samples: usize = 0 };

/// The request and all its storage remain caller-owned until finished, including on cancellation.
pub const SpeechRequest = struct {
prompt: []const u32,
pcm: []f32,
result: *SpeechResult,
seed: u64,
max_frames: u32 = 1024,
temperature: f32 = 1,
top_p: f32 = 0.9,
top_k: u32 = 30,
};

pub const SpeechInfo = struct {
sample_rate: u32,
frame_length: u32,
max_frames: u32,
max_prompt_tokens: u32,
};

pub const Reason = enum { stop, length, cancelled, failed };

/// What a finished reply's rounds did, for its runtime fields and /metrics.
Expand Down Expand Up @@ -131,6 +153,9 @@ pub const Sink = struct {
/// What the engine serves, fixed once it has loaded.
pub const Info = struct {
name: []const u8 = "lanes",
/// Speech-only models must not be offered through the text completion routes.
text_generation: bool = true,
speech: ?SpeechInfo = null,
lanes: u32 = 1,
/// Prompt plus reply tokens one request may use (0: no limit).
context_window: u32 = 0,
Expand Down Expand Up @@ -259,7 +284,8 @@ pub const Status = struct {
generation_tokens: u64 = 0,
};

pub const SubmitError = error{ Closed, Busy, InvalidSpans };
pub const SubmitError = error{ Closed, Busy, InvalidSpans, Unsupported };
pub const SpeechSubmitError = error{ Closed, Busy, InvalidRequest, Unsupported };

/// A worked example for the learner: token ids, the answer from `start`; `decide`: its assistant header's last row.
pub const Example = struct { ids: []const u32, start: u32, decide: u32, subject: u32 = 0, value: u32 = 0 }; // subject: the row of its last token; value: the row before its answer's value (0: none)
Expand Down Expand Up @@ -340,6 +366,8 @@ pub const Engine = struct {
score: ?*const fn (ctx: *anyopaque, prompt: []const u32, labels: []const u32, logits: []f64) error{Failed}!f64 = null,
/// Queue `request` for the family's learner; it stays valid until `done`. Null: this engine does not learn.
learn: ?*const fn (ctx: *anyopaque, request: *const LearnRequest, sink: LearnSink) LearnError!void = null,
/// One synthesis; caller storage lives until finished. Null: this engine does not synthesize speech.
submit_speech: ?*const fn (ctx: *anyopaque, id: Id, request: *const SpeechRequest, sink: Sink) SpeechSubmitError!void = null,
};

pub fn info(e: Engine) Info {
Expand All @@ -349,6 +377,10 @@ pub const Engine = struct {
try @import("cache_modes.zig").validate(request.decode_spans);
return e.vtable.submit(e.ctx, id, request, sink);
}
pub fn submitSpeech(e: Engine, id: Id, request: *const SpeechRequest, sink: Sink) SpeechSubmitError!void {
const f = e.vtable.submit_speech orelse return error.Unsupported;
return f(e.ctx, id, request, sink);
}
pub fn cancel(e: Engine, id: Id) void {
e.vtable.cancel(e.ctx, id);
}
Expand Down
1 change: 1 addition & 0 deletions zig/src/server/chat.zig
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ pub fn generate(srv: *Server, cx: *Cx, prepared: Prepared, sink: ?Sink, gone: an
error.Busy => cx.fail(.capacity, "the engine is busy; retry shortly", .{}),
error.Closed => cx.fail(.other, "the scheduler is closed", .{}),
error.InvalidSpans => cx.fail(.request, "the prompt span layout is invalid", .{}),
error.Unsupported => cx.fail(.request, "this model does not support text generation", .{}),
};
release(srv, preparing); // a background request waits only while a foreground one prepares
preparing = false;
Expand Down