Archived
driver: reference media ride both phases of a latent-upscaled request; keyframes stay refused by name
Refs carry their own latent grids, so conditioning is grid-independent and survives the draft->refine canvas switch; only the pack's video-target segment resizes. shape_job now lays the pack out twice on a wide+refs job (draft geometry -> seg_s/mod_seg_s/step_rows_s/lat_v_s + pos_small) and stage_geom/build_step stage the draft tables while small_now holds. The arch re-derives the pack from the staged geom, so the plugin needs no change. Keyframes + upscale now refuse with a message that names the keyframe and latent_upscale and points at sending the frame as a reference image instead. Host: 2 new video_gen tests (per-phase seg_cu/geom/lat/pos staging, the by-name refusal). Device (dual R9700 TP2, dasiwa-fp8): 2x at 704x704 completes in 133s vs 212s un-upscaled, same-seed rerun bit-identical in video and audio, refs held identity through both phases; t2va+upscale control clean; fl2va+upscale refused by name.
This commit is contained in:
1 parent
c8e635f4b1
commit
7935897260
7 files changed
+279
-45
No files matched your search
+99
-22
@@ -640,9 +640,19 @@ int VideoDriver::shape_job(Job& j, const VideoRequest& r, int32_t chunks, int32_
|
|||||||
"this server cannot run");
|
"this server cannot run");
|
||||||
j.dec_rows = nd;
|
j.dec_rows = nd;
|
||||||
if (d.ref_rows && !j.ref_tab.empty()) {
|
if (d.ref_rows && !j.ref_tab.empty()) {
|
||||||
if (r.upscale > 1.0)
|
/* References combine with latent upscale: their rows carry the references' OWN grids and
|
||||||
return no("reference conditioning does not yet combine with latent upscale; ask for "
|
* never depend on the target canvas, so the draft and full phases condition identically --
|
||||||
"the size you want without latent_upscale");
|
* only the pack's video target segment changes size, laid out twice below. Endpoint
|
||||||
|
* keyframes do not survive two canvases: a pin is the keyframe latent sitting AT the output
|
||||||
|
* frame's row on the target grid itself, and a draft grid plus a full grid leaves it with
|
||||||
|
* no single frame to pin -- every repair would alter the run towards the pinned frame.
|
||||||
|
* A keyframe request never carries references, so a table with any key word is refused by
|
||||||
|
* name, pointing at the reference route for those who want the upscale anyway. */
|
||||||
|
if (r.upscale > 1.0 && j.ref_tab[1] > 0)
|
||||||
|
return no("a keyframe pins an exact output frame on the exact target grid, and latent "
|
||||||
|
"upscale denoises a smaller draft grid first -- the pin would sit between "
|
||||||
|
"two grids and the video could drift off your frame; run the keyframe "
|
||||||
|
"request without latent_upscale, or send the frame as a reference image");
|
||||||
if (!pack_)
|
if (!pack_)
|
||||||
return no("the generator says it conditions on references but exports no "
|
return no("the generator says it conditions on references but exports no "
|
||||||
"rad_arch_video_pack");
|
"rad_arch_video_pack");
|
||||||
@@ -701,6 +711,56 @@ int VideoDriver::shape_job(Job& j, const VideoRequest& r, int32_t chunks, int32_
|
|||||||
j.lat_v = pr - j.seg[(size_t)(nseg - 2)];
|
j.lat_v = pr - j.seg[(size_t)(nseg - 2)];
|
||||||
j.lat_a = decl_.audio_channels * (int64_t)j.geom.n_audio;
|
j.lat_a = decl_.audio_channels * (int64_t)j.geom.n_audio;
|
||||||
j.ref_wide = true;
|
j.ref_wide = true;
|
||||||
|
/* An upscale's draft steps run at the small grid: pack the SAME references again over it.
|
||||||
|
* The reference and audio segments are grid-independent, so their rows and boundaries are
|
||||||
|
* identical; the video target shrinks and every boundary at or after it shifts with it.
|
||||||
|
* The modulation groups count the same (a cell is fixed by segment kind, not size), so
|
||||||
|
* the `max_ref_segs` check above covers both phases. The small grid's own legality was
|
||||||
|
* already refused below at the upscale's validation if the factor cannot leave a smaller
|
||||||
|
* size; an over-tall pack here is refused the same way the full one is. */
|
||||||
|
if (r.upscale > 1.0) {
|
||||||
|
int32_t sw = 0, sh = 0;
|
||||||
|
video_small_size(d, r.width, r.height, r.upscale, &sw, &sh);
|
||||||
|
const VideoShape ss = video_shape(d, sw, sh, chunks);
|
||||||
|
RadVideoGeom gs = j.geom;
|
||||||
|
gs.lat_h = ss.lat_h;
|
||||||
|
gs.lat_w = ss.lat_w;
|
||||||
|
const int64_t ps = pack_(&gs, j.ref_tab.data(), nullptr, 0, nullptr, 0);
|
||||||
|
if (ps <= 0)
|
||||||
|
return no("the model refused the reference conditioning layout at the draft "
|
||||||
|
"size " + std::to_string(sw) + "x" + std::to_string(sh));
|
||||||
|
if (ps > max_tok_)
|
||||||
|
return no("a conditioned draft step is " + std::to_string(ps) + " rows and a pass "
|
||||||
|
"carries " + std::to_string(max_tok_) + "; ask for a shorter or smaller "
|
||||||
|
"video, or fewer references");
|
||||||
|
std::vector<int32_t> segs((size_t)kSegCap, 0);
|
||||||
|
j.pos_small.assign((size_t)(3 * ps), 0.0f);
|
||||||
|
if (pack_(&gs, j.ref_tab.data(), segs.data(), kSegCap, j.pos_small.data(), 3 * ps) != ps)
|
||||||
|
return no("the model could not lay the reference conditioning out at the draft size");
|
||||||
|
int nseg_s = -1;
|
||||||
|
for (int k = 0; k < kSegCap; ++k)
|
||||||
|
if (segs[(size_t)k] == (int32_t)ps) { nseg_s = k + 1; break; }
|
||||||
|
if (nseg_s < 1)
|
||||||
|
return no("the draft-size reference conditioning layout has no closing segment "
|
||||||
|
"boundary");
|
||||||
|
j.seg_s.assign(segs.begin(), segs.begin() + nseg_s);
|
||||||
|
j.nseg_s = nseg_s;
|
||||||
|
if (mod_segs_) {
|
||||||
|
j.mod_seg_s.assign((size_t)kSegCap, 0);
|
||||||
|
const int n = (int)mod_segs_(&gs, j.ref_tab.data(), j.mod_seg_s.data(), kSegCap);
|
||||||
|
if (n < 1 || n > kSegCap)
|
||||||
|
return no("the model could not merge the draft-size reference conditioning "
|
||||||
|
"into its modulation groups");
|
||||||
|
j.mod_seg_s.resize((size_t)n);
|
||||||
|
j.nmod_s = n;
|
||||||
|
} else {
|
||||||
|
j.nmod_s = nseg_s; /* nothing merges: the groups are the fine segments */
|
||||||
|
j.mod_seg_s = j.seg_s;
|
||||||
|
}
|
||||||
|
j.step_rows_s = ps;
|
||||||
|
j.lat_v_s = ps - j.seg_s[(size_t)(nseg_s - 2)];
|
||||||
|
j.ref_wide_small = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
j.rows = j.geom.n_text + s.audio_rows + s.video_rows;
|
j.rows = j.geom.n_text + s.audio_rows + s.video_rows;
|
||||||
if (j.rows > max_tok_)
|
if (j.rows > max_tok_)
|
||||||
@@ -765,14 +825,19 @@ int VideoDriver::shape_job(Job& j, const VideoRequest& r, int32_t chunks, int32_
|
|||||||
j.geom_small.lat_h = ss.lat_h;
|
j.geom_small.lat_h = ss.lat_h;
|
||||||
j.geom_small.lat_w = ss.lat_w;
|
j.geom_small.lat_w = ss.lat_w;
|
||||||
j.rows_small = j.geom.n_text + ss.audio_rows + ss.video_rows;
|
j.rows_small = j.geom.n_text + ss.audio_rows + ss.video_rows;
|
||||||
const int64_t ns = positions_(RAD_VPOS_STEP, &j.geom_small, nullptr, 0);
|
/* A reference-conditioned job already laid the draft steps out -- twice -- at the pack
|
||||||
if (ns != j.rows_small)
|
* above (seg_s/mod_seg_s/step_rows_s, positions in pos_small); the plain small layout
|
||||||
return no("the model lays the small size " + std::to_string(sw) + "x" +
|
* below is only what a step WITHOUT references stages. */
|
||||||
std::to_string(sh) + " out in " + std::to_string(ns) + " step rows, which "
|
if (!j.ref_wide) {
|
||||||
"this server cannot run");
|
const int64_t ns = positions_(RAD_VPOS_STEP, &j.geom_small, nullptr, 0);
|
||||||
j.pos_small.assign((size_t)(3 * ns), 0.0f);
|
if (ns != j.rows_small)
|
||||||
if (positions_(RAD_VPOS_STEP, &j.geom_small, j.pos_small.data(), ns) != ns)
|
return no("the model lays the small size " + std::to_string(sw) + "x" +
|
||||||
return no("the model could not lay the small size out");
|
std::to_string(sh) + " out in " + std::to_string(ns) + " step rows, which "
|
||||||
|
"this server cannot run");
|
||||||
|
j.pos_small.assign((size_t)(3 * ns), 0.0f);
|
||||||
|
if (positions_(RAD_VPOS_STEP, &j.geom_small, j.pos_small.data(), ns) != ns)
|
||||||
|
return no("the model could not lay the small size out");
|
||||||
|
}
|
||||||
j.split = evals - refine;
|
j.split = evals - refine;
|
||||||
j.factor = (float)(((double)r.width / sw + (double)r.height / sh) / 2.0);
|
j.factor = (float)(((double)r.width / sw + (double)r.height / sh) / 2.0);
|
||||||
r.ticket->small_width = sw;
|
r.ticket->small_width = sw;
|
||||||
@@ -1041,12 +1106,16 @@ void VideoDriver::stage_geom(const Job& j, const RadVideoGeom& g0, int64_t rows,
|
|||||||
g[RAD_VGEOM_FIRST_CU + 2] = ppf * g0.lat_frames;
|
g[RAD_VGEOM_FIRST_CU + 2] = ppf * g0.lat_frames;
|
||||||
reg_[R_GEOM].used = RAD_VGEOM_N * 4;
|
reg_[R_GEOM].used = RAD_VGEOM_N * 4;
|
||||||
const bool wide = j.ref_wide && ref_step;
|
const bool wide = j.ref_wide && ref_step;
|
||||||
|
/* On a widened step, which phase's pack is staged: the draft phase (an upscale that has not
|
||||||
|
* run yet) laid the references over the small grid; every later wide step uses the full one. */
|
||||||
|
const bool wsmall = wide && small_now(j);
|
||||||
const int64_t audio_rows =
|
const int64_t audio_rows =
|
||||||
(decl_.audio_streams > 0 ? decl_.audio_streams : decl_.audio_channels) * (int64_t)g0.n_audio;
|
(decl_.audio_streams > 0 ? decl_.audio_streams : decl_.audio_channels) * (int64_t)g0.n_audio;
|
||||||
/* With references riding, the sampler owns only the target video rows -- not the reference
|
/* With references riding, the sampler owns only the target video rows -- not the reference
|
||||||
* rows the pack placed ahead of them -- so the target count is the pack's, not the plain
|
* rows the pack placed ahead of them -- so the target count is the pack's, not the plain
|
||||||
* rows-minus-text-minus-audio. The audio target is the whole soundtrack either way. */
|
* rows-minus-text-minus-audio. The audio target is the whole soundtrack either way. */
|
||||||
const int64_t video_rows = wide ? j.lat_v : rows - g0.n_text - audio_rows;
|
const int64_t video_rows =
|
||||||
|
wide ? (wsmall ? j.lat_v_s : j.lat_v) : rows - g0.n_text - audio_rows;
|
||||||
*hptr<int32_t>(R_LANE) = j.lane;
|
*hptr<int32_t>(R_LANE) = j.lane;
|
||||||
*hptr<int32_t>(R_FIRST) = j.step == 0;
|
*hptr<int32_t>(R_FIRST) = j.step == 0;
|
||||||
int32_t* seg = hptr<int32_t>(R_SEG);
|
int32_t* seg = hptr<int32_t>(R_SEG);
|
||||||
@@ -1054,9 +1123,12 @@ void VideoDriver::stage_geom(const Job& j, const RadVideoGeom& g0, int64_t rows,
|
|||||||
/* The pack laid the reference rows out ahead of the target streams, video grid last. Stage
|
/* The pack laid the reference rows out ahead of the target streams, video grid last. Stage
|
||||||
* its boundaries verbatim: the VSA derives its segment count from the operand length, so
|
* its boundaries verbatim: the VSA derives its segment count from the operand length, so
|
||||||
* every reference becomes a dense prefix sink with no kernel change. Only the step pass
|
* every reference becomes a dense prefix sink with no kernel change. Only the step pass
|
||||||
* stages this table; the decode, encode and upscale passes stage the plain layout below. */
|
* stages this table; the decode, encode and upscale passes stage the plain layout below.
|
||||||
std::memcpy(seg, j.seg.data(), j.seg.size() * sizeof(int32_t));
|
* An upscaling job switches tables at the upscale: the draft phase's steps read the
|
||||||
reg_[R_SEG].used = (int64_t)j.seg.size() * 4;
|
* small-grid pack, the refine steps the full-grid one. */
|
||||||
|
const std::vector<int32_t>& tab = wsmall ? j.seg_s : j.seg;
|
||||||
|
std::memcpy(seg, tab.data(), tab.size() * sizeof(int32_t));
|
||||||
|
reg_[R_SEG].used = (int64_t)tab.size() * 4;
|
||||||
} else {
|
} else {
|
||||||
/* The pack lays the segments out (rad_arch_video_segs, or the reference-aware
|
/* The pack lays the segments out (rad_arch_video_segs, or the reference-aware
|
||||||
* rad_arch_video_pack once refs ride); for a plain request its table is the one computed
|
* rad_arch_video_pack once refs ride); for a plain request its table is the one computed
|
||||||
@@ -1087,9 +1159,10 @@ void VideoDriver::stage_geom(const Job& j, const RadVideoGeom& g0, int64_t rows,
|
|||||||
* is the fine table verbatim -- nothing merges there, so the norm reads the same bytes as the
|
* is the fine table verbatim -- nothing merges there, so the norm reads the same bytes as the
|
||||||
* attention and the generated output is exactly what it was before this operand split. */
|
* attention and the generated output is exactly what it was before this operand split. */
|
||||||
int32_t* mod = hptr<int32_t>(R_MOD);
|
int32_t* mod = hptr<int32_t>(R_MOD);
|
||||||
if (wide && j.nmod > 0) {
|
if (wide && (wsmall ? j.nmod_s : j.nmod) > 0) {
|
||||||
std::memcpy(mod, j.mod_seg.data(), j.mod_seg.size() * sizeof(int32_t));
|
const std::vector<int32_t>& tab = wsmall ? j.mod_seg_s : j.mod_seg;
|
||||||
reg_[R_MOD].used = (int64_t)j.mod_seg.size() * 4;
|
std::memcpy(mod, tab.data(), tab.size() * sizeof(int32_t));
|
||||||
|
reg_[R_MOD].used = (int64_t)tab.size() * 4;
|
||||||
} else {
|
} else {
|
||||||
std::memcpy(mod, seg, reg_[R_SEG].used);
|
std::memcpy(mod, seg, reg_[R_SEG].used);
|
||||||
reg_[R_MOD].used = reg_[R_SEG].used;
|
reg_[R_MOD].used = reg_[R_SEG].used;
|
||||||
@@ -1413,7 +1486,11 @@ const RadBatch* VideoDriver::build_step(Job& j, int step) {
|
|||||||
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
|
for (int g = 0; g < R_N; ++g) reg_[g].used = 0;
|
||||||
const bool small = small_now(j);
|
const bool small = small_now(j);
|
||||||
const RadVideoGeom& g = small ? j.geom_small : j.geom;
|
const RadVideoGeom& g = small ? j.geom_small : j.geom;
|
||||||
const int64_t rows = small ? j.rows_small : j.step_rows; /* widened by references when they ride */
|
/* Each phase runs at ITS pack when references ride: the draft at the small-grid pack, the
|
||||||
|
* refine at the full one; plain requests at the plain rows. `pos_small` is the pack's
|
||||||
|
* positions on a reference-conditioned job and the plain layout's otherwise -- either way
|
||||||
|
* it is the draft phase's. */
|
||||||
|
const int64_t rows = small ? (j.ref_wide_small ? j.step_rows_s : j.rows_small) : j.step_rows;
|
||||||
const std::vector<float>& pos = small ? j.pos_small : j.pos;
|
const std::vector<float>& pos = small ? j.pos_small : j.pos;
|
||||||
stage_sched(j, j.step, small && j.step == j.split - 1);
|
stage_sched(j, j.step, small && j.step == j.split - 1);
|
||||||
std::memcpy(hptr<float>(R_ROPE), pos.data(), pos.size() * 4);
|
std::memcpy(hptr<float>(R_ROPE), pos.data(), pos.size() * 4);
|
||||||
@@ -1424,9 +1501,9 @@ const RadBatch* VideoDriver::build_step(Job& j, int step) {
|
|||||||
cu[0] = 0;
|
cu[0] = 0;
|
||||||
cu[1] = (int32_t)rows;
|
cu[1] = (int32_t)rows;
|
||||||
reg_[R_CU].used = 2 * 4;
|
reg_[R_CU].used = 2 * 4;
|
||||||
/* A reference-conditioned step stages the pack's reference-aware segment table; the plain and
|
/* A reference-conditioned step stages the pack's reference-aware segment table -- the draft
|
||||||
* small (pre-upscale) steps stage the plain four-boundary table. ref_wide never coincides with
|
* phase's own small-grid one while the draft runs, the full grid's after the upscale; plain
|
||||||
* small -- submit refuses upscale together with references. */
|
* steps stage the plain four-boundary table. */
|
||||||
stage_geom(j, g, rows, 0, j.ref_wide);
|
stage_geom(j, g, rows, 0, j.ref_wide);
|
||||||
if (upload() < 0) return nullptr;
|
if (upload() < 0) return nullptr;
|
||||||
base_batches(j, g, rows, step);
|
base_batches(j, g, rows, step);
|
||||||
|
|||||||
@@ -108,6 +108,18 @@ private:
|
|||||||
std::vector<int32_t> mod_seg;
|
std::vector<int32_t> mod_seg;
|
||||||
int32_t nmod = 0;
|
int32_t nmod = 0;
|
||||||
int64_t lat_v = 0, lat_a = 0;
|
int64_t lat_v = 0, lat_a = 0;
|
||||||
|
/* A step that is BOTH reference-conditioned and in an upscale's small (draft) phase needs
|
||||||
|
* the pack laid out AGAIN at the small grid: the video target shrinks, so every boundary
|
||||||
|
* after it shifts. These mirror the fields above for that one phase -- `seg_s`/`mod_seg_s`
|
||||||
|
* its boundary tables, `nseg_s`/`nmod_s` their counts, `step_rows_s` its row total, and
|
||||||
|
* `lat_v_s` the small video target's rows (the audio target is the grid-independent
|
||||||
|
* soundtrack, so it needs no small twin). `pos_small` carries the pack's positions here,
|
||||||
|
* where on the plain path it carries the plain layout's. `ref_wide_small` is false for
|
||||||
|
* every plain job and for every wide step of a job that does not upscale. */
|
||||||
|
bool ref_wide_small = false;
|
||||||
|
int32_t nseg_s = 0, nmod_s = 0;
|
||||||
|
std::vector<int32_t> seg_s, mod_seg_s;
|
||||||
|
int64_t step_rows_s = 0, lat_v_s = 0;
|
||||||
/* The denoising step's row count: the widened total once references ride, otherwise equal
|
/* The denoising step's row count: the widened total once references ride, otherwise equal
|
||||||
* to `rows`. Only build_step uses it -- the encode, decode, audio and upscale passes keep
|
* to `rows`. Only build_step uses it -- the encode, decode, audio and upscale passes keep
|
||||||
* staging against the plain `rows` (their segment table and target counts are their own,
|
* staging against the plain `rows` (their segment table and target counts are their own,
|
||||||
|
|||||||
+5
-1
@@ -2998,7 +2998,11 @@ upscaler, re-noised, and the last **`upscale_refine_steps`** run at the full siz
|
|||||||
and 12 of the base model's 49 by default). The steps at the small size cost a fraction of a
|
and 12 of the base model's 49 by default). The steps at the small size cost a fraction of a
|
||||||
full-size step's, so most of the time goes to the refinement. The video object of an upscaled
|
full-size step's, so most of the time goes to the refinement. The video object of an upscaled
|
||||||
video carries `latent_upscale`, the `upscale_refine_steps` it ran and `upscale_from`, the small
|
video carries `latent_upscale`, the `upscale_refine_steps` it ran and `upscale_from`, the small
|
||||||
size.
|
size. REF2VA takes it too — a reference row carries the *reference's own* latent grid, so the
|
||||||
|
draft and the refine stage condition identically and the pack is simply laid out again at the
|
||||||
|
draft size. The keyframe tasks refuse it (`i2va`/`l2va`/`fl2va`): a pin sits AT the output frame's
|
||||||
|
own row on the exact target grid, and a smaller draft canvas leaves the pin between two grids —
|
||||||
|
run those without `latent_upscale`, or send the frame as a reference image.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -s http://localhost:8000/v1/videos -H 'Content-Type: application/json' -d '{
|
curl -s http://localhost:8000/v1/videos -H 'Content-Type: application/json' -d '{
|
||||||
|
|||||||
+12
-4
@@ -334,10 +334,18 @@ as point 6 / point 4. Nothing here claims to match ComfyUI's timings.
|
|||||||
budget (point 2) and the interleaving mod-group ceiling (point 1) remain the true binding limits
|
budget (point 2) and the interleaving mod-group ceiling (point 1) remain the true binding limits
|
||||||
at high resolution, and now bind for real, since videos reopen the video-conditioned cell.
|
at high resolution, and now bind for real, since videos reopen the video-conditioned cell.
|
||||||
|
|
||||||
5. **References and latent upscaling are mutually exclusive.** Combining the widened reference
|
5. **References combine with latent upscaling; keyframes do not.** The pack is laid out **twice**
|
||||||
layout with the small-size-then-upscale denoise is not unified; a request asking for both is
|
for an upscaled reference job — once over the draft geometry and once over the full one — because
|
||||||
refused at submit (*"reference conditioning does not yet combine with latent upscale"*). Ask for
|
the video target segment changes size between the stages and every boundary at or after it moves
|
||||||
the target size directly.
|
with it (the reference and audio segments are grid-independent, so their rows are identical in
|
||||||
|
both). The driver stages the draft phase's table while `small_now` holds and the full one after
|
||||||
|
the upscale pass; the plugin needs no change — it re-derives the pack from the staged
|
||||||
|
`RadVideoGenBatch::geom`, which already switches per phase. Endpoint keyframes stay refused with
|
||||||
|
`latent_upscale` *on semantics*: a pin is the keyframe latent at the output frame's own row on
|
||||||
|
the exact target grid, two canvases leave it with no single row to sit on, and every repair
|
||||||
|
(re-encode per stage, pin one stage only) alters the trajectory toward the pinned endpoint with
|
||||||
|
no reference workflow to verify against. The refusal names the knob and points at the reference
|
||||||
|
route.
|
||||||
|
|
||||||
6. **Numeric parity with the reference denoiser for the *conditioned* step is not yet published.**
|
6. **Numeric parity with the reference denoiser for the *conditioned* step is not yet published.**
|
||||||
A per-tensor / perceptual match to ComfyUI's outputs for the wide step remains an open parity task
|
A per-tensor / perceptual match to ComfyUI's outputs for the wide step remains an open parity task
|
||||||
|
|||||||
@@ -94,9 +94,12 @@ path on the **server's** filesystem (loopback-only unless `--api-key` is set).
|
|||||||
the latent-upscaler weights (the DaSiWa companion folder; `minimax-h3-dasiwa-*.rad`
|
the latent-upscaler weights (the DaSiWa companion folder; `minimax-h3-dasiwa-*.rad`
|
||||||
has them — the server log names the upscaler at boot) diffuses the early
|
has them — the server log names the upscaler at boot) diffuses the early
|
||||||
steps at size/2 (or /4), enlarges the clean latent, then refines at full
|
steps at size/2 (or /4), enlarges the clean latent, then refines at full
|
||||||
size in the last steps. **`t2va` only** — the server refuses latent upscale
|
size in the last steps. Works with **`t2va` and `ref2va`** — reference rows
|
||||||
combined with references *or keyframes* — and the output still stays within
|
carry their own grids, so they condition the draft and the refine stage
|
||||||
the canvas, so it buys speed and detail, not 1080p.
|
identically — and is **refused with `i2va`/`l2va`/`fl2va` keyframes**: a pin
|
||||||
|
sits AT the exact output frame on the exact target grid, and a draft canvas
|
||||||
|
leaves it nowhere to sit (send the frame as a reference image instead). The
|
||||||
|
output still stays within the canvas, so it buys speed and detail, not 1080p.
|
||||||
|
|
||||||
### Media sockets — purely wire-driven, task-sensitive
|
### Media sockets — purely wire-driven, task-sensitive
|
||||||
|
|
||||||
|
|||||||
@@ -130,9 +130,12 @@ digits but past 2^53 the engine rounds the seed and past
|
|||||||
bigger values are clamped here rather than silently
|
bigger values are clamped here rather than silently
|
||||||
changing the run.
|
changing the run.
|
||||||
latent_upscale (advanced): the container's built-in latent
|
latent_upscale (advanced): the container's built-in latent
|
||||||
upscaler -- early steps at size/2, refine at full size. t2va
|
upscaler -- early steps at size/2, refine at full size.
|
||||||
ONLY (the server refuses it with refs or keyframes); the
|
Works with t2va and ref2va (references carry their own
|
||||||
output still stays within the canvas, so it buys speed and
|
grids); REFUSED with i2va/l2va/fl2va keyframes -- a pin
|
||||||
|
sits at the exact output frame on the exact target grid
|
||||||
|
and a draft canvas leaves it nowhere to sit. The output
|
||||||
|
still stays within the canvas, so it buys speed and
|
||||||
detail, not 1080p. off by default.
|
detail, not 1080p. off by default.
|
||||||
server_url: http://<box>:8133. LAN needs the server on
|
server_url: http://<box>:8133. LAN needs the server on
|
||||||
--host 0.0.0.0; NO auth -- trusted LAN only.
|
--host 0.0.0.0; NO auth -- trusted LAN only.
|
||||||
@@ -414,9 +417,11 @@ class RadianceMiniMax(io.ComfyNode):
|
|||||||
"- **latent_upscale** — advanced, **off** by default: a container converted with "
|
"- **latent_upscale** — advanced, **off** by default: a container converted with "
|
||||||
"the latent-upscaler weights (DaSiWa's companion — the server log names it at "
|
"the latent-upscaler weights (DaSiWa's companion — the server log names it at "
|
||||||
"boot) runs the early steps at size/2 or /4, enlarges the clean latent, and "
|
"boot) runs the early steps at size/2 or /4, enlarges the clean latent, and "
|
||||||
"refines at full size in the last steps. **t2va only** — the server refuses it "
|
"refines at full size in the last steps. Works with **t2va and ref2va** — "
|
||||||
"combined with references or keyframes — and the output stays within the canvas, "
|
"references carry their own grids, so they condition both stages identically — "
|
||||||
"so it buys speed/detail, not 1080p.\n"
|
"and is **refused with i2va/l2va/fl2va keyframes**: a pin sits AT the exact "
|
||||||
|
"output frame on the exact target grid, and a draft canvas leaves it nowhere to "
|
||||||
|
"sit. The output stays within the canvas, so it buys speed/detail, not 1080p.\n"
|
||||||
"- **server_url / model** — which box (`http://<host>:8133`; LAN needs the "
|
"- **server_url / model** — which box (`http://<host>:8133`; LAN needs the "
|
||||||
"server on `--host 0.0.0.0`, no auth — trusted LAN only) and which served "
|
"server on `--host 0.0.0.0`, no auth — trusted LAN only) and which served "
|
||||||
"model id (`GET /v1/models`).\n\n"
|
"model id (`GET /v1/models`).\n\n"
|
||||||
@@ -521,8 +526,9 @@ class RadianceMiniMax(io.ComfyNode):
|
|||||||
"the container's built-in latent upscaler (the DaSiWa companion weights, "
|
"the container's built-in latent upscaler (the DaSiWa companion weights, "
|
||||||
"baked into the .rad at convert time -- the server log names it at boot): "
|
"baked into the .rad at convert time -- the server log names it at boot): "
|
||||||
"the early steps run at size/2 (or /4), the clean latent is enlarged, "
|
"the early steps run at size/2 (or /4), the clean latent is enlarged, "
|
||||||
"re-noised, and the last steps refine at the FULL size. t2va only -- the "
|
"re-noised, and the last steps refine at the FULL size. Works with t2va and "
|
||||||
"server refuses it with references or keyframes. The OUTPUT stays within "
|
"ref2va (references carry their own grids); refused with i2va/l2va/fl2va "
|
||||||
|
"keyframes (a pin needs the exact target grid). The OUTPUT stays within "
|
||||||
"the canvas (the refine steps run full size): this buys speed and detail, "
|
"the canvas (the refine steps run full size): this buys speed and detail, "
|
||||||
"not 1080p -- sizes stay multiples of 32 and under 1344x768 either way"),
|
"not 1080p -- sizes stay multiples of 32 and under 1344x768 either way"),
|
||||||
*images, *videos, *vauds, *adus,
|
*images, *videos, *vauds, *adus,
|
||||||
@@ -640,13 +646,16 @@ class RadianceMiniMax(io.ComfyNode):
|
|||||||
"shift": str(shift), "audio_shift": str(audio_shift),
|
"shift": str(shift), "audio_shift": str(audio_shift),
|
||||||
}
|
}
|
||||||
if str(latent_upscale) not in ("off", "", "1"):
|
if str(latent_upscale) not in ("off", "", "1"):
|
||||||
# the driver refuses upscale together with ANY packed conditioning -- references
|
# the draft/refine split re-lays the reference pack per stage -- refs carry their own
|
||||||
# AND endpoint keyframes ride the same table (video_driver.cpp, "does not yet
|
# grids, so ref2va rides an upscale fine. A KEYFRAME pin sits AT the output frame's row
|
||||||
# combine") -- so say it here instead of eating a round trip
|
# on the exact target grid, and two canvases leave it nowhere to sit -- the driver
|
||||||
if task != "t2va":
|
# refuses those by name (video_driver.cpp), so say it here instead of eating a round trip
|
||||||
raise ValueError(f"latent_upscale {latent_upscale} with task {task}: the server "
|
if task in ("i2va", "l2va", "fl2va"):
|
||||||
"refuses latent upscale combined with references or keyframes "
|
raise ValueError(f"latent_upscale {latent_upscale} with task {task}: a keyframe "
|
||||||
"(text-to-video only for now)")
|
"pins an exact output frame on the exact target grid, and latent "
|
||||||
|
"upscale drafts at a smaller grid first -- run the keyframe "
|
||||||
|
"request without latent_upscale, or send the frame as a "
|
||||||
|
"reference image (ref2va supports the upscale)")
|
||||||
data["latent_upscale"] = str(latent_upscale)
|
data["latent_upscale"] = str(latent_upscale)
|
||||||
# The two dropdown slots become the server's adapter list IN ORDER;
|
# The two dropdown slots become the server's adapter list IN ORDER;
|
||||||
# 'none' is off and either slot may stand alone. A slot holding
|
# 'none' is off and either slot may stand alone. A slot holding
|
||||||
|
|||||||
@@ -1467,6 +1467,127 @@ TEST(a_keyframe_completion_needs_no_vision_tower) {
|
|||||||
CHECK_OK(f.drv.submit(std::move(r), &why)); /* the pin-only path admits without a tower */
|
CHECK_OK(f.drv.submit(std::move(r), &why)); /* the pin-only path admits without a tower */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* References ride an upscale: their rows carry the references' OWN grids, so the conditioning
|
||||||
|
* survives the two canvases -- but the pack must be laid out PER PHASE, because the video target
|
||||||
|
* shrinks in the draft and every boundary at or after it moves with it. The draft steps therefore
|
||||||
|
* run on the small-grid pack (reference block identical, video target the small one, positions the
|
||||||
|
* pack's own), the upscale pass and every non-step pass keep their ref-less layout, and the refine
|
||||||
|
* step returns to the full-grid pack. */
|
||||||
|
TEST(references_reride_the_draft_phase_of_an_upscaled_request) {
|
||||||
|
VideoFixture f;
|
||||||
|
f.build();
|
||||||
|
f.prog.video_gen.upscale_max = 4.0;
|
||||||
|
f.prog.video_gen.upscale_refine = 1;
|
||||||
|
with_tower(f, 16);
|
||||||
|
RadVideoGenDecl& d = f.prog.video_gen;
|
||||||
|
d.encodes = 1;
|
||||||
|
d.enc_ratio = 16;
|
||||||
|
d.max_enc_frames = 1;
|
||||||
|
d.max_enc_side = 16;
|
||||||
|
d.ref_rows = 1;
|
||||||
|
CHECK_OK(f.start_with_pack_encode(fake_pack_ref, fake_encode_geom));
|
||||||
|
std::string why;
|
||||||
|
auto r = f.req(1, 4);
|
||||||
|
r->tokens = { 1, 700, 701, 2, 3 }; /* 5 text tokens */
|
||||||
|
r->width = 64;
|
||||||
|
r->height = 64;
|
||||||
|
r->upscale = 2.0;
|
||||||
|
gen::VideoRefMedia m = ref_part(gen::VideoRefMedia::IMAGE, "ref_image_1", 1);
|
||||||
|
m.enc_frames = 1;
|
||||||
|
m.enc_h = 16;
|
||||||
|
m.enc_w = 16;
|
||||||
|
m.enc_pixels.assign(16 * 16 * 3, 1.0f);
|
||||||
|
r->refs.push_back(m);
|
||||||
|
r->media = picture_media(6, 1);
|
||||||
|
CHECK_OK(f.drv.submit(std::move(r), &why));
|
||||||
|
|
||||||
|
/* Draft: 5 text + 4 reference + 60 audio + 2 small-video = 71 rows, boundaries
|
||||||
|
* [0|5|9|69|71]. Refine: the video target grows to 8 -- 77 rows, [0|5|9|73|77]. */
|
||||||
|
const int64_t n_text = 5, rper = 4, audio = 60, v_small = 2, v_full = 8;
|
||||||
|
const int64_t draft_rows = n_text + rper + audio + v_small;
|
||||||
|
const int64_t full_rows = n_text + rper + audio + v_full;
|
||||||
|
|
||||||
|
std::string kinds;
|
||||||
|
int steps_seen = 0, enc_seen = 0;
|
||||||
|
bool saw_upscale = false;
|
||||||
|
for (int i = 0; i < 20; ++i) {
|
||||||
|
const RadBatch* b = f.drv.next(i);
|
||||||
|
if (!b) break;
|
||||||
|
const RadVideoGenBatch* V = b->vgen_b;
|
||||||
|
REQUIRE(V != nullptr);
|
||||||
|
if (b->gen == RAD_GEN_PASS_VENCODE) { ++enc_seen; kinds += "E"; }
|
||||||
|
else kinds += kind_of(b->gen);
|
||||||
|
if (b->gen == RAD_GEN_PASS_VSTEP) {
|
||||||
|
const bool small = steps_seen < 2;
|
||||||
|
const int64_t rows = small ? draft_rows : full_rows, v = small ? v_small : v_full;
|
||||||
|
CHECK(V->ref_tab != nullptr);
|
||||||
|
CHECK_EQ(b->n_tok, rows); /* the phase's own pack width */
|
||||||
|
CHECK_EQ(V->geom.lat_h, small ? 2 : 4); /* the draft grid, then the full one */
|
||||||
|
CHECK_EQ(V->geom_d[RAD_VGEOM_LAT_H], small ? 2 : 4);
|
||||||
|
CHECK_EQ(V->seg_cu[0], 0);
|
||||||
|
CHECK_EQ(V->seg_cu[1], (int32_t)n_text); /* the reference block is grid-independent */
|
||||||
|
CHECK_EQ(V->seg_cu[2], (int32_t)(n_text + rper));
|
||||||
|
CHECK_EQ(V->seg_cu[3], (int32_t)(n_text + rper + audio));
|
||||||
|
CHECK_EQ(V->seg_cu[4], (int32_t)rows); /* every boundary from the video on shifts */
|
||||||
|
CHECK_EQ(V->mod_cu[4], V->seg_cu[4]); /* no mod_segs export: groups == segments */
|
||||||
|
CHECK_EQ(V->lat_cu[1], (int32_t)v); /* the sampler owns the phase's target */
|
||||||
|
CHECK_EQ(V->lat_cu[3], (int32_t)audio);
|
||||||
|
/* The positions are the PHASE's pack's: channel c's row i is 1000c + i, so its last
|
||||||
|
* written word is 2000 + rows - 1 -- beyond the plain draft layout's 3*rows_small. */
|
||||||
|
CHECK_EQ(V->pos[rows - 1], (float)(rows - 1));
|
||||||
|
CHECK_EQ(V->pos[3 * rows - 1], (float)(2000 + rows - 1));
|
||||||
|
++steps_seen;
|
||||||
|
} else if (b->gen == RAD_GEN_PASS_VUPSCALE) {
|
||||||
|
saw_upscale = true;
|
||||||
|
CHECK_EQ(V->geom.lat_h, 4);
|
||||||
|
CHECK_EQ(V->geom_from.lat_h, 2);
|
||||||
|
CHECK_EQ(V->upscale[0], 2.0f);
|
||||||
|
CHECK_EQ(V->seg_cu[3], (int32_t)(n_text + audio + v_full)); /* the ref-less layout */
|
||||||
|
} else if (b->gen == RAD_GEN_PASS_VCOND) {
|
||||||
|
CHECK_EQ(V->seg_cu[3], (int32_t)(n_text + audio + v_small)); /* ref-less, draft size */
|
||||||
|
}
|
||||||
|
f.answer(10 * i);
|
||||||
|
CHECK_OK(f.drv.done());
|
||||||
|
}
|
||||||
|
CHECK_EQ(steps_seen, 3);
|
||||||
|
CHECK(saw_upscale);
|
||||||
|
CHECK_EQ(enc_seen, 1);
|
||||||
|
CHECK_EQ(kinds, std::string("ECSSUSAD"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyframes and latent upscale stay refused -- on semantics, not plumbing. A pin is the keyframe's
|
||||||
|
* latent AT the output frame's own row on the exact target grid; a draft grid and a full grid in one
|
||||||
|
* job leave it with no single row to sit on, and every repair would move the video away from the
|
||||||
|
* frame the caller asked for. The refusal names the knob and points at the reference route. */
|
||||||
|
TEST(keyframes_and_latent_upscale_are_refused_by_name) {
|
||||||
|
VideoFixture f;
|
||||||
|
f.build();
|
||||||
|
f.prog.video_gen.upscale_max = 4.0;
|
||||||
|
f.prog.video_gen.upscale_refine = 1;
|
||||||
|
RadVideoGenDecl& d = f.prog.video_gen;
|
||||||
|
d.encodes = 1;
|
||||||
|
d.enc_ratio = 16;
|
||||||
|
d.max_enc_frames = 1;
|
||||||
|
d.max_enc_side = 16;
|
||||||
|
d.ref_rows = 1;
|
||||||
|
CHECK_OK(f.start_with_pack_encode(fake_pack_ref, fake_encode_geom));
|
||||||
|
std::string why;
|
||||||
|
auto r = f.req(1, 4);
|
||||||
|
r->tokens = { 1, 2, 3 };
|
||||||
|
r->width = 64;
|
||||||
|
r->height = 64;
|
||||||
|
r->upscale = 2.0;
|
||||||
|
gen::VideoRefMedia first = ref_part(gen::VideoRefMedia::FIRST_FRAME, "first_frame", 1);
|
||||||
|
first.enc_frames = 1;
|
||||||
|
first.enc_h = 16;
|
||||||
|
first.enc_w = 16;
|
||||||
|
first.enc_pixels.assign(16 * 16 * 3, 1.0f);
|
||||||
|
r->refs.push_back(first);
|
||||||
|
CHECK_EQ(f.drv.submit(std::move(r), &why), (int)RAD_E_INVAL);
|
||||||
|
CHECK(has(why, "keyframe"));
|
||||||
|
CHECK(has(why, "latent_upscale"));
|
||||||
|
}
|
||||||
|
|
||||||
/* What the container cannot consume is refused at submit, naming the part or the budget it breaks —
|
/* What the container cannot consume is refused at submit, naming the part or the budget it breaks —
|
||||||
* never silently dropped into a weaker video. A reference video, soundtrack or audio needs the VAE
|
* never silently dropped into a weaker video. A reference video, soundtrack or audio needs the VAE
|
||||||
* encoders; on a container converted without them (encodes 0) they are refused by name here, and on
|
* encoders; on a container converted without them (encodes 0) they are refused by name here, and on
|
||||||
|
|||||||
Reference in new issue
Block a user