Archived
minimaxh3+r4d+driver: the prompt's vision pads are modulated as video, not as text
The reference modulates by a per-token TAG: token_tags_from_embeds_info tags every image embed span (with one flanking token on each side) 0 -- video -- inside the prompt, while audio pads keep tag 1 (parallel PR #236, point 3). Our port modulated the whole prompt span as text, so every reference photo's pad tokens read the text ada projection where the reference reads the video one. The tags arrive in the prompt itself and nothing else carries them, so the denoiser could not know, and the look drifted with the reference count. The driver now writes each image item's token span into a tail of ref_tab -- one count, then {start, length} per run, audio items excluded (the reference tags images only). The tail rides inert through the pack and ref_parts, and is present exactly when the reference table is, so an i2va request keeps its old bytes. ref2va_mod_groups grows a runs argument: it cuts the prompt at the runs' edges and gives the pad pieces the VIDEO cell -- the video projection on the video-schedule block; the prompt's own timestep row never changes, only the projection. Cells stay few however many photos interleave, but groups no longer equal cells: two prompt pieces separated by a pad share one cell non-adjacently. So the merged-group output gains a per-group column map, and the modulated- norm kernels -- libr4d and libref alike -- accept an optional trailing colmap (slot 9 quant, 7 bf16, past every other arch's last operand) that redirects sequence -> table column, relaxing the row-count checks it binds. rad_arch_video_mod_segs exports boundaries then map, the plugin stages both only for a reference request -- the plain path still stages boundaries alone, byte-identical -- and the half-split keeps its single video row by taking the target's column instead of the last one. max_ref_segs now bounds the DISTINCT CELLS, its old meaning was the group count. ABI 28; no struct's shape moved, the layout table is re-stamped. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
c5483e3241
commit
8a6a1180ce
14 files changed
+548
-139
No files matched your search
+17
-12
@@ -1311,17 +1311,20 @@ typedef struct RadVideoGenDecl {
|
||||
* denoiser reads `ref_tab`, so this flag is what makes staging and consumption flip together. */
|
||||
int32_t ref_rows;
|
||||
|
||||
/* The largest MODULATION-GROUP count this generator's modulation table holds -- its denoiser's
|
||||
* `kMaxSegs`. A modulation cell is a pure function of a segment's KIND (its modality and its
|
||||
* timestep-embedding block), so runs of consecutive segments that share a cell collapse into one
|
||||
* group and the table is sized by the GROUP count, not the reference count: nine reference photos
|
||||
* pack into four groups (prompt, all-photos, soundtrack, video). The attention still takes the
|
||||
* FINE per-segment table (which may hold far more segments than this), so this is not a limit on
|
||||
* how many references ride -- only on how many DISTINCT cells the sequence changes through. The
|
||||
* driver refuses a request whose merged group count exceeds it at submit (it lays the pack out and
|
||||
* merges it itself, via `rad_arch_video_mod_segs`, so it knows before dispatch) rather than letting
|
||||
* the arch abort mid-generation. 0 = no reference consumption, so no such limit. Trailing since
|
||||
* ABI 23: an older plugin declares none and keeps the 0 default. */
|
||||
/* The largest number of DISTINCT MODULATION CELLS this generator's modulation table holds --
|
||||
* its denoiser's `kMaxSegs`. A modulation cell is a pure function of a segment's KIND (its
|
||||
* modality and its timestep-embedding block) and, since ABI 28, of a prompt vision-pad run's
|
||||
* tag: runs of consecutive same-cell rows collapse into one GROUP, and groups that share a cell
|
||||
* read it through the column map staged with the group boundaries (`rad_arch_video_mod_segs`),
|
||||
* so the table is sized by the DISTINCT-CELL count -- not the group count and not the reference
|
||||
* count. The attention still takes the FINE per-segment table (which may hold far more segments
|
||||
* than this), so this is not a limit on how many references ride -- only on how many DISTINCT
|
||||
* cells the sequence and its prompt pads change through. The driver refuses a request whose
|
||||
* merged cells exceed it at submit (it lays the pack out and merges it itself, via
|
||||
* `rad_arch_video_mod_segs`, so it knows before dispatch) rather than letting the arch abort
|
||||
* mid-generation. 0 = no reference consumption, so no such limit. Trailing since ABI 23: an
|
||||
* older plugin declares none and keeps the 0 default; its meaning was the merged GROUP count
|
||||
* until ABI 28 made the cells and the groups separate. */
|
||||
int32_t max_ref_segs;
|
||||
|
||||
/* Debug introspection of the encoder outputs (diagnostics only, not part of the serving
|
||||
@@ -1851,7 +1854,9 @@ int64_t rad_arch_encode_geom(int32_t kind, const int64_t* in, int32_t* out, int6
|
||||
* of rad_arch_video_segs. `g` is the target's geometry and `ref_tab` the request's keyframes
|
||||
* and VAE references -- RadVideoGenBatch::ref_tab, its int32 table verbatim -- or null when the
|
||||
* request conditions on no VAE media, which lays out the plain [text | soundtrack | video]
|
||||
* sequence. Returns the packed sequence's total rows -- the rows RAD_VPOS_STEP positions -- or
|
||||
* sequence. Since ABI 28 the table may carry a trailing list of prompt vision-pad tag runs; the
|
||||
* PAD LAYOUT is untouched by them (they ride inside the prompt's rows), so this export reads only
|
||||
* the counts, references and keyframes and answers identically with or without the tail. Returns the packed sequence's total rows -- the rows RAD_VPOS_STEP positions -- or
|
||||
* a negative status for counts the model cannot present or caps too small to write into. With
|
||||
* `seg` non-null it writes the segment boundaries (seg[k] the first row of segment k, of the n
|
||||
* it needs) when `cap_seg` int32s hold them; with `pos` non-null the rotary positions (f32
|
||||
|
||||
Reference in new issue
Block a user