Spaces:
Runtime error
Runtime error
Promote Raven quality stack
Browse files- README.md +17 -5
- app.py +56 -0
- docs/HACKATHON_EVALUATION.md +11 -11
- docs/HANDOFF_FINAL_HACKATHON.md +12 -10
- src/nexus_visual_weaver/catalog.py +53 -15
- src/nexus_visual_weaver/exporter.py +29 -0
- src/nexus_visual_weaver/hf_runtime.py +70 -47
- src/nexus_visual_weaver/model_relay.py +30 -14
- src/nexus_visual_weaver/render.py +20 -10
- tests/test_command_center.py +31 -13
- tests/test_exporter.py +13 -0
- tests/test_hf_runtime.py +19 -4
- tests/test_model_relay.py +20 -16
README.md
CHANGED
|
@@ -10,10 +10,16 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Governed gothic couture visual creation command center
|
| 12 |
models:
|
|
|
|
| 13 |
- black-forest-labs/FLUX.2-klein-4B
|
|
|
|
| 14 |
- nvidia/LocateAnything-3B
|
| 15 |
- openbmb/MiniCPM-V-4.6
|
| 16 |
- nvidia/NVIDIA-Nemotron-Parse-v1.2
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
tags:
|
| 18 |
- gradio
|
| 19 |
- mcp-server
|
|
@@ -24,6 +30,8 @@ tags:
|
|
| 24 |
- best-agent
|
| 25 |
- best-demo
|
| 26 |
- openbmb
|
|
|
|
|
|
|
| 27 |
- codex
|
| 28 |
---
|
| 29 |
|
|
@@ -49,14 +57,17 @@ The interface is built around a command-center surface:
|
|
| 49 |
|
| 50 |
Pinned lanes do not rotate:
|
| 51 |
|
| 52 |
-
- `image_generation`:
|
| 53 |
- `grounding`: NVIDIA LocateAnything-3B grounding anchor
|
| 54 |
- `security`: ST3GG defensive scanner/export gate
|
| 55 |
|
| 56 |
Sponsor/evidence lanes are optional but first-class when secrets are configured:
|
| 57 |
|
|
|
|
| 58 |
- `openbmb/MiniCPM-V-4.6` (1.30B): visual judge for wardrobe, footwear, material drift, lore continuity, and export notes.
|
| 59 |
- `nvidia/NVIDIA-Nemotron-Parse-v1.2` (0.94B): structured evidence/parser lane for NVIDIA/Nemotron claim support.
|
|
|
|
|
|
|
| 60 |
|
| 61 |
Helper lanes may rotate with quota, license, health, and parameter-budget checks:
|
| 62 |
|
|
@@ -67,12 +78,12 @@ Helper lanes may rotate with quota, license, health, and parameter-budget checks
|
|
| 67 |
- HF catalog research
|
| 68 |
- Modal job runner
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
## Current Features
|
| 73 |
|
| 74 |
- Gradio Blocks dashboard with split update regions.
|
| 75 |
-
- Real FLUX.2 Klein
|
| 76 |
- Above-fold ST3GG trust strip with safe-vs-blocked fixture evidence.
|
| 77 |
- Generated artifact ST3GG scan and checkpoint/export state.
|
| 78 |
- Optional MiniCPM-V and Nemotron provider evidence lanes with explicit configured/missing-secret status.
|
|
@@ -89,15 +100,16 @@ Public demo mode excludes private, commercial-uncleared, and research-only helpe
|
|
| 89 |
| Target | Evidence status |
|
| 90 |
| --- | --- |
|
| 91 |
| Gradio Space | App runs as a public Hugging Face Gradio Space with `mcp_server=True`. |
|
| 92 |
-
| <=32B models |
|
| 93 |
| Off Brand | Custom command-center UI, dense inspector, workflow graph, wardrobe/lore drawer, and provider cards. |
|
| 94 |
| Best Agent | Multi-step prompt, generation, scan, judge, checkpoint, export workflow. |
|
| 95 |
| OpenBMB | Claimed only when MiniCPM-V returns success status in an export packet. |
|
| 96 |
| NVIDIA | Claimed only when Nemotron returns success status in an export packet. LocateAnything remains visible but is not the Nemotron claim by itself. |
|
|
|
|
| 97 |
| OpenAI Codex | Development branch and PR include Codex-authored implementation commits. |
|
| 98 |
| Demo / social | Add final links here before submission: `DEMO_VIDEO_URL` and `SOCIAL_POST_URL`. |
|
| 99 |
|
| 100 |
-
Tiny Titan can be claimed only from a successful
|
| 101 |
|
| 102 |
## Local Setup
|
| 103 |
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Governed gothic couture visual creation command center
|
| 12 |
models:
|
| 13 |
+
- black-forest-labs/FLUX.2-klein-9B
|
| 14 |
- black-forest-labs/FLUX.2-klein-4B
|
| 15 |
+
- Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf
|
| 16 |
- nvidia/LocateAnything-3B
|
| 17 |
- openbmb/MiniCPM-V-4.6
|
| 18 |
- nvidia/NVIDIA-Nemotron-Parse-v1.2
|
| 19 |
+
- openbmb/MiniCPM5-1B
|
| 20 |
+
- onnx-community/functiongemma-270m-it-ONNX
|
| 21 |
+
- hexgrad/Kokoro-82M
|
| 22 |
+
- netflix/void-model
|
| 23 |
tags:
|
| 24 |
- gradio
|
| 25 |
- mcp-server
|
|
|
|
| 30 |
- best-agent
|
| 31 |
- best-demo
|
| 32 |
- openbmb
|
| 33 |
+
- nvidia
|
| 34 |
+
- modal
|
| 35 |
- codex
|
| 36 |
---
|
| 37 |
|
|
|
|
| 57 |
|
| 58 |
Pinned lanes do not rotate:
|
| 59 |
|
| 60 |
+
- `image_generation`: Raven Quality Stack with `black-forest-labs/FLUX.2-klein-9B` as the flagship image/edit lane
|
| 61 |
- `grounding`: NVIDIA LocateAnything-3B grounding anchor
|
| 62 |
- `security`: ST3GG defensive scanner/export gate
|
| 63 |
|
| 64 |
Sponsor/evidence lanes are optional but first-class when secrets are configured:
|
| 65 |
|
| 66 |
+
- `Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf` (11.91B): quality/taste/lore critique lane for private or configured judge use.
|
| 67 |
- `openbmb/MiniCPM-V-4.6` (1.30B): visual judge for wardrobe, footwear, material drift, lore continuity, and export notes.
|
| 68 |
- `nvidia/NVIDIA-Nemotron-Parse-v1.2` (0.94B): structured evidence/parser lane for NVIDIA/Nemotron claim support.
|
| 69 |
+
- `hexgrad/Kokoro-82M` (0.082B): optional lore narration lane.
|
| 70 |
+
- `netflix/void-model` (5B CogVideoX-based): Modal/offline video repair sample lane, not a blocking Space runtime default.
|
| 71 |
|
| 72 |
Helper lanes may rotate with quota, license, health, and parameter-budget checks:
|
| 73 |
|
|
|
|
| 78 |
- HF catalog research
|
| 79 |
- Modal job runner
|
| 80 |
|
| 81 |
+
The default preset is **Raven Quality Stack**. `black-forest-labs/FLUX.2-klein-4B` remains available only as a Tiny Titan/public-safe sidecar and fallback if the gated 9B lane is unavailable. OFFELLIA heretic/obliterated-style variants stay private research only and never disable consent, provenance, ST3GG, export, or dataset-partition gates.
|
| 82 |
|
| 83 |
## Current Features
|
| 84 |
|
| 85 |
- Gradio Blocks dashboard with split update regions.
|
| 86 |
+
- Real FLUX.2 Klein 9B-first image generation on Hugging Face ZeroGPU when runtime access is configured, with an honest 4B sidecar fallback.
|
| 87 |
- Above-fold ST3GG trust strip with safe-vs-blocked fixture evidence.
|
| 88 |
- Generated artifact ST3GG scan and checkpoint/export state.
|
| 89 |
- Optional MiniCPM-V and Nemotron provider evidence lanes with explicit configured/missing-secret status.
|
|
|
|
| 100 |
| Target | Evidence status |
|
| 101 |
| --- | --- |
|
| 102 |
| Gradio Space | App runs as a public Hugging Face Gradio Space with `mcp_server=True`. |
|
| 103 |
+
| <=32B models | Raven Quality Stack is 28.50B: FLUX.2 Klein 9B + OFFELLIA Q4 Gemma 12B + LocateAnything 3.83B + MiniCPM-V 1.30B + Nemotron Parse 0.94B + MiniCPM5 1.08B + FunctionGemma 0.27B + Kokoro 0.082B. |
|
| 104 |
| Off Brand | Custom command-center UI, dense inspector, workflow graph, wardrobe/lore drawer, and provider cards. |
|
| 105 |
| Best Agent | Multi-step prompt, generation, scan, judge, checkpoint, export workflow. |
|
| 106 |
| OpenBMB | Claimed only when MiniCPM-V returns success status in an export packet. |
|
| 107 |
| NVIDIA | Claimed only when Nemotron returns success status in an export packet. LocateAnything remains visible but is not the Nemotron claim by itself. |
|
| 108 |
+
| Modal | Sidecar-only until a real Modal job is documented; target lane is `netflix/void-model` video repair. |
|
| 109 |
| OpenAI Codex | Development branch and PR include Codex-authored implementation commits. |
|
| 110 |
| Demo / social | Add final links here before submission: `DEMO_VIDEO_URL` and `SOCIAL_POST_URL`. |
|
| 111 |
|
| 112 |
+
Tiny Titan is not the flagship story. It can be claimed only from a successful sidecar export packet where every active sidecar model is <=4B.
|
| 113 |
|
| 114 |
## Local Setup
|
| 115 |
|
app.py
CHANGED
|
@@ -49,10 +49,32 @@ MODEL_RELAY = WeaverModelRelay()
|
|
| 49 |
|
| 50 |
def _default_operator_state() -> dict[str, Any]:
|
| 51 |
return {
|
|
|
|
| 52 |
"provider_state": "idle",
|
| 53 |
"checkpoint": "pending",
|
| 54 |
"export": "pending",
|
| 55 |
"message": "No operator action yet.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
}
|
| 57 |
|
| 58 |
|
|
@@ -163,6 +185,8 @@ def run_weave(
|
|
| 163 |
if generation.status == "success":
|
| 164 |
provider_state = "generated"
|
| 165 |
operator_state = {
|
|
|
|
|
|
|
| 166 |
"provider_state": provider_state,
|
| 167 |
"checkpoint": "pending_review",
|
| 168 |
"export": generated_scan.get("export_gate", "pending"),
|
|
@@ -172,6 +196,20 @@ def run_weave(
|
|
| 172 |
"generated_scan": generated_scan,
|
| 173 |
"minicpm_judge": minicpm.to_dict(),
|
| 174 |
"nemotron_evidence": nemotron.to_dict(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
}
|
| 176 |
regions = _dashboard_regions(
|
| 177 |
run=run,
|
|
@@ -304,9 +342,27 @@ def scan_reference(
|
|
| 304 |
scan=reference_scan,
|
| 305 |
wardrobe_summary=_wardrobe_summary(run),
|
| 306 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
next_state = {
|
| 308 |
**state,
|
| 309 |
**({"reference_judge": minicpm.to_dict()} if minicpm else {}),
|
|
|
|
| 310 |
"reference_scan": reference_scan,
|
| 311 |
"reference_export_gate": reference_scan.get("export_gate", "pending"),
|
| 312 |
"export": state.get("export", generated_scan.get("export_gate", "pending")),
|
|
|
|
| 49 |
|
| 50 |
def _default_operator_state() -> dict[str, Any]:
|
| 51 |
return {
|
| 52 |
+
"active_preset": "Raven Quality Stack",
|
| 53 |
"provider_state": "idle",
|
| 54 |
"checkpoint": "pending",
|
| 55 |
"export": "pending",
|
| 56 |
"message": "No operator action yet.",
|
| 57 |
+
"modal_video_repair": {
|
| 58 |
+
"status": "deferred",
|
| 59 |
+
"repo_id": "netflix/void-model",
|
| 60 |
+
"provider": "modal",
|
| 61 |
+
"message": "Offline/Modal VOID repair sample is documented but not a blocking runtime default.",
|
| 62 |
+
},
|
| 63 |
+
"offellia_judge": {
|
| 64 |
+
"status": "deferred_local",
|
| 65 |
+
"repo_id": "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 66 |
+
"message": "Quality/taste judge lane is declared in the Raven stack and runs only when local GGUF runtime is configured.",
|
| 67 |
+
},
|
| 68 |
+
"audio_lore_tts": {
|
| 69 |
+
"status": "optional",
|
| 70 |
+
"repo_id": "hexgrad/Kokoro-82M",
|
| 71 |
+
"message": "Lore narration lane is off by default for the public demo.",
|
| 72 |
+
},
|
| 73 |
+
"tiny_titan_sidecar": {
|
| 74 |
+
"status": "available",
|
| 75 |
+
"repo_id": "black-forest-labs/FLUX.2-klein-4B",
|
| 76 |
+
"message": "Public-safe 4B sidecar remains selectable without weakening the quality preset.",
|
| 77 |
+
},
|
| 78 |
}
|
| 79 |
|
| 80 |
|
|
|
|
| 185 |
if generation.status == "success":
|
| 186 |
provider_state = "generated"
|
| 187 |
operator_state = {
|
| 188 |
+
**_default_operator_state(),
|
| 189 |
+
"active_preset": "Raven Quality Stack",
|
| 190 |
"provider_state": provider_state,
|
| 191 |
"checkpoint": "pending_review",
|
| 192 |
"export": generated_scan.get("export_gate", "pending"),
|
|
|
|
| 196 |
"generated_scan": generated_scan,
|
| 197 |
"minicpm_judge": minicpm.to_dict(),
|
| 198 |
"nemotron_evidence": nemotron.to_dict(),
|
| 199 |
+
"locateanything_grounding": {
|
| 200 |
+
"status": run.inspection.status,
|
| 201 |
+
"repo_id": run.inspection.locate_model,
|
| 202 |
+
"targets": [
|
| 203 |
+
{
|
| 204 |
+
"slot_name": target.slot_name,
|
| 205 |
+
"query": target.query,
|
| 206 |
+
"expected_region": target.expected_region,
|
| 207 |
+
"confidence": target.confidence,
|
| 208 |
+
}
|
| 209 |
+
for target in run.inspection.targets[:6]
|
| 210 |
+
],
|
| 211 |
+
"drift_flags": run.inspection.drift_flags,
|
| 212 |
+
},
|
| 213 |
}
|
| 214 |
regions = _dashboard_regions(
|
| 215 |
run=run,
|
|
|
|
| 342 |
scan=reference_scan,
|
| 343 |
wardrobe_summary=_wardrobe_summary(run),
|
| 344 |
)
|
| 345 |
+
locate_plan = {}
|
| 346 |
+
if run is not None:
|
| 347 |
+
locate_plan = {
|
| 348 |
+
"status": run.inspection.status,
|
| 349 |
+
"repo_id": run.inspection.locate_model,
|
| 350 |
+
"source": "reference_scan",
|
| 351 |
+
"targets": [
|
| 352 |
+
{
|
| 353 |
+
"slot_name": target.slot_name,
|
| 354 |
+
"query": target.query,
|
| 355 |
+
"expected_region": target.expected_region,
|
| 356 |
+
"confidence": target.confidence,
|
| 357 |
+
}
|
| 358 |
+
for target in run.inspection.targets[:6]
|
| 359 |
+
],
|
| 360 |
+
"drift_flags": run.inspection.drift_flags,
|
| 361 |
+
}
|
| 362 |
next_state = {
|
| 363 |
**state,
|
| 364 |
**({"reference_judge": minicpm.to_dict()} if minicpm else {}),
|
| 365 |
+
**({"reference_locate_plan": locate_plan, "locateanything_grounding": locate_plan} if locate_plan else {}),
|
| 366 |
"reference_scan": reference_scan,
|
| 367 |
"reference_export_gate": reference_scan.get("export_gate", "pending"),
|
| 368 |
"export": state.get("export", generated_scan.get("export_gate", "pending")),
|
docs/HACKATHON_EVALUATION.md
CHANGED
|
@@ -13,11 +13,11 @@ NEXUS Visual Weaver should open as a working command center, not a landing page.
|
|
| 13 |
## Current Strengths
|
| 14 |
|
| 15 |
- Gradio-compatible app shape with `mcp_server=True`.
|
| 16 |
-
- Pinned model governance is visible: FLUX.2 Klein
|
| 17 |
-
- Real FLUX.2 Klein
|
| 18 |
- Generated artifacts are scanned by ST3GG before checkpoint/export.
|
| 19 |
- Above-fold trust strip makes ST3GG verdict, export gate, fixture evidence, and adult-mode safety boundaries visible immediately.
|
| 20 |
-
- OpenBMB MiniCPM-V 4.6
|
| 21 |
- Adult Mode starts off and is framed as catalog scope, not a safety bypass.
|
| 22 |
- ModelRelay/GMR helper rotation is represented without replacing pinned lanes.
|
| 23 |
- Tests cover catalog scope, workflow planning, ModelRelay behavior, scanner evidence, and dashboard fallback rendering.
|
|
@@ -32,21 +32,21 @@ NEXUS Visual Weaver should open as a working command center, not a landing page.
|
|
| 32 |
|
| 33 |
## Next Implementation Priority
|
| 34 |
|
| 35 |
-
1.
|
| 36 |
-
2.
|
| 37 |
-
3.
|
| 38 |
-
4.
|
| 39 |
-
5.
|
| 40 |
|
| 41 |
## Prize Claim Evidence Rules
|
| 42 |
|
| 43 |
| Prize or badge | Current stance |
|
| 44 |
| --- | --- |
|
| 45 |
-
| Build Small base eligibility | Gradio Space, <
|
| 46 |
| Off Brand | Strong custom command-center UI signal. |
|
| 47 |
| Best Agent | Multi-step governed workflow is implemented through callbacks and export packet. |
|
| 48 |
| OpenBMB | Claim only after MiniCPM-V returns `success` in export evidence. |
|
| 49 |
| NVIDIA | Claim only after Nemotron returns `success` in export evidence. |
|
| 50 |
| OpenAI Codex | GitHub branch/PR provides Codex development trail. |
|
| 51 |
-
| Tiny Titan |
|
| 52 |
-
| Modal | Not claimed unless a real Modal job runs. |
|
|
|
|
| 13 |
## Current Strengths
|
| 14 |
|
| 15 |
- Gradio-compatible app shape with `mcp_server=True`.
|
| 16 |
+
- Pinned model governance is visible: FLUX.2 Klein 9B, LocateAnything-3B, and ST3GG.
|
| 17 |
+
- Real FLUX.2 Klein 9B-first generation is wired for HF Space and falls back to an honest 4B Tiny Titan sidecar when the gated lane is unavailable.
|
| 18 |
- Generated artifacts are scanned by ST3GG before checkpoint/export.
|
| 19 |
- Above-fold trust strip makes ST3GG verdict, export gate, fixture evidence, and adult-mode safety boundaries visible immediately.
|
| 20 |
+
- OpenBMB MiniCPM-V 4.6, NVIDIA Nemotron, OFFELLIA Q4, LocateAnything, Kokoro TTS, and Modal VOID evidence lanes are represented with missing-secret/deferred/failed/success states.
|
| 21 |
- Adult Mode starts off and is framed as catalog scope, not a safety bypass.
|
| 22 |
- ModelRelay/GMR helper rotation is represented without replacing pinned lanes.
|
| 23 |
- Tests cover catalog scope, workflow planning, ModelRelay behavior, scanner evidence, and dashboard fallback rendering.
|
|
|
|
| 32 |
|
| 33 |
## Next Implementation Priority
|
| 34 |
|
| 35 |
+
1. Keep Raven Quality Stack as the submission narrative; use Tiny Titan only as a sidecar export.
|
| 36 |
+
2. Configure OpenBMB and Nemotron Space secrets if sponsor prize claims are desired.
|
| 37 |
+
3. Run one live Space weave and prepare an export packet.
|
| 38 |
+
4. Run/document one Modal sidecar job only if it can complete without risking the main Space.
|
| 39 |
+
5. Capture demo video, create social post, and add final links to README.
|
| 40 |
|
| 41 |
## Prize Claim Evidence Rules
|
| 42 |
|
| 43 |
| Prize or badge | Current stance |
|
| 44 |
| --- | --- |
|
| 45 |
+
| Build Small base eligibility | Gradio Space, each active model <32B, and public app path are ready; demo/social links still required. |
|
| 46 |
| Off Brand | Strong custom command-center UI signal. |
|
| 47 |
| Best Agent | Multi-step governed workflow is implemented through callbacks and export packet. |
|
| 48 |
| OpenBMB | Claim only after MiniCPM-V returns `success` in export evidence. |
|
| 49 |
| NVIDIA | Claim only after Nemotron returns `success` in export evidence. |
|
| 50 |
| OpenAI Codex | GitHub branch/PR provides Codex development trail. |
|
| 51 |
+
| Tiny Titan | Sidecar-only: claim only from an export packet where every active sidecar model is <=4B. |
|
| 52 |
+
| Modal | Not claimed unless a real `netflix/void-model` or equivalent Modal job runs and is documented. |
|
docs/HANDOFF_FINAL_HACKATHON.md
CHANGED
|
@@ -8,19 +8,20 @@
|
|
| 8 |
- Public Space URL: `https://build-small-hackathon-nexus-visual-weaver-a107340.hf.space/`
|
| 9 |
- HF rollback SHA: `410a467c55d11e7308249198bd5fe0b2c190aec6`.
|
| 10 |
- Branch discipline: use only `main` and `codex/specimba/ui-polish-command-center`; no extra recovery branches.
|
| 11 |
-
- Primary goal: finish a countable Build Small submission with
|
| 12 |
|
| 13 |
## Secrets Needed
|
| 14 |
|
| 15 |
Do not paste these into chat, commits, logs, or export packets.
|
| 16 |
|
| 17 |
-
- `HF_TOKEN`:
|
| 18 |
- `MINICPM_BASE_URL`: OpenBMB OpenAI-compatible endpoint base URL.
|
| 19 |
- `MINICPM_API_KEY`: OpenBMB bearer token.
|
| 20 |
- `MINICPM_MODEL`: default `MiniCPM-V-4.6`.
|
| 21 |
- `NEMOTRON_BASE_URL`: OpenAI-compatible Nemotron endpoint if available.
|
| 22 |
- `NEMOTRON_API_KEY` or `NVIDIA_API_KEY`: Nemotron provider token.
|
| 23 |
- `NEMOTRON_MODEL`: default `nvidia/NVIDIA-Nemotron-Parse-v1.2`.
|
|
|
|
| 24 |
|
| 25 |
## Verification Commands
|
| 26 |
|
|
@@ -59,27 +60,28 @@ Current evidence from the SSE API:
|
|
| 59 |
|
| 60 |
## Runtime Flow
|
| 61 |
|
| 62 |
-
1. `run_active_weave` builds the Raven Chronicle run packet.
|
| 63 |
-
2. FLUX.2 Klein
|
| 64 |
3. Generated artifact is scanned by ST3GG.
|
| 65 |
4. MiniCPM-V judge runs when OpenBMB secrets are present.
|
| 66 |
5. Nemotron evidence runs when Nemotron/NVIDIA endpoint secrets are present.
|
| 67 |
-
6.
|
| 68 |
-
7. `
|
|
|
|
| 69 |
|
| 70 |
## Claim Rules
|
| 71 |
|
| 72 |
- OpenBMB prize claim requires `minicpm_judge.status == "success"` in an export packet.
|
| 73 |
- NVIDIA prize claim requires `nemotron_evidence.status == "success"` in an export packet.
|
| 74 |
- LocateAnything supports the grounding story but does not replace Nemotron for the NVIDIA prize.
|
| 75 |
-
- Tiny Titan can be claimed only from a successful
|
| 76 |
-
- FLUX.2 Klein 9B
|
| 77 |
-
- Modal is not claimed unless a real Modal job runs and is documented.
|
| 78 |
|
| 79 |
## Known Risks
|
| 80 |
|
| 81 |
- GitHub CLI may fail behind proxy `127.0.0.1:9`; use local git status and HF verification when blocked.
|
| 82 |
-
- Real FLUX generation depends on Space GPU availability and
|
| 83 |
- OpenBMB and Nemotron endpoints are optional and must show `missing secret` rather than fake success when not configured.
|
| 84 |
- Demo video and social post links must be added before final submission.
|
| 85 |
|
|
|
|
| 8 |
- Public Space URL: `https://build-small-hackathon-nexus-visual-weaver-a107340.hf.space/`
|
| 9 |
- HF rollback SHA: `410a467c55d11e7308249198bd5fe0b2c190aec6`.
|
| 10 |
- Branch discipline: use only `main` and `codex/specimba/ui-polish-command-center`; no extra recovery branches.
|
| 11 |
+
- Primary goal: finish a countable Build Small submission with Raven Quality Stack generation, ST3GG scan, LocateAnything grounding, optional OpenBMB MiniCPM-V judge evidence, optional NVIDIA Nemotron evidence, optional Modal VOID sidecar evidence, checkpointed export packet, README prize mapping, demo video, and social post.
|
| 12 |
|
| 13 |
## Secrets Needed
|
| 14 |
|
| 15 |
Do not paste these into chat, commits, logs, or export packets.
|
| 16 |
|
| 17 |
+
- `HF_TOKEN`: required for gated FLUX.2 Klein 9B access after license acceptance; the app can honestly fall back to the 4B Tiny Titan sidecar if the 9B lane is unavailable.
|
| 18 |
- `MINICPM_BASE_URL`: OpenBMB OpenAI-compatible endpoint base URL.
|
| 19 |
- `MINICPM_API_KEY`: OpenBMB bearer token.
|
| 20 |
- `MINICPM_MODEL`: default `MiniCPM-V-4.6`.
|
| 21 |
- `NEMOTRON_BASE_URL`: OpenAI-compatible Nemotron endpoint if available.
|
| 22 |
- `NEMOTRON_API_KEY` or `NVIDIA_API_KEY`: Nemotron provider token.
|
| 23 |
- `NEMOTRON_MODEL`: default `nvidia/NVIDIA-Nemotron-Parse-v1.2`.
|
| 24 |
+
- `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET`: optional for a documented `netflix/void-model` video repair sidecar job.
|
| 25 |
|
| 26 |
## Verification Commands
|
| 27 |
|
|
|
|
| 60 |
|
| 61 |
## Runtime Flow
|
| 62 |
|
| 63 |
+
1. `run_active_weave` builds the Raven Chronicle run packet from prompt, wardrobe, lore, model stack, and LocateAnything region plan.
|
| 64 |
+
2. FLUX.2 Klein 9B generates the flagship image on Space when HF runtime and gated access are configured; FLUX.2 Klein 4B is an honest sidecar fallback.
|
| 65 |
3. Generated artifact is scanned by ST3GG.
|
| 66 |
4. MiniCPM-V judge runs when OpenBMB secrets are present.
|
| 67 |
5. Nemotron evidence runs when Nemotron/NVIDIA endpoint secrets are present.
|
| 68 |
+
6. Modal VOID repair remains a sidecar evidence lane until a real job is documented.
|
| 69 |
+
7. `approve_checkpoint` requires a generated artifact and ST3GG clear/pass state.
|
| 70 |
+
8. `prepare_export_packet` writes a governed JSON packet to `/data/nexus_visual_weaver/exports` or `outputs/exports`.
|
| 71 |
|
| 72 |
## Claim Rules
|
| 73 |
|
| 74 |
- OpenBMB prize claim requires `minicpm_judge.status == "success"` in an export packet.
|
| 75 |
- NVIDIA prize claim requires `nemotron_evidence.status == "success"` in an export packet.
|
| 76 |
- LocateAnything supports the grounding story but does not replace Nemotron for the NVIDIA prize.
|
| 77 |
+
- Tiny Titan can be claimed only from a successful sidecar export packet because each active sidecar model is <=4B.
|
| 78 |
+
- Raven Quality Stack is the primary story: FLUX.2 Klein 9B, OFFELLIA Q4, LocateAnything, MiniCPM-V, Nemotron, MiniCPM5, FunctionGemma, and Kokoro are individually under 32B.
|
| 79 |
+
- Modal is not claimed unless a real `netflix/void-model` or equivalent Modal job runs and is documented.
|
| 80 |
|
| 81 |
## Known Risks
|
| 82 |
|
| 83 |
- GitHub CLI may fail behind proxy `127.0.0.1:9`; use local git status and HF verification when blocked.
|
| 84 |
+
- Real FLUX generation depends on Space GPU availability and gated 9B access; the 4B sidecar exists to keep the demo useful without mislabeling the flagship lane.
|
| 85 |
- OpenBMB and Nemotron endpoints are optional and must show `missing secret` rather than fake success when not configured.
|
| 86 |
- Demo video and social post links must be added before final submission.
|
| 87 |
|
src/nexus_visual_weaver/catalog.py
CHANGED
|
@@ -7,32 +7,30 @@ from .schema import AdapterRecipe, ModelCandidate
|
|
| 7 |
MODEL_CATALOG: list[ModelCandidate] = [
|
| 8 |
ModelCandidate(
|
| 9 |
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 10 |
-
role="
|
| 11 |
task="image-to-image",
|
| 12 |
params_b=4.0,
|
| 13 |
-
runtime="diffusers /
|
| 14 |
license="apache-2.0",
|
| 15 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-4B",
|
| 16 |
),
|
| 17 |
ModelCandidate(
|
| 18 |
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 19 |
-
role="
|
| 20 |
task="image-to-image",
|
| 21 |
params_b=9.0,
|
| 22 |
-
runtime="diffusers / gated
|
| 23 |
license="other",
|
| 24 |
gated=True,
|
| 25 |
-
public_demo=False,
|
| 26 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-9B",
|
| 27 |
),
|
| 28 |
ModelCandidate(
|
| 29 |
repo_id="Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 30 |
-
role="
|
| 31 |
task="image-text-to-text",
|
| 32 |
params_b=12.0,
|
| 33 |
runtime="llama.cpp GGUF",
|
| 34 |
license="apache-2.0",
|
| 35 |
-
public_demo=False,
|
| 36 |
source_url="https://hf.co/Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 37 |
),
|
| 38 |
ModelCandidate(
|
|
@@ -82,7 +80,7 @@ MODEL_CATALOG: list[ModelCandidate] = [
|
|
| 82 |
),
|
| 83 |
ModelCandidate(
|
| 84 |
repo_id="Brunobkr/OFFELLIA_IQ4_XS_gemma-4-12B-it-heretic",
|
| 85 |
-
role="
|
| 86 |
task="text-generation",
|
| 87 |
params_b=12.0,
|
| 88 |
runtime="llama.cpp GGUF",
|
|
@@ -90,6 +88,34 @@ MODEL_CATALOG: list[ModelCandidate] = [
|
|
| 90 |
adult_only=True,
|
| 91 |
source_url="https://hf.co/Brunobkr/OFFELLIA_IQ4_XS_gemma-4-12B-it-heretic",
|
| 92 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
ModelCandidate(
|
| 94 |
repo_id="Wan-AI/Wan2.2-I2V-A14B-Diffusers",
|
| 95 |
role="video_swap_preset",
|
|
@@ -169,24 +195,30 @@ ADAPTER_CATALOG: list[AdapterRecipe] = [
|
|
| 169 |
),
|
| 170 |
]
|
| 171 |
|
| 172 |
-
|
| 173 |
-
"black-forest-labs/FLUX.2-klein-
|
|
|
|
| 174 |
"nvidia/LocateAnything-3B",
|
| 175 |
"openbmb/MiniCPM-V-4.6",
|
| 176 |
"nvidia/NVIDIA-Nemotron-Parse-v1.2",
|
| 177 |
"openbmb/MiniCPM5-1B",
|
| 178 |
"onnx-community/functiongemma-270m-it-ONNX",
|
|
|
|
| 179 |
]
|
| 180 |
|
| 181 |
-
|
| 182 |
-
"black-forest-labs/FLUX.2-klein-
|
| 183 |
-
"Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 184 |
"nvidia/LocateAnything-3B",
|
| 185 |
"openbmb/MiniCPM-V-4.6",
|
| 186 |
"nvidia/NVIDIA-Nemotron-Parse-v1.2",
|
| 187 |
"openbmb/MiniCPM5-1B",
|
|
|
|
|
|
|
| 188 |
]
|
| 189 |
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list[AdapterRecipe]]:
|
| 192 |
models = [
|
|
@@ -201,8 +233,12 @@ def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list
|
|
| 201 |
def active_stack(adult_mode: bool = False) -> list[ModelCandidate]:
|
| 202 |
allowed, _ = filter_catalog(adult_mode)
|
| 203 |
by_id = {model.repo_id: model for model in allowed}
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
|
| 208 |
def parameter_budget(stack: list[ModelCandidate] | None = None) -> dict[str, float | str]:
|
|
@@ -223,5 +259,7 @@ def catalog_summary(adult_mode: bool = False) -> dict[str, int | float | str]:
|
|
| 223 |
"models_visible": len(models),
|
| 224 |
"adapters_visible": len(adapters),
|
| 225 |
"adult_catalog": "enabled" if adult_mode else "hidden",
|
|
|
|
|
|
|
| 226 |
**budget,
|
| 227 |
}
|
|
|
|
| 7 |
MODEL_CATALOG: list[ModelCandidate] = [
|
| 8 |
ModelCandidate(
|
| 9 |
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 10 |
+
role="tiny_titan_sidecar_image_generator",
|
| 11 |
task="image-to-image",
|
| 12 |
params_b=4.0,
|
| 13 |
+
runtime="diffusers / public fallback",
|
| 14 |
license="apache-2.0",
|
| 15 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-4B",
|
| 16 |
),
|
| 17 |
ModelCandidate(
|
| 18 |
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 19 |
+
role="quality_image_generator",
|
| 20 |
task="image-to-image",
|
| 21 |
params_b=9.0,
|
| 22 |
+
runtime="diffusers / gated quality lane",
|
| 23 |
license="other",
|
| 24 |
gated=True,
|
|
|
|
| 25 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-9B",
|
| 26 |
),
|
| 27 |
ModelCandidate(
|
| 28 |
repo_id="Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 29 |
+
role="quality_multimodal_judge",
|
| 30 |
task="image-text-to-text",
|
| 31 |
params_b=12.0,
|
| 32 |
runtime="llama.cpp GGUF",
|
| 33 |
license="apache-2.0",
|
|
|
|
| 34 |
source_url="https://hf.co/Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 35 |
),
|
| 36 |
ModelCandidate(
|
|
|
|
| 80 |
),
|
| 81 |
ModelCandidate(
|
| 82 |
repo_id="Brunobkr/OFFELLIA_IQ4_XS_gemma-4-12B-it-heretic",
|
| 83 |
+
role="adult_private_research_text_judge",
|
| 84 |
task="text-generation",
|
| 85 |
params_b=12.0,
|
| 86 |
runtime="llama.cpp GGUF",
|
|
|
|
| 88 |
adult_only=True,
|
| 89 |
source_url="https://hf.co/Brunobkr/OFFELLIA_IQ4_XS_gemma-4-12B-it-heretic",
|
| 90 |
),
|
| 91 |
+
ModelCandidate(
|
| 92 |
+
repo_id="hexgrad/Kokoro-82M",
|
| 93 |
+
role="audio_lore_tts",
|
| 94 |
+
task="text-to-speech",
|
| 95 |
+
params_b=0.082,
|
| 96 |
+
runtime="local / provider",
|
| 97 |
+
license="apache-2.0",
|
| 98 |
+
source_url="https://hf.co/hexgrad/Kokoro-82M",
|
| 99 |
+
),
|
| 100 |
+
ModelCandidate(
|
| 101 |
+
repo_id="ResembleAI/chatterbox",
|
| 102 |
+
role="audio_lore_tts_optional",
|
| 103 |
+
task="text-to-speech",
|
| 104 |
+
params_b=0.5,
|
| 105 |
+
runtime="provider / Modal",
|
| 106 |
+
license="mit",
|
| 107 |
+
source_url="https://hf.co/ResembleAI/chatterbox",
|
| 108 |
+
),
|
| 109 |
+
ModelCandidate(
|
| 110 |
+
repo_id="netflix/void-model",
|
| 111 |
+
role="modal_video_repair",
|
| 112 |
+
task="video-to-video",
|
| 113 |
+
params_b=5.0,
|
| 114 |
+
runtime="Modal / 40GB+ VRAM",
|
| 115 |
+
license="apache-2.0",
|
| 116 |
+
public_demo=False,
|
| 117 |
+
source_url="https://hf.co/netflix/void-model",
|
| 118 |
+
),
|
| 119 |
ModelCandidate(
|
| 120 |
repo_id="Wan-AI/Wan2.2-I2V-A14B-Diffusers",
|
| 121 |
role="video_swap_preset",
|
|
|
|
| 195 |
),
|
| 196 |
]
|
| 197 |
|
| 198 |
+
RAVEN_QUALITY_STACK = [
|
| 199 |
+
"black-forest-labs/FLUX.2-klein-9B",
|
| 200 |
+
"Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 201 |
"nvidia/LocateAnything-3B",
|
| 202 |
"openbmb/MiniCPM-V-4.6",
|
| 203 |
"nvidia/NVIDIA-Nemotron-Parse-v1.2",
|
| 204 |
"openbmb/MiniCPM5-1B",
|
| 205 |
"onnx-community/functiongemma-270m-it-ONNX",
|
| 206 |
+
"hexgrad/Kokoro-82M",
|
| 207 |
]
|
| 208 |
|
| 209 |
+
TINY_TITAN_STACK = [
|
| 210 |
+
"black-forest-labs/FLUX.2-klein-4B",
|
|
|
|
| 211 |
"nvidia/LocateAnything-3B",
|
| 212 |
"openbmb/MiniCPM-V-4.6",
|
| 213 |
"nvidia/NVIDIA-Nemotron-Parse-v1.2",
|
| 214 |
"openbmb/MiniCPM5-1B",
|
| 215 |
+
"onnx-community/functiongemma-270m-it-ONNX",
|
| 216 |
+
"hexgrad/Kokoro-82M",
|
| 217 |
]
|
| 218 |
|
| 219 |
+
DEFAULT_ACTIVE_STACK = RAVEN_QUALITY_STACK
|
| 220 |
+
PRIVATE_RESEARCH_STACK = RAVEN_QUALITY_STACK
|
| 221 |
+
|
| 222 |
|
| 223 |
def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list[AdapterRecipe]]:
|
| 224 |
models = [
|
|
|
|
| 233 |
def active_stack(adult_mode: bool = False) -> list[ModelCandidate]:
|
| 234 |
allowed, _ = filter_catalog(adult_mode)
|
| 235 |
by_id = {model.repo_id: model for model in allowed}
|
| 236 |
+
return [by_id[repo_id] for repo_id in RAVEN_QUALITY_STACK if repo_id in by_id]
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
def tiny_titan_stack() -> list[ModelCandidate]:
|
| 240 |
+
by_id = {model.repo_id: model for model in MODEL_CATALOG}
|
| 241 |
+
return [by_id[repo_id] for repo_id in TINY_TITAN_STACK if repo_id in by_id]
|
| 242 |
|
| 243 |
|
| 244 |
def parameter_budget(stack: list[ModelCandidate] | None = None) -> dict[str, float | str]:
|
|
|
|
| 259 |
"models_visible": len(models),
|
| 260 |
"adapters_visible": len(adapters),
|
| 261 |
"adult_catalog": "enabled" if adult_mode else "hidden",
|
| 262 |
+
"active_preset": "Raven Quality Stack",
|
| 263 |
+
"tiny_titan": "sidecar",
|
| 264 |
**budget,
|
| 265 |
}
|
src/nexus_visual_weaver/exporter.py
CHANGED
|
@@ -84,18 +84,42 @@ def write_export_packet(
|
|
| 84 |
artifact = _artifact_name(generation.get("output_path"))
|
| 85 |
if "output_path" in generation:
|
| 86 |
generation["output_path"] = artifact
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
packet = {
|
| 88 |
"schema": "nexus_visual_weaver.export_packet.v1",
|
| 89 |
"run_id": run_id,
|
| 90 |
"created_at_epoch": int(time.time()),
|
|
|
|
| 91 |
"adult_mode": run_adult_mode,
|
| 92 |
"prompt": getattr(getattr(run, "request", None), "prompt", ""),
|
| 93 |
"refined_prompt": getattr(getattr(run, "refined_prompt", None), "refined", ""),
|
| 94 |
"artifact": artifact,
|
| 95 |
"generation": generation,
|
| 96 |
"st3gg_scan": scan,
|
|
|
|
|
|
|
| 97 |
"minicpm_judge": operator_state.get("minicpm_judge") or {},
|
| 98 |
"nemotron_evidence": operator_state.get("nemotron_evidence") or {},
|
|
|
|
|
|
|
|
|
|
| 99 |
"checkpoint": {
|
| 100 |
"status": operator_state.get("checkpoint"),
|
| 101 |
"message": operator_state.get("message"),
|
|
@@ -118,6 +142,11 @@ def write_export_packet(
|
|
| 118 |
"off_brand_custom_ui": True,
|
| 119 |
"openbmb_lane": (operator_state.get("minicpm_judge") or {}).get("status") == "success",
|
| 120 |
"nvidia_nemotron_lane": (operator_state.get("nemotron_evidence") or {}).get("status") == "success",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
"st3gg_export_gate": scan.get("export_gate"),
|
| 122 |
},
|
| 123 |
}
|
|
|
|
| 84 |
artifact = _artifact_name(generation.get("output_path"))
|
| 85 |
if "output_path" in generation:
|
| 86 |
generation["output_path"] = artifact
|
| 87 |
+
modal_job = operator_state.get("modal_video_repair") or {
|
| 88 |
+
"status": "deferred",
|
| 89 |
+
"repo_id": "netflix/void-model",
|
| 90 |
+
"provider": "modal",
|
| 91 |
+
}
|
| 92 |
+
audio_lore = operator_state.get("audio_lore_tts") or {
|
| 93 |
+
"status": "optional",
|
| 94 |
+
"repo_id": "hexgrad/Kokoro-82M",
|
| 95 |
+
}
|
| 96 |
+
offellia = operator_state.get("offellia_judge") or {
|
| 97 |
+
"status": "deferred_local",
|
| 98 |
+
"repo_id": "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 99 |
+
}
|
| 100 |
+
tiny_titan = operator_state.get("tiny_titan_sidecar") or {
|
| 101 |
+
"status": "available",
|
| 102 |
+
"repo_id": "black-forest-labs/FLUX.2-klein-4B",
|
| 103 |
+
}
|
| 104 |
+
locate_grounding = operator_state.get("locateanything_grounding") or {}
|
| 105 |
packet = {
|
| 106 |
"schema": "nexus_visual_weaver.export_packet.v1",
|
| 107 |
"run_id": run_id,
|
| 108 |
"created_at_epoch": int(time.time()),
|
| 109 |
+
"active_preset": operator_state.get("active_preset", "Raven Quality Stack"),
|
| 110 |
"adult_mode": run_adult_mode,
|
| 111 |
"prompt": getattr(getattr(run, "request", None), "prompt", ""),
|
| 112 |
"refined_prompt": getattr(getattr(run, "refined_prompt", None), "refined", ""),
|
| 113 |
"artifact": artifact,
|
| 114 |
"generation": generation,
|
| 115 |
"st3gg_scan": scan,
|
| 116 |
+
"locateanything_grounding": locate_grounding,
|
| 117 |
+
"offellia_judge": offellia,
|
| 118 |
"minicpm_judge": operator_state.get("minicpm_judge") or {},
|
| 119 |
"nemotron_evidence": operator_state.get("nemotron_evidence") or {},
|
| 120 |
+
"modal_video_repair": modal_job,
|
| 121 |
+
"audio_lore_tts": audio_lore,
|
| 122 |
+
"tiny_titan_sidecar": tiny_titan,
|
| 123 |
"checkpoint": {
|
| 124 |
"status": operator_state.get("checkpoint"),
|
| 125 |
"message": operator_state.get("message"),
|
|
|
|
| 142 |
"off_brand_custom_ui": True,
|
| 143 |
"openbmb_lane": (operator_state.get("minicpm_judge") or {}).get("status") == "success",
|
| 144 |
"nvidia_nemotron_lane": (operator_state.get("nemotron_evidence") or {}).get("status") == "success",
|
| 145 |
+
"offellia_quality_lane": offellia.get("status") in {"success", "completed"},
|
| 146 |
+
"modal_void_lane": modal_job.get("status") in {"success", "completed", "documented"},
|
| 147 |
+
"tiny_titan_sidecar": tiny_titan.get("status") in {"success", "available", "sidecar"},
|
| 148 |
+
"raven_quality_stack": True,
|
| 149 |
+
"locateanything_grounding": bool(locate_grounding.get("targets") or locate_grounding.get("repo_id")),
|
| 150 |
"st3gg_export_gate": scan.get("export_gate"),
|
| 151 |
},
|
| 152 |
}
|
src/nexus_visual_weaver/hf_runtime.py
CHANGED
|
@@ -9,8 +9,9 @@ from pathlib import Path
|
|
| 9 |
from typing import Any
|
| 10 |
|
| 11 |
|
| 12 |
-
FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
@dataclass(frozen=True)
|
|
@@ -65,13 +66,23 @@ def _hf_token() -> str | None:
|
|
| 65 |
return os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
| 66 |
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height: int = 1024, steps: int = 4) -> HFGenerationResult:
|
|
|
|
| 69 |
if not hf_runtime_enabled():
|
| 70 |
return HFGenerationResult(
|
| 71 |
status="disabled",
|
| 72 |
provider_state="dry-run",
|
| 73 |
-
repo_id=
|
| 74 |
-
message="Real HF generation disabled outside Space.
|
| 75 |
width=width,
|
| 76 |
height=height,
|
| 77 |
steps=steps,
|
|
@@ -86,7 +97,7 @@ def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height
|
|
| 86 |
return HFGenerationResult(
|
| 87 |
status="missing_runtime",
|
| 88 |
provider_state="blocked",
|
| 89 |
-
repo_id=
|
| 90 |
message=f"FLUX runtime import failed. Install diffusers main + torch. {_short_error(exc)}",
|
| 91 |
width=width,
|
| 92 |
height=height,
|
|
@@ -98,51 +109,63 @@ def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height
|
|
| 98 |
return HFGenerationResult(
|
| 99 |
status="no_cuda",
|
| 100 |
provider_state="blocked",
|
| 101 |
-
repo_id=
|
| 102 |
-
message="CUDA is not available to the Space callback; FLUX.2
|
| 103 |
width=width,
|
| 104 |
height=height,
|
| 105 |
steps=steps,
|
| 106 |
hf_token_present=bool(_hf_token()),
|
| 107 |
)
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from typing import Any
|
| 10 |
|
| 11 |
|
| 12 |
+
FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-9B"
|
| 13 |
+
TINY_TITAN_FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-4B"
|
| 14 |
+
PRIVATE_RESEARCH_FLUX_REPO_ID = FLUX_REPO_ID
|
| 15 |
|
| 16 |
|
| 17 |
@dataclass(frozen=True)
|
|
|
|
| 66 |
return os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
| 67 |
|
| 68 |
|
| 69 |
+
def active_flux_repo_id() -> str:
|
| 70 |
+
configured = os.environ.get("NEXUS_FLUX_REPO_ID")
|
| 71 |
+
if configured:
|
| 72 |
+
return configured
|
| 73 |
+
if os.environ.get("NEXUS_TINY_TITAN_MODE") == "1":
|
| 74 |
+
return TINY_TITAN_FLUX_REPO_ID
|
| 75 |
+
return FLUX_REPO_ID
|
| 76 |
+
|
| 77 |
+
|
| 78 |
def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height: int = 1024, steps: int = 4) -> HFGenerationResult:
|
| 79 |
+
repo_id = active_flux_repo_id()
|
| 80 |
if not hf_runtime_enabled():
|
| 81 |
return HFGenerationResult(
|
| 82 |
status="disabled",
|
| 83 |
provider_state="dry-run",
|
| 84 |
+
repo_id=repo_id,
|
| 85 |
+
message="Real HF generation disabled outside Space. Raven Quality Stack uses FLUX.2 Klein 9B by default; set NEXUS_TINY_TITAN_MODE=1 for the 4B sidecar.",
|
| 86 |
width=width,
|
| 87 |
height=height,
|
| 88 |
steps=steps,
|
|
|
|
| 97 |
return HFGenerationResult(
|
| 98 |
status="missing_runtime",
|
| 99 |
provider_state="blocked",
|
| 100 |
+
repo_id=repo_id,
|
| 101 |
message=f"FLUX runtime import failed. Install diffusers main + torch. {_short_error(exc)}",
|
| 102 |
width=width,
|
| 103 |
height=height,
|
|
|
|
| 109 |
return HFGenerationResult(
|
| 110 |
status="no_cuda",
|
| 111 |
provider_state="blocked",
|
| 112 |
+
repo_id=repo_id,
|
| 113 |
+
message="CUDA is not available to the Space callback; FLUX.2 generation requires GPU execution.",
|
| 114 |
width=width,
|
| 115 |
height=height,
|
| 116 |
steps=steps,
|
| 117 |
hf_token_present=bool(_hf_token()),
|
| 118 |
)
|
| 119 |
|
| 120 |
+
token = _hf_token()
|
| 121 |
+
repo_candidates = [repo_id]
|
| 122 |
+
if repo_id != TINY_TITAN_FLUX_REPO_ID and os.environ.get("NEXUS_DISABLE_TINY_TITAN_FALLBACK") != "1":
|
| 123 |
+
repo_candidates.append(TINY_TITAN_FLUX_REPO_ID)
|
| 124 |
+
errors: list[str] = []
|
| 125 |
+
for candidate in repo_candidates:
|
| 126 |
+
try:
|
| 127 |
+
dtype = torch.bfloat16
|
| 128 |
+
pipe = FluxPipeline.from_pretrained(candidate, torch_dtype=dtype, token=token)
|
| 129 |
+
pipe.enable_model_cpu_offload()
|
| 130 |
+
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 131 |
+
image = pipe(
|
| 132 |
+
prompt=prompt,
|
| 133 |
+
height=height,
|
| 134 |
+
width=width,
|
| 135 |
+
guidance_scale=1.0,
|
| 136 |
+
num_inference_steps=steps,
|
| 137 |
+
generator=generator,
|
| 138 |
+
).images[0]
|
| 139 |
+
output_path = _output_dir() / f"nexus_flux_{int(time.time())}_{seed}.png"
|
| 140 |
+
image.save(output_path)
|
| 141 |
+
fallback = candidate != repo_id
|
| 142 |
+
message = (
|
| 143 |
+
f"{candidate} generated a Tiny Titan sidecar artifact after the 9B lane was unavailable."
|
| 144 |
+
if fallback
|
| 145 |
+
else f"{candidate} generated a real Raven Quality artifact on HF Space."
|
| 146 |
+
)
|
| 147 |
+
return HFGenerationResult(
|
| 148 |
+
status="success",
|
| 149 |
+
provider_state="generated",
|
| 150 |
+
repo_id=candidate,
|
| 151 |
+
output_path=str(output_path),
|
| 152 |
+
message=message,
|
| 153 |
+
latency_seconds=round(time.perf_counter() - started, 2),
|
| 154 |
+
width=width,
|
| 155 |
+
height=height,
|
| 156 |
+
steps=steps,
|
| 157 |
+
hf_token_present=bool(token),
|
| 158 |
+
)
|
| 159 |
+
except Exception as exc: # pragma: no cover - exercised on HF Space with gated/runtime conditions.
|
| 160 |
+
errors.append(f"{candidate}: {_short_error(exc)}")
|
| 161 |
+
return HFGenerationResult(
|
| 162 |
+
status="error",
|
| 163 |
+
provider_state="blocked",
|
| 164 |
+
repo_id=repo_id,
|
| 165 |
+
message=f"FLUX.2 generation failed. Check model license acceptance, HF_TOKEN/Space access, and runtime deps. Attempts: {' | '.join(errors)}",
|
| 166 |
+
latency_seconds=round(time.perf_counter() - started, 2),
|
| 167 |
+
width=width,
|
| 168 |
+
height=height,
|
| 169 |
+
steps=steps,
|
| 170 |
+
hf_token_present=bool(token),
|
| 171 |
+
)
|
src/nexus_visual_weaver/model_relay.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import Any
|
|
| 15 |
|
| 16 |
PINNED_LANES = {"image_generation", "grounding", "security"}
|
| 17 |
ROTATABLE_LANES = {
|
|
|
|
| 18 |
"private_image_research",
|
| 19 |
"prompt_router",
|
| 20 |
"taste_judge",
|
|
@@ -380,7 +381,7 @@ class WeaverModelRelay:
|
|
| 380 |
|
| 381 |
def _decision_reason(self, primary: ModelRecord, strategy: str, public_demo: bool) -> str:
|
| 382 |
if strategy == "license_safe_public":
|
| 383 |
-
return f"{primary.model_id} selected because it is
|
| 384 |
if strategy == "quota_saver":
|
| 385 |
return f"{primary.model_id} selected to preserve provider quota and reuse cheaper metadata paths."
|
| 386 |
if strategy == "latency_first":
|
|
@@ -431,18 +432,32 @@ class WeaverModelRelay:
|
|
| 431 |
def default_model_records() -> list[ModelRecord]:
|
| 432 |
return [
|
| 433 |
ModelRecord(
|
| 434 |
-
model_id="flux2-klein-
|
| 435 |
lane="image_generation",
|
| 436 |
provider="hf",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 438 |
license_gate="apache-2.0",
|
| 439 |
params_b=4.0,
|
| 440 |
-
cost_hint="
|
| 441 |
rpm_limit=8,
|
| 442 |
rpd_limit=60,
|
| 443 |
quality_score=0.92,
|
| 444 |
latency_ms=21000,
|
| 445 |
-
|
| 446 |
),
|
| 447 |
ModelRecord(
|
| 448 |
model_id="flux2-klein-9b-private",
|
|
@@ -451,11 +466,12 @@ def default_model_records() -> list[ModelRecord]:
|
|
| 451 |
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 452 |
license_gate="review_required",
|
| 453 |
params_b=9.0,
|
| 454 |
-
cost_hint="
|
| 455 |
rpm_limit=6,
|
| 456 |
rpd_limit=40,
|
| 457 |
quality_score=0.96,
|
| 458 |
latency_ms=26000,
|
|
|
|
| 459 |
),
|
| 460 |
ModelRecord(
|
| 461 |
model_id="locateanything-3b-anchor",
|
|
@@ -758,13 +774,13 @@ def default_model_records() -> list[ModelRecord]:
|
|
| 758 |
model_id="netflix-void-modal",
|
| 759 |
lane="video_repair",
|
| 760 |
provider="modal",
|
| 761 |
-
repo_id="
|
| 762 |
-
license_gate="
|
| 763 |
-
params_b=
|
| 764 |
-
cost_hint="
|
| 765 |
-
rpm_limit=
|
| 766 |
-
rpd_limit=
|
| 767 |
-
quality_score=0.
|
| 768 |
latency_ms=12000,
|
| 769 |
fallback_chain=("void-q5-offline",),
|
| 770 |
),
|
|
@@ -772,9 +788,9 @@ def default_model_records() -> list[ModelRecord]:
|
|
| 772 |
model_id="void-q5-offline",
|
| 773 |
lane="video_repair",
|
| 774 |
provider="local",
|
| 775 |
-
repo_id="local/
|
| 776 |
license_gate="private_research",
|
| 777 |
-
params_b=
|
| 778 |
cost_hint="offline",
|
| 779 |
rpm_limit=20,
|
| 780 |
rpd_limit=200,
|
|
|
|
| 15 |
|
| 16 |
PINNED_LANES = {"image_generation", "grounding", "security"}
|
| 17 |
ROTATABLE_LANES = {
|
| 18 |
+
"tiny_titan_sidecar",
|
| 19 |
"private_image_research",
|
| 20 |
"prompt_router",
|
| 21 |
"taste_judge",
|
|
|
|
| 381 |
|
| 382 |
def _decision_reason(self, primary: ModelRecord, strategy: str, public_demo: bool) -> str:
|
| 383 |
if strategy == "license_safe_public":
|
| 384 |
+
return f"{primary.model_id} selected because it is license-safe and within helper budget."
|
| 385 |
if strategy == "quota_saver":
|
| 386 |
return f"{primary.model_id} selected to preserve provider quota and reuse cheaper metadata paths."
|
| 387 |
if strategy == "latency_first":
|
|
|
|
| 432 |
def default_model_records() -> list[ModelRecord]:
|
| 433 |
return [
|
| 434 |
ModelRecord(
|
| 435 |
+
model_id="flux2-klein-9b-quality",
|
| 436 |
lane="image_generation",
|
| 437 |
provider="hf",
|
| 438 |
+
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 439 |
+
license_gate="review_required",
|
| 440 |
+
params_b=9.0,
|
| 441 |
+
cost_hint="gated_provider_or_quality_space",
|
| 442 |
+
rpm_limit=6,
|
| 443 |
+
rpd_limit=40,
|
| 444 |
+
quality_score=0.97,
|
| 445 |
+
latency_ms=26000,
|
| 446 |
+
pinned=True,
|
| 447 |
+
),
|
| 448 |
+
ModelRecord(
|
| 449 |
+
model_id="flux2-klein-4b-tiny-sidecar",
|
| 450 |
+
lane="tiny_titan_sidecar",
|
| 451 |
+
provider="hf",
|
| 452 |
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 453 |
license_gate="apache-2.0",
|
| 454 |
params_b=4.0,
|
| 455 |
+
cost_hint="public_fallback_or_tiny_titan_export",
|
| 456 |
rpm_limit=8,
|
| 457 |
rpd_limit=60,
|
| 458 |
quality_score=0.92,
|
| 459 |
latency_ms=21000,
|
| 460 |
+
fallback_chain=("flux2-klein-9b-quality",),
|
| 461 |
),
|
| 462 |
ModelRecord(
|
| 463 |
model_id="flux2-klein-9b-private",
|
|
|
|
| 466 |
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 467 |
license_gate="review_required",
|
| 468 |
params_b=9.0,
|
| 469 |
+
cost_hint="legacy_quality_alias",
|
| 470 |
rpm_limit=6,
|
| 471 |
rpd_limit=40,
|
| 472 |
quality_score=0.96,
|
| 473 |
latency_ms=26000,
|
| 474 |
+
health="excluded",
|
| 475 |
),
|
| 476 |
ModelRecord(
|
| 477 |
model_id="locateanything-3b-anchor",
|
|
|
|
| 774 |
model_id="netflix-void-modal",
|
| 775 |
lane="video_repair",
|
| 776 |
provider="modal",
|
| 777 |
+
repo_id="netflix/void-model",
|
| 778 |
+
license_gate="apache-2.0",
|
| 779 |
+
params_b=5.0,
|
| 780 |
+
cost_hint="modal_credits_40gb_vram",
|
| 781 |
+
rpm_limit=4,
|
| 782 |
+
rpd_limit=30,
|
| 783 |
+
quality_score=0.88,
|
| 784 |
latency_ms=12000,
|
| 785 |
fallback_chain=("void-q5-offline",),
|
| 786 |
),
|
|
|
|
| 788 |
model_id="void-q5-offline",
|
| 789 |
lane="video_repair",
|
| 790 |
provider="local",
|
| 791 |
+
repo_id="local/netflix-void-q5-video-repair",
|
| 792 |
license_gate="private_research",
|
| 793 |
+
params_b=5.0,
|
| 794 |
cost_hint="offline",
|
| 795 |
rpm_limit=20,
|
| 796 |
rpd_limit=200,
|
src/nexus_visual_weaver/render.py
CHANGED
|
@@ -113,12 +113,13 @@ def render_command_header() -> str:
|
|
| 113 |
<div>
|
| 114 |
<small>COMMAND INPUT</small>
|
| 115 |
<strong>Raven Chronicle Active Weave</strong>
|
| 116 |
-
<span>
|
| 117 |
</div>
|
| 118 |
<div class="nw-command-pills">
|
| 119 |
-
{badge("
|
| 120 |
{badge("ST3GG ALWAYS ON", "cyan")}
|
| 121 |
-
{badge("FLUX.2
|
|
|
|
| 122 |
{badge("HUMAN CHECKPOINT", "warn")}
|
| 123 |
</div>
|
| 124 |
</section>
|
|
@@ -181,7 +182,7 @@ def render_topbar(
|
|
| 181 |
<div class="nw-topbar">
|
| 182 |
<div class="nw-brand"><span>NEXUS</span><strong>Visual Weaver</strong></div>
|
| 183 |
<div class="nw-topitem"><small>Project</small><strong>Raven Chronicle</strong><i></i></div>
|
| 184 |
-
<div class="nw-topitem"><small>Active Preset</small><strong>
|
| 185 |
<div class="nw-budget">
|
| 186 |
<div><strong>32B Parameter Budget</strong><small>{active:.2f}B / 32B ({pct}%)</small></div>
|
| 187 |
<div class="nw-meter"><i style="width:{pct}%"></i></div>
|
|
@@ -256,7 +257,7 @@ def render_workflow(run: GenerationRun | None = None, operator_state: dict | Non
|
|
| 256 |
"refine": (275, 52, 185, 160, "Refine", ["Prompt Refiner", "Style Harmonizer", "Negative Purge"], "Qwen2.5-7B", "complete", "violet"),
|
| 257 |
"judge": (540, 52, 185, 160, "Judge", ["Aesthetic Scorer", "ST3GG Policy Filter", f"Score {score:.2f}"], "MiniCPM / Nemotron", "complete", "blue"),
|
| 258 |
"locate": (785, 52, 185, 160, "Locate", ["Reference Locator", "Pose & Composition", "IP-Adapter"], "Refs 3/5", "complete", "cyan"),
|
| 259 |
-
"generate": (275, 280, 235, 210, "Generate", ["Image / Video Generation", "FLUX.2
|
| 260 |
"video": (590, 280, 235, 210, "Video Path", ["Image to Video", "Frame interpolation", run.video.preset if run else "Wan2.2 / LTX swap"], "Duration 5.6s 24fps", "ready", "blue"),
|
| 261 |
"checkpoint": (880, 285, 185, 185, "Human Checkpoint", ["Human review required", "Verify intent, vibe,", "and output before final."], "Review Now", "paused", "amber"),
|
| 262 |
}
|
|
@@ -569,7 +570,7 @@ def _render_relay_panel(relay_status: dict | None = None) -> str:
|
|
| 569 |
<h3>GMR ModelRelay</h3>
|
| 570 |
<ul class="nw-relay">{rows}</ul>
|
| 571 |
<div class="nw-relay-foot">
|
| 572 |
-
{badge("FLUX.2
|
| 573 |
</div>
|
| 574 |
"""
|
| 575 |
|
|
@@ -590,6 +591,7 @@ def render_provider_cards(relay_status: dict | None = None, adult_mode: bool = F
|
|
| 590 |
optional_statuses = {
|
| 591 |
"openbmb": "configured" if _provider_configured("MINICPM_BASE_URL", "MINICPM_API_KEY", "OPENBMB_API_KEY") else "missing secret",
|
| 592 |
"nvidia": "configured" if _provider_configured("NEMOTRON_BASE_URL", "NEMOTRON_API_KEY", "NVIDIA_API_KEY") else "missing secret",
|
|
|
|
| 593 |
"fal": "configured" if _env_configured("FAL_KEY") else "blocked",
|
| 594 |
"netlify": "configured" if _env_configured("NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID", "OPENAI_BASE_URL") else "blocked",
|
| 595 |
"cloudflare": "configured" if _env_configured("CLOUDFLARE_API_TOKEN", "CF_ACCOUNT_ID") else "blocked",
|
|
@@ -626,9 +628,9 @@ def render_provider_cards(relay_status: dict | None = None, adult_mode: bool = F
|
|
| 626 |
<div class="nw-provider-card nw-provider-optional">
|
| 627 |
<small>optional gateway</small>
|
| 628 |
<strong>{escape(provider.title())}</strong>
|
| 629 |
-
<span>off by default / secrets required</span>
|
| 630 |
-
<i class="nw-provider-meter" style="--health:{'74' if state == 'configured' else '18'}"></i>
|
| 631 |
-
<div>{badge(state.upper(), "pass" if state == "configured" else "warn")}{badge("SPONSOR LANE" if provider in {"openbmb", "nvidia", "hf_nvidia"} else "NOT MVP DEFAULT", "muted")}</div>
|
| 632 |
</div>
|
| 633 |
"""
|
| 634 |
)
|
|
@@ -673,7 +675,7 @@ def render_inspector(
|
|
| 673 |
scan_status = (scan or {}).get("status", "pass")
|
| 674 |
else:
|
| 675 |
checks = [(label, True) for label in ["Patent Leather", "Faux Fur", "Lace / Mesh", "Crimson Hardware", "Platform Boots", "Layered Garments"]]
|
| 676 |
-
model_rows = "<li><span>active stack</span><strong>FLUX.2
|
| 677 |
score = 86
|
| 678 |
scan_status = (scan or {}).get("status", "pass")
|
| 679 |
checks_html = "".join(f'<li><span>{"✓" if ok else "!"}</span>{escape(label)}</li>' for label, ok in checks)
|
|
@@ -682,11 +684,19 @@ def render_inspector(
|
|
| 682 |
operator_state = operator_state or {}
|
| 683 |
minicpm = operator_state.get("minicpm_judge") or {}
|
| 684 |
nemotron = operator_state.get("nemotron_evidence") or {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
sponsor_rows = "".join(
|
| 686 |
f"<li><span>{escape(label)}</span><strong>{escape(str(result.get('status', 'pending')).upper())}</strong><em>{escape(str(result.get('repo_id', repo)))}</em></li>"
|
| 687 |
for label, repo, result in [
|
|
|
|
| 688 |
("OpenBMB MiniCPM", "openbmb/MiniCPM-V-4.6", minicpm),
|
| 689 |
("NVIDIA Nemotron", "nvidia/NVIDIA-Nemotron-Parse-v1.2", nemotron),
|
|
|
|
|
|
|
|
|
|
| 690 |
]
|
| 691 |
)
|
| 692 |
findings = [_redact_scan_text(item) for item in (scan.get("findings") or [])]
|
|
|
|
| 113 |
<div>
|
| 114 |
<small>COMMAND INPUT</small>
|
| 115 |
<strong>Raven Chronicle Active Weave</strong>
|
| 116 |
+
<span>Quality stack, reference grounding, model evidence, and checkpoint controls stay in one sticky operator strip.</span>
|
| 117 |
</div>
|
| 118 |
<div class="nw-command-pills">
|
| 119 |
+
{badge("RAVEN QUALITY STACK", "pass")}
|
| 120 |
{badge("ST3GG ALWAYS ON", "cyan")}
|
| 121 |
+
{badge("FLUX.2 9B PINNED", "accent")}
|
| 122 |
+
{badge("4B TINY SIDECAR", "muted")}
|
| 123 |
{badge("HUMAN CHECKPOINT", "warn")}
|
| 124 |
</div>
|
| 125 |
</section>
|
|
|
|
| 182 |
<div class="nw-topbar">
|
| 183 |
<div class="nw-brand"><span>NEXUS</span><strong>Visual Weaver</strong></div>
|
| 184 |
<div class="nw-topitem"><small>Project</small><strong>Raven Chronicle</strong><i></i></div>
|
| 185 |
+
<div class="nw-topitem"><small>Active Preset</small><strong>Raven Quality Stack</strong><i></i></div>
|
| 186 |
<div class="nw-budget">
|
| 187 |
<div><strong>32B Parameter Budget</strong><small>{active:.2f}B / 32B ({pct}%)</small></div>
|
| 188 |
<div class="nw-meter"><i style="width:{pct}%"></i></div>
|
|
|
|
| 257 |
"refine": (275, 52, 185, 160, "Refine", ["Prompt Refiner", "Style Harmonizer", "Negative Purge"], "Qwen2.5-7B", "complete", "violet"),
|
| 258 |
"judge": (540, 52, 185, 160, "Judge", ["Aesthetic Scorer", "ST3GG Policy Filter", f"Score {score:.2f}"], "MiniCPM / Nemotron", "complete", "blue"),
|
| 259 |
"locate": (785, 52, 185, 160, "Locate", ["Reference Locator", "Pose & Composition", "IP-Adapter"], "Refs 3/5", "complete", "cyan"),
|
| 260 |
+
"generate": (275, 280, 235, 210, "Generate", ["Image / Video Generation", "FLUX.2 9B quality lane", "High-detail couture"], "Steps 4 CFG 1.0", "ready", "green"),
|
| 261 |
"video": (590, 280, 235, 210, "Video Path", ["Image to Video", "Frame interpolation", run.video.preset if run else "Wan2.2 / LTX swap"], "Duration 5.6s 24fps", "ready", "blue"),
|
| 262 |
"checkpoint": (880, 285, 185, 185, "Human Checkpoint", ["Human review required", "Verify intent, vibe,", "and output before final."], "Review Now", "paused", "amber"),
|
| 263 |
}
|
|
|
|
| 570 |
<h3>GMR ModelRelay</h3>
|
| 571 |
<ul class="nw-relay">{rows}</ul>
|
| 572 |
<div class="nw-relay-foot">
|
| 573 |
+
{badge("FLUX.2 9B pinned", "pass")} {badge("4B sidecar", "muted")} {badge("LocateAnything pinned", "pass")} {badge(f"dedup hits {dedup_hits}", "muted")}
|
| 574 |
</div>
|
| 575 |
"""
|
| 576 |
|
|
|
|
| 591 |
optional_statuses = {
|
| 592 |
"openbmb": "configured" if _provider_configured("MINICPM_BASE_URL", "MINICPM_API_KEY", "OPENBMB_API_KEY") else "missing secret",
|
| 593 |
"nvidia": "configured" if _provider_configured("NEMOTRON_BASE_URL", "NEMOTRON_API_KEY", "NVIDIA_API_KEY") else "missing secret",
|
| 594 |
+
"modal": "configured" if _env_configured("MODAL_TOKEN_ID", "MODAL_TOKEN_SECRET") else "deferred",
|
| 595 |
"fal": "configured" if _env_configured("FAL_KEY") else "blocked",
|
| 596 |
"netlify": "configured" if _env_configured("NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID", "OPENAI_BASE_URL") else "blocked",
|
| 597 |
"cloudflare": "configured" if _env_configured("CLOUDFLARE_API_TOKEN", "CF_ACCOUNT_ID") else "blocked",
|
|
|
|
| 628 |
<div class="nw-provider-card nw-provider-optional">
|
| 629 |
<small>optional gateway</small>
|
| 630 |
<strong>{escape(provider.title())}</strong>
|
| 631 |
+
<span>{"VOID repair job / Modal credit lane" if provider == "modal" else "off by default / secrets required"}</span>
|
| 632 |
+
<i class="nw-provider-meter" style="--health:{'74' if state == 'configured' else '42' if state == 'deferred' else '18'}"></i>
|
| 633 |
+
<div>{badge(state.upper(), "pass" if state == "configured" else "muted" if state == "deferred" else "warn")}{badge("SPONSOR LANE" if provider in {"openbmb", "nvidia", "hf_nvidia", "modal"} else "NOT MVP DEFAULT", "muted")}</div>
|
| 634 |
</div>
|
| 635 |
"""
|
| 636 |
)
|
|
|
|
| 675 |
scan_status = (scan or {}).get("status", "pass")
|
| 676 |
else:
|
| 677 |
checks = [(label, True) for label in ["Patent Leather", "Faux Fur", "Lace / Mesh", "Crimson Hardware", "Platform Boots", "Layered Garments"]]
|
| 678 |
+
model_rows = "<li><span>active stack</span><strong>FLUX.2 9B / OFFELLIA / LocateAnything</strong></li>"
|
| 679 |
score = 86
|
| 680 |
scan_status = (scan or {}).get("status", "pass")
|
| 681 |
checks_html = "".join(f'<li><span>{"✓" if ok else "!"}</span>{escape(label)}</li>' for label, ok in checks)
|
|
|
|
| 684 |
operator_state = operator_state or {}
|
| 685 |
minicpm = operator_state.get("minicpm_judge") or {}
|
| 686 |
nemotron = operator_state.get("nemotron_evidence") or {}
|
| 687 |
+
offellia = operator_state.get("offellia_judge") or {}
|
| 688 |
+
modal = operator_state.get("modal_video_repair") or {}
|
| 689 |
+
tts = operator_state.get("audio_lore_tts") or {}
|
| 690 |
+
locate = operator_state.get("locateanything_grounding") or {}
|
| 691 |
sponsor_rows = "".join(
|
| 692 |
f"<li><span>{escape(label)}</span><strong>{escape(str(result.get('status', 'pending')).upper())}</strong><em>{escape(str(result.get('repo_id', repo)))}</em></li>"
|
| 693 |
for label, repo, result in [
|
| 694 |
+
("OFFELLIA Quality Judge", "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf", offellia),
|
| 695 |
("OpenBMB MiniCPM", "openbmb/MiniCPM-V-4.6", minicpm),
|
| 696 |
("NVIDIA Nemotron", "nvidia/NVIDIA-Nemotron-Parse-v1.2", nemotron),
|
| 697 |
+
("LocateAnything Grounding", "nvidia/LocateAnything-3B", locate),
|
| 698 |
+
("Modal VOID Repair", "netflix/void-model", modal),
|
| 699 |
+
("Audio Lore TTS", "hexgrad/Kokoro-82M", tts),
|
| 700 |
]
|
| 701 |
)
|
| 702 |
findings = [_redact_scan_text(item) for item in (scan.get("findings") or [])]
|
tests/test_command_center.py
CHANGED
|
@@ -3,10 +3,13 @@ from pathlib import Path
|
|
| 3 |
from nexus_visual_weaver.catalog import (
|
| 4 |
DEFAULT_ACTIVE_STACK,
|
| 5 |
PRIVATE_RESEARCH_STACK,
|
|
|
|
|
|
|
| 6 |
active_stack,
|
| 7 |
catalog_summary,
|
| 8 |
filter_catalog,
|
| 9 |
parameter_budget,
|
|
|
|
| 10 |
)
|
| 11 |
from nexus_visual_weaver.grounding import inspect_outfit
|
| 12 |
from nexus_visual_weaver.model_relay import WeaverModelRelay
|
|
@@ -63,13 +66,22 @@ def test_active_parameter_budget_passes_default_stack() -> None:
|
|
| 63 |
assert budget["active_b"] <= 32.0
|
| 64 |
|
| 65 |
|
| 66 |
-
def
|
| 67 |
stack = active_stack(False)
|
| 68 |
repo_ids = {model.repo_id for model in stack}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
assert "black-forest-labs/FLUX.2-klein-4B" in repo_ids
|
| 71 |
assert "black-forest-labs/FLUX.2-klein-9B" not in repo_ids
|
| 72 |
-
assert not any("OFFELLIA" in repo_id for repo_id in repo_ids)
|
| 73 |
assert all(model.params_b <= 4.0 for model in stack)
|
| 74 |
|
| 75 |
|
|
@@ -213,7 +225,8 @@ def test_command_header_exposes_governed_run_controls() -> None:
|
|
| 213 |
|
| 214 |
assert "Raven Chronicle Active Weave" in header
|
| 215 |
assert "ST3GG ALWAYS ON" in header
|
| 216 |
-
assert "FLUX.2
|
|
|
|
| 217 |
assert "HUMAN CHECKPOINT" in header
|
| 218 |
|
| 219 |
|
|
@@ -359,7 +372,7 @@ def test_render_inspector_with_success_judge_shows_success_status() -> None:
|
|
| 359 |
def test_render_inspector_shows_default_stack_label_without_run() -> None:
|
| 360 |
html = render_inspector()
|
| 361 |
|
| 362 |
-
assert "FLUX.2
|
| 363 |
|
| 364 |
|
| 365 |
# --- render_provider_cards sponsor lane tests ---
|
|
@@ -432,11 +445,11 @@ def test_render_operations_and_inspector_redact_payload_details() -> None:
|
|
| 432 |
|
| 433 |
# --- catalog public_demo field tests ---
|
| 434 |
|
| 435 |
-
def
|
| 436 |
models, _ = filter_catalog(False)
|
| 437 |
repo_ids = {model.repo_id for model in models}
|
| 438 |
|
| 439 |
-
assert "black-forest-labs/FLUX.2-klein-9B"
|
| 440 |
|
| 441 |
|
| 442 |
def test_filter_catalog_includes_flux_9b_in_adult_mode() -> None:
|
|
@@ -446,11 +459,11 @@ def test_filter_catalog_includes_flux_9b_in_adult_mode() -> None:
|
|
| 446 |
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 447 |
|
| 448 |
|
| 449 |
-
def
|
| 450 |
models, _ = filter_catalog(False)
|
| 451 |
repo_ids = {model.repo_id for model in models}
|
| 452 |
|
| 453 |
-
assert
|
| 454 |
|
| 455 |
|
| 456 |
def test_active_stack_uses_private_research_stack_in_adult_mode() -> None:
|
|
@@ -458,6 +471,7 @@ def test_active_stack_uses_private_research_stack_in_adult_mode() -> None:
|
|
| 458 |
repo_ids = {model.repo_id for model in stack}
|
| 459 |
|
| 460 |
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
|
|
|
| 461 |
assert "black-forest-labs/FLUX.2-klein-4B" not in repo_ids
|
| 462 |
|
| 463 |
|
|
@@ -466,11 +480,14 @@ def test_private_research_stack_constant_contains_9b_and_offellia() -> None:
|
|
| 466 |
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in PRIVATE_RESEARCH_STACK
|
| 467 |
|
| 468 |
|
| 469 |
-
def
|
| 470 |
-
assert
|
|
|
|
|
|
|
| 471 |
assert "openbmb/MiniCPM-V-4.6" in DEFAULT_ACTIVE_STACK
|
| 472 |
assert "nvidia/NVIDIA-Nemotron-Parse-v1.2" in DEFAULT_ACTIVE_STACK
|
| 473 |
-
assert "black-forest-labs/FLUX.2-klein-
|
|
|
|
| 474 |
|
| 475 |
|
| 476 |
# --- schema ModelCandidate public_demo tests ---
|
|
@@ -510,7 +527,8 @@ def test_public_demo_false_models_are_excluded_from_public_filter() -> None:
|
|
| 510 |
license="other",
|
| 511 |
public_demo=False,
|
| 512 |
)
|
| 513 |
-
# public_demo=False should mean filter_catalog(False) excludes
|
| 514 |
-
# The catalog-level test: verify
|
| 515 |
models_public, _ = filter_catalog(False)
|
| 516 |
assert all(m.public_demo for m in models_public)
|
|
|
|
|
|
| 3 |
from nexus_visual_weaver.catalog import (
|
| 4 |
DEFAULT_ACTIVE_STACK,
|
| 5 |
PRIVATE_RESEARCH_STACK,
|
| 6 |
+
RAVEN_QUALITY_STACK,
|
| 7 |
+
TINY_TITAN_STACK,
|
| 8 |
active_stack,
|
| 9 |
catalog_summary,
|
| 10 |
filter_catalog,
|
| 11 |
parameter_budget,
|
| 12 |
+
tiny_titan_stack,
|
| 13 |
)
|
| 14 |
from nexus_visual_weaver.grounding import inspect_outfit
|
| 15 |
from nexus_visual_weaver.model_relay import WeaverModelRelay
|
|
|
|
| 66 |
assert budget["active_b"] <= 32.0
|
| 67 |
|
| 68 |
|
| 69 |
+
def test_default_stack_uses_raven_quality_models() -> None:
|
| 70 |
stack = active_stack(False)
|
| 71 |
repo_ids = {model.repo_id for model in stack}
|
| 72 |
|
| 73 |
+
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 74 |
+
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in repo_ids
|
| 75 |
+
assert "black-forest-labs/FLUX.2-klein-4B" not in repo_ids
|
| 76 |
+
assert all(model.params_b < 32.0 for model in stack)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def test_tiny_titan_stack_is_sidecar_only_and_all_models_are_under_4b() -> None:
|
| 80 |
+
stack = tiny_titan_stack()
|
| 81 |
+
repo_ids = {model.repo_id for model in stack}
|
| 82 |
+
|
| 83 |
assert "black-forest-labs/FLUX.2-klein-4B" in repo_ids
|
| 84 |
assert "black-forest-labs/FLUX.2-klein-9B" not in repo_ids
|
|
|
|
| 85 |
assert all(model.params_b <= 4.0 for model in stack)
|
| 86 |
|
| 87 |
|
|
|
|
| 225 |
|
| 226 |
assert "Raven Chronicle Active Weave" in header
|
| 227 |
assert "ST3GG ALWAYS ON" in header
|
| 228 |
+
assert "FLUX.2 9B PINNED" in header
|
| 229 |
+
assert "4B TINY SIDECAR" in header
|
| 230 |
assert "HUMAN CHECKPOINT" in header
|
| 231 |
|
| 232 |
|
|
|
|
| 372 |
def test_render_inspector_shows_default_stack_label_without_run() -> None:
|
| 373 |
html = render_inspector()
|
| 374 |
|
| 375 |
+
assert "FLUX.2 9B / OFFELLIA / LocateAnything" in html
|
| 376 |
|
| 377 |
|
| 378 |
# --- render_provider_cards sponsor lane tests ---
|
|
|
|
| 445 |
|
| 446 |
# --- catalog public_demo field tests ---
|
| 447 |
|
| 448 |
+
def test_filter_catalog_includes_flux_9b_in_public_mode() -> None:
|
| 449 |
models, _ = filter_catalog(False)
|
| 450 |
repo_ids = {model.repo_id for model in models}
|
| 451 |
|
| 452 |
+
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 453 |
|
| 454 |
|
| 455 |
def test_filter_catalog_includes_flux_9b_in_adult_mode() -> None:
|
|
|
|
| 459 |
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 460 |
|
| 461 |
|
| 462 |
+
def test_filter_catalog_includes_offellia_in_public_mode() -> None:
|
| 463 |
models, _ = filter_catalog(False)
|
| 464 |
repo_ids = {model.repo_id for model in models}
|
| 465 |
|
| 466 |
+
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in repo_ids
|
| 467 |
|
| 468 |
|
| 469 |
def test_active_stack_uses_private_research_stack_in_adult_mode() -> None:
|
|
|
|
| 471 |
repo_ids = {model.repo_id for model in stack}
|
| 472 |
|
| 473 |
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 474 |
+
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in repo_ids
|
| 475 |
assert "black-forest-labs/FLUX.2-klein-4B" not in repo_ids
|
| 476 |
|
| 477 |
|
|
|
|
| 480 |
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in PRIVATE_RESEARCH_STACK
|
| 481 |
|
| 482 |
|
| 483 |
+
def test_default_active_stack_constant_uses_9b_and_sponsor_models() -> None:
|
| 484 |
+
assert DEFAULT_ACTIVE_STACK == RAVEN_QUALITY_STACK
|
| 485 |
+
assert "black-forest-labs/FLUX.2-klein-9B" in DEFAULT_ACTIVE_STACK
|
| 486 |
+
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in DEFAULT_ACTIVE_STACK
|
| 487 |
assert "openbmb/MiniCPM-V-4.6" in DEFAULT_ACTIVE_STACK
|
| 488 |
assert "nvidia/NVIDIA-Nemotron-Parse-v1.2" in DEFAULT_ACTIVE_STACK
|
| 489 |
+
assert "black-forest-labs/FLUX.2-klein-4B" not in DEFAULT_ACTIVE_STACK
|
| 490 |
+
assert "black-forest-labs/FLUX.2-klein-4B" in TINY_TITAN_STACK
|
| 491 |
|
| 492 |
|
| 493 |
# --- schema ModelCandidate public_demo tests ---
|
|
|
|
| 527 |
license="other",
|
| 528 |
public_demo=False,
|
| 529 |
)
|
| 530 |
+
# public_demo=False should mean filter_catalog(False) excludes hidden support lanes.
|
| 531 |
+
# The catalog-level test: verify Modal VOID is absent from public catalog scope.
|
| 532 |
models_public, _ = filter_catalog(False)
|
| 533 |
assert all(m.public_demo for m in models_public)
|
| 534 |
+
assert "netflix/void-model" not in {model.repo_id for model in models_public}
|
tests/test_exporter.py
CHANGED
|
@@ -11,8 +11,13 @@ def _make_base_state(**overrides):
|
|
| 11 |
"checkpoint": "approved",
|
| 12 |
"message": "approved",
|
| 13 |
"generation": {"status": "success", "output_path": "/data/artifact.png", "hf_token_present": True},
|
|
|
|
|
|
|
| 14 |
"minicpm_judge": {"status": "success", "repo_id": "openbmb/MiniCPM-V-4.6"},
|
| 15 |
"nemotron_evidence": {"status": "missing_secret", "repo_id": "nvidia/NVIDIA-Nemotron-Parse-v1.2"},
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
state.update(overrides)
|
| 18 |
return state
|
|
@@ -32,6 +37,14 @@ def test_write_export_packet_records_evidence_without_secrets(monkeypatch) -> No
|
|
| 32 |
assert payload["hackathon_claims"]["openbmb_lane"] is True
|
| 33 |
assert payload["hackathon_claims"]["nvidia_nemotron_lane"] is False
|
| 34 |
assert payload["parameter_budget"]["status"] == "pass"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
assert "token" not in json.dumps(payload).lower()
|
| 36 |
assert payload["artifact"] == "artifact.png"
|
| 37 |
assert payload["generation"]["output_path"] == "artifact.png"
|
|
|
|
| 11 |
"checkpoint": "approved",
|
| 12 |
"message": "approved",
|
| 13 |
"generation": {"status": "success", "output_path": "/data/artifact.png", "hf_token_present": True},
|
| 14 |
+
"locateanything_grounding": {"status": "pass", "repo_id": "nvidia/LocateAnything-3B", "targets": [{"slot_name": "footwear"}]},
|
| 15 |
+
"offellia_judge": {"status": "deferred_local", "repo_id": "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf"},
|
| 16 |
"minicpm_judge": {"status": "success", "repo_id": "openbmb/MiniCPM-V-4.6"},
|
| 17 |
"nemotron_evidence": {"status": "missing_secret", "repo_id": "nvidia/NVIDIA-Nemotron-Parse-v1.2"},
|
| 18 |
+
"modal_video_repair": {"status": "deferred", "repo_id": "netflix/void-model", "provider": "modal"},
|
| 19 |
+
"audio_lore_tts": {"status": "optional", "repo_id": "hexgrad/Kokoro-82M"},
|
| 20 |
+
"tiny_titan_sidecar": {"status": "available", "repo_id": "black-forest-labs/FLUX.2-klein-4B"},
|
| 21 |
}
|
| 22 |
state.update(overrides)
|
| 23 |
return state
|
|
|
|
| 37 |
assert payload["hackathon_claims"]["openbmb_lane"] is True
|
| 38 |
assert payload["hackathon_claims"]["nvidia_nemotron_lane"] is False
|
| 39 |
assert payload["parameter_budget"]["status"] == "pass"
|
| 40 |
+
assert payload["active_preset"] == "Raven Quality Stack"
|
| 41 |
+
assert payload["modal_video_repair"]["repo_id"] == "netflix/void-model"
|
| 42 |
+
assert payload["offellia_judge"]["repo_id"] == "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf"
|
| 43 |
+
assert payload["audio_lore_tts"]["repo_id"] == "hexgrad/Kokoro-82M"
|
| 44 |
+
assert payload["tiny_titan_sidecar"]["repo_id"] == "black-forest-labs/FLUX.2-klein-4B"
|
| 45 |
+
assert payload["hackathon_claims"]["raven_quality_stack"] is True
|
| 46 |
+
assert payload["hackathon_claims"]["locateanything_grounding"] is True
|
| 47 |
+
assert payload["hackathon_claims"]["offellia_quality_lane"] is False
|
| 48 |
assert "token" not in json.dumps(payload).lower()
|
| 49 |
assert payload["artifact"] == "artifact.png"
|
| 50 |
assert payload["generation"]["output_path"] == "artifact.png"
|
tests/test_hf_runtime.py
CHANGED
|
@@ -1,6 +1,13 @@
|
|
| 1 |
from PIL import Image
|
| 2 |
|
| 3 |
-
from nexus_visual_weaver.hf_runtime import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from nexus_visual_weaver.render import render_artifact_lane
|
| 5 |
|
| 6 |
|
|
@@ -14,12 +21,20 @@ def test_hf_runtime_is_disabled_locally_by_default(monkeypatch) -> None:
|
|
| 14 |
result = generate_flux_image("test prompt")
|
| 15 |
assert result.status == "disabled"
|
| 16 |
assert result.provider_state == "dry-run"
|
| 17 |
-
assert result.repo_id == "black-forest-labs/FLUX.2-klein-
|
| 18 |
|
| 19 |
|
| 20 |
-
def
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
assert PRIVATE_RESEARCH_FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-9B"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def test_artifact_lane_embeds_generated_image() -> None:
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
|
| 3 |
+
from nexus_visual_weaver.hf_runtime import (
|
| 4 |
+
FLUX_REPO_ID,
|
| 5 |
+
PRIVATE_RESEARCH_FLUX_REPO_ID,
|
| 6 |
+
TINY_TITAN_FLUX_REPO_ID,
|
| 7 |
+
active_flux_repo_id,
|
| 8 |
+
generate_flux_image,
|
| 9 |
+
hf_runtime_enabled,
|
| 10 |
+
)
|
| 11 |
from nexus_visual_weaver.render import render_artifact_lane
|
| 12 |
|
| 13 |
|
|
|
|
| 21 |
result = generate_flux_image("test prompt")
|
| 22 |
assert result.status == "disabled"
|
| 23 |
assert result.provider_state == "dry-run"
|
| 24 |
+
assert result.repo_id == "black-forest-labs/FLUX.2-klein-9B"
|
| 25 |
|
| 26 |
|
| 27 |
+
def test_quality_and_sidecar_flux_repo_ids_are_split(monkeypatch) -> None:
|
| 28 |
+
monkeypatch.delenv("NEXUS_FLUX_REPO_ID", raising=False)
|
| 29 |
+
monkeypatch.delenv("NEXUS_TINY_TITAN_MODE", raising=False)
|
| 30 |
+
|
| 31 |
+
assert FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-9B"
|
| 32 |
assert PRIVATE_RESEARCH_FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-9B"
|
| 33 |
+
assert TINY_TITAN_FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-4B"
|
| 34 |
+
assert active_flux_repo_id() == FLUX_REPO_ID
|
| 35 |
+
|
| 36 |
+
monkeypatch.setenv("NEXUS_TINY_TITAN_MODE", "1")
|
| 37 |
+
assert active_flux_repo_id() == TINY_TITAN_FLUX_REPO_ID
|
| 38 |
|
| 39 |
|
| 40 |
def test_artifact_lane_embeds_generated_image() -> None:
|
tests/test_model_relay.py
CHANGED
|
@@ -11,19 +11,20 @@ def test_pinned_lanes_do_not_rotate() -> None:
|
|
| 11 |
assert decision.pinned is True
|
| 12 |
assert decision.rotatable is False
|
| 13 |
assert decision.primary is not None
|
| 14 |
-
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-
|
| 15 |
-
assert decision.primary.params_b ==
|
| 16 |
assert decision.fallbacks == []
|
| 17 |
assert "rotation disabled" in decision.reason
|
| 18 |
|
| 19 |
|
| 20 |
-
def
|
| 21 |
relay = WeaverModelRelay()
|
| 22 |
-
decision = relay.select_lane("
|
| 23 |
|
| 24 |
assert decision.primary is not None
|
| 25 |
-
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-
|
| 26 |
assert decision.primary.pinned is False
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
def test_public_private_taste_judge_respects_license_and_budget() -> None:
|
|
@@ -123,7 +124,8 @@ def test_dashboard_surfaces_gmr_pinned_models_and_fallbacks() -> None:
|
|
| 123 |
html = render_dashboard(relay_status=relay.dashboard_snapshot(public_demo=True))
|
| 124 |
|
| 125 |
assert "GMR ModelRelay" in html
|
| 126 |
-
assert "FLUX.2
|
|
|
|
| 127 |
assert "LocateAnything pinned" in html
|
| 128 |
assert "fallback:" in html
|
| 129 |
assert "Rotation Safe" in html
|
|
@@ -135,6 +137,8 @@ def test_optional_external_gateways_are_registered_but_excluded_by_default() ->
|
|
| 135 |
assert relay.records["netlify-ai-gateway-helper"].provider == "netlify"
|
| 136 |
assert relay.records["cloudflare-agent-helper"].provider == "cloudflare"
|
| 137 |
assert relay.records["fal-media-adapter"].provider == "fal"
|
|
|
|
|
|
|
| 138 |
assert relay.records["netflix-void-modal"].health == "healthy"
|
| 139 |
assert relay.records["netlify-ai-gateway-helper"].health == "excluded"
|
| 140 |
assert relay.records["fal-media-adapter"].health == "excluded"
|
|
@@ -184,27 +188,27 @@ def test_private_image_research_lane_is_rotatable() -> None:
|
|
| 184 |
assert "private_image_research" in ROTATABLE_LANES
|
| 185 |
|
| 186 |
|
| 187 |
-
def
|
| 188 |
relay = WeaverModelRelay()
|
| 189 |
|
| 190 |
-
record = relay.records["flux2-klein-
|
| 191 |
|
| 192 |
assert record.lane == "image_generation"
|
| 193 |
assert record.pinned is True
|
| 194 |
-
assert record.params_b ==
|
| 195 |
-
assert record.license_gate == "
|
| 196 |
-
assert record.repo_id == "black-forest-labs/FLUX.2-klein-
|
| 197 |
|
| 198 |
|
| 199 |
-
def
|
| 200 |
relay = WeaverModelRelay()
|
| 201 |
|
| 202 |
-
record = relay.records["flux2-klein-
|
| 203 |
|
| 204 |
-
assert record.lane == "
|
| 205 |
assert record.pinned is False
|
| 206 |
-
assert record.params_b ==
|
| 207 |
-
assert record.license_gate == "
|
| 208 |
|
| 209 |
|
| 210 |
def test_minicpm_has_fallback_chain_configured() -> None:
|
|
|
|
| 11 |
assert decision.pinned is True
|
| 12 |
assert decision.rotatable is False
|
| 13 |
assert decision.primary is not None
|
| 14 |
+
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-9B"
|
| 15 |
+
assert decision.primary.params_b == 9.0
|
| 16 |
assert decision.fallbacks == []
|
| 17 |
assert "rotation disabled" in decision.reason
|
| 18 |
|
| 19 |
|
| 20 |
+
def test_tiny_titan_sidecar_keeps_flux_4b_available() -> None:
|
| 21 |
relay = WeaverModelRelay()
|
| 22 |
+
decision = relay.select_lane("tiny_titan_sidecar", budget=4.0, public_demo=True, strategy="license_safe_public")
|
| 23 |
|
| 24 |
assert decision.primary is not None
|
| 25 |
+
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-4B"
|
| 26 |
assert decision.primary.pinned is False
|
| 27 |
+
assert decision.primary.params_b == 4.0
|
| 28 |
|
| 29 |
|
| 30 |
def test_public_private_taste_judge_respects_license_and_budget() -> None:
|
|
|
|
| 124 |
html = render_dashboard(relay_status=relay.dashboard_snapshot(public_demo=True))
|
| 125 |
|
| 126 |
assert "GMR ModelRelay" in html
|
| 127 |
+
assert "FLUX.2 9B pinned" in html
|
| 128 |
+
assert "4B sidecar" in html
|
| 129 |
assert "LocateAnything pinned" in html
|
| 130 |
assert "fallback:" in html
|
| 131 |
assert "Rotation Safe" in html
|
|
|
|
| 137 |
assert relay.records["netlify-ai-gateway-helper"].provider == "netlify"
|
| 138 |
assert relay.records["cloudflare-agent-helper"].provider == "cloudflare"
|
| 139 |
assert relay.records["fal-media-adapter"].provider == "fal"
|
| 140 |
+
assert relay.records["netflix-void-modal"].repo_id == "netflix/void-model"
|
| 141 |
+
assert relay.records["netflix-void-modal"].params_b == 5.0
|
| 142 |
assert relay.records["netflix-void-modal"].health == "healthy"
|
| 143 |
assert relay.records["netlify-ai-gateway-helper"].health == "excluded"
|
| 144 |
assert relay.records["fal-media-adapter"].health == "excluded"
|
|
|
|
| 188 |
assert "private_image_research" in ROTATABLE_LANES
|
| 189 |
|
| 190 |
|
| 191 |
+
def test_flux2_klein_9b_is_pinned_quality_lane() -> None:
|
| 192 |
relay = WeaverModelRelay()
|
| 193 |
|
| 194 |
+
record = relay.records["flux2-klein-9b-quality"]
|
| 195 |
|
| 196 |
assert record.lane == "image_generation"
|
| 197 |
assert record.pinned is True
|
| 198 |
+
assert record.params_b == 9.0
|
| 199 |
+
assert record.license_gate == "review_required"
|
| 200 |
+
assert record.repo_id == "black-forest-labs/FLUX.2-klein-9B"
|
| 201 |
|
| 202 |
|
| 203 |
+
def test_flux2_klein_4b_is_tiny_titan_sidecar() -> None:
|
| 204 |
relay = WeaverModelRelay()
|
| 205 |
|
| 206 |
+
record = relay.records["flux2-klein-4b-tiny-sidecar"]
|
| 207 |
|
| 208 |
+
assert record.lane == "tiny_titan_sidecar"
|
| 209 |
assert record.pinned is False
|
| 210 |
+
assert record.params_b == 4.0
|
| 211 |
+
assert record.license_gate == "apache-2.0"
|
| 212 |
|
| 213 |
|
| 214 |
def test_minicpm_has_fallback_chain_configured() -> None:
|