nemotron_3_diar: write speaker probabilities as safetensors - #686
Merged
0xShug0 merged 2 commits intoSep 25, 2026
Merged
Conversation
LysanderdeJong
force-pushed
the
feature/nemotron-3-diar-safetensors
branch
from
September 25, 2026 05:19
952edeb to
50e8732
Compare
Owner
|
@LysanderdeJong Could you elaborate on why you changed the direct-to-disk behavior of |
return_frame_probabilities now writes speaker_probabilities.safetensors: one F32 [frames, 8] tensor plus string metadata recording the source family, frame hop, sample rate, latency profile and streaming geometry. The framework gains encode_safetensors() with __metadata__ support; write_safetensors_file() now uses it. Add asr_la0/3/6/13 latency profiles (chunk_len = N + 1, no right context), which match the chunking of Nemotron ASR at lookahead N so a downstream ASR can reproduce NeMo's multitalker speaker masks.
Share only the header builder with encode_safetensors(); the file writer again writes the header and tensor data straight to the stream instead of buffering the whole file in memory first. encode_safetensors() now builds its vector in one reserved allocation.
Contributor
Author
|
Good catch, that was an unintended regression from a refactor. I only wanted to share the header code. Fixed in 3431e1a: |
LysanderdeJong
force-pushed
the
feature/nemotron-3-diar-safetensors
branch
from
September 25, 2026 17:57
50e8732 to
3431e1a
Compare
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
return_frame_probabilitieswritesspeaker_probabilities.safetensorsinstead of raw.f32, with the diarizer's streaming geometry as metadataasr_la0/asr_la3/asr_la6/asr_la13latency profiles that match Nemotron ASR's chunking at that lookaheadengine::io::encode_safetensors()(in-memory, with__metadata__support); it shares the header builder withwrite_safetensors_file(), which still streams to diskSecond of three stacked PRs split from #681; #685 (the first) is merged.
Why
The next PR runs NeMo's masked multitalker ASR from this file. That needs the diarizer's geometry: NeMo diarizes in ASR-sized chunks (chunk = lookahead + 1, no right context), and a mask from another geometry is not what the model was trained with. Raw
.f32carries no metadata.Changes
speaker_probabilities[frames, 8]and string metadata:format_version,source_family,frames,speakers,frame_hop_samples,sample_rate,latency_profile,spkcache_len,fifo_len,chunk_len,chunk_right_context,spkcache_update_period.asr_laNsets spkcache 264, FIFO 264, chunk N + 1, right context 0, update period 222, as NeMo'sconfigure_diar_streamingdoes.Maintainer notes
return_frame_probabilities(added in Improve Nemotron 3 diarization NeMo parity #677) now writesspeaker_probabilities.safetensors. The tensor data is unchanged. The.f32output exists only onmainsince Improve Nemotron 3 diarization NeMo parity #677; no release contains it (v0.8.2 predates Improve Nemotron 3 diarization NeMo parity #677).Validation
.f32for the same runnemotron_3_diar_streaming_testcovers theasr_laNgeometry and reads the bytes back throughload_safetensors_index; the Hugging Facesafetensorspackage reads the filewrite_safetensors_file()callers produce identical files