feat(rvf): accept JSONL RVF container in --model loader#810
Open
lockewerks wants to merge 3 commits into
Open
Conversation
RvfReader::from_bytes now sniffs the leading non-whitespace byte and
dispatches to a JSONL parser when it sees '{' or '['. The new
from_jsonl_bytes helper walks each line, validates that it is a JSON
object with a "type" field, and maps known types onto in-memory binary
segments so the rest of the pipeline keeps working unchanged:
type=metadata -> SEG_MANIFEST (name, version, architecture)
type=quantization -> SEG_QUANT (full JSON payload, default
quant_type filled in if absent)
type=* -> SEG_META (verbatim, bundled into one entry)
The binary-path "invalid magic" error now points operators at the JSONL
format so failures are explicit instead of degrading to null output, and
unrecognised content (non-UTF-8, no objects, missing type) returns a
detailed error rather than a silent partial parse.
The JSONL container intentionally does not carry the f32 weight matrix
- those ship as model.safetensors / model-qN.bin in the HuggingFace
bundle - so weights() returns None for JSONL inputs. Callers that need
the convolution weights must still load one of the sibling files.
Fixes the documented gap where pointing the sensing-server --model flag
at model.rvf.jsonl from the HuggingFace bundle errored with
"invalid magic at offset 0: expected 0x52564653, got 0x7974227B".
Covers the new sniff + JSONL adapter end-to-end:
- from_bytes_dispatches_to_jsonl_on_brace: feeds an in-memory copy
of the exact bytes shipped at ruvnet/wifi-densepose-pretrained
(model.rvf.jsonl, v1.0.0) through the public API and asserts the
synthesised manifest exposes the real model id and version.
- jsonl_sniff_tolerates_leading_whitespace: padding with \n \t still
dispatches to JSONL.
- jsonl_quantization_becomes_quant_segment: the quantization line
surfaces verbatim through quant_info().
- jsonl_preserves_other_lines_in_metadata: encoder, lora, ewc, and
metadata lines all round-trip through metadata()["lines"].
- jsonl_no_weights_segment_present: weights() returns None - the
JSONL bundle does not carry f32 weights, by design.
- jsonl_progressive_loader_layer_a_works: covers the integration
point that previously broke - ProgressiveLoader::new + load_layer_a
now reports the real model name on JSONL input.
- jsonl_invalid_json_line_is_explicit / jsonl_missing_type_field /
jsonl_blank_lines_only: every error path produces a "JSONL RVF"
prefix and identifies the offending line, so failures surface to
operators instead of degrading to null output.
- jsonl_minimal_metadata_only: a single-line bundle still parses.
- binary_error_mentions_jsonl_hint: corrupt binary input now points
at the JSONL format in its error text.
The "Pretrained model on Hugging Face" section now reflects that the sensing-server --model flag accepts the JSONL container shipped at ruvnet/wifi-densepose-pretrained directly, with no preprocessing. Replaces the "Known gap" paragraph with a "JSONL loader" paragraph that documents the segment mapping (metadata -> SEG_MANIFEST, quantization -> SEG_QUANT, anything else -> SEG_META) and is honest about the remaining limitation: JSONL does not carry the f32 weight matrix, so weight-sensitive inference paths still need the sibling model.safetensors / model-qN.bin file from the HF bundle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
README.mddocuments this gap:This PR closes that gap.
Changes
v2/crates/wifi-densepose-sensing-server/src/rvf_container.rs(+283/-2):from_bytesnow sniffs the first non-whitespace byte and dispatches:R→ existing binary path (RVFSmagic). Byte-for-byte unchanged; all 14 pre-existing binary tests still green.{→ new JSONL path that reads lines, parses each as JSON, builds an in-memory equivalent of binary segments (SEG_MANIFEST/SEG_QUANT/SEG_META), re-uses the existing parserProgressiveLoader::load_layer_aintegration thatmain.rsuses on startupREADME.md(+2/-2): replaced the "Known gap" paragraph with a description of what the loader now acceptsVerification
cargo test -p wifi-densepose-sensing-server --no-default-features --lib→ 435 passed, 0 failed, 1 ignored (10 new tests included)cargo build -p wifi-densepose-sensing-server --no-default-features→ clean (warnings only)sensing-server --model models/wifi-densepose-pretrained/model.rvf.jsonl --source esp32now logsLayer A ready: model=wifi-densepose-csi-embedding v1.0.0 (3 segments)instead of the previous null-output degradeNotes
The JSONL bundle is metadata-only by design — the f32 weight matrix lives in the sibling
model.safetensors.RvfReader::weights()therefore returnsNonefor JSONL input, same behaviour as launching without--model. The README updates this section to be explicit about that.A future patch could stitch the sibling
model.safetensorsinto a syntheticSEG_VECsegment soweights()returns real data — out of scope here. (Note: that future patch additionally needs the safetensors header fix to land first; see PRfix/safetensors-header-paddingon this fork.)Test plan
cargo test -p wifi-densepose-sensing-server --no-default-features --libpasses including newjsonl_*testscargo build -p wifi-densepose-sensing-server --no-default-featurescleansensing-server --model <path>/model.rvf.jsonl --source esp32and confirmLayer A readylog linesensing-server --model <path>/model.rvf(existing binary) and confirm no regression