Reducing NeMo-Speech working-set memory usage on Windows

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp

Research direction

The payload names no source files, so start from the model loading path where the GGUF loader and mmap are mentioned, and check whether the Windows-only memory calls belong in a platform-specific file. The reporter's experiment used the Windows EmptyWorkingSet() API, so confirm first with a maintainer whether an optional trim is wanted at all. Done means an opt-in trim that runs without unloading the model, with the measured working set reported before and after.

Written by the indexing model from the issue text.

Description

Hi, I have been testing NeMo-Speech in Windows on a Nvidia GPU using CUDA. I'm RAM-limited because I have a lot of other software running which was one of the reasons I wanted to offload the speech model to the GPU.

My issue is after loading, nemo-speech.exe was showing about 633 MB of private working set in Windows Task Manager, despite the model weights being loaded onto the GPU. I wondered whether mmap or the GGUF loader's temporary buffers were responsible, but disabling mmap did not resolve the issue. Using VMMap showed substantial committed heap memory, although only a fraction of it was resident in physical RAM.

I experimented with the Windows API EmptyWorkingSet(), which allows Windows to remove pages from a process's working set without terminating the process or releasing its underlying allocations.

The results were:
Initial private working set | ~633 MB
Working set after trimming | ~2.2 MB
After a subsequent transcription | ~50 MB
During continued dictation | ~around 55MB and it settles there.
Private bytes | ~6.38 GB (unchanged)

So I seem to have recovered about 580MB of system RAM without a noticeable downside.

Would it be worth considering an optional Windows-specific working-set trimming mechanism? A one-off trim could substantially reduce the resident RAM footprint without unloading the model, and it can then grow naturally during use.

Dominant language
C++
Stars
207
Forks
47
Avg merge
13h 10m
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/NeMo-Speech.cpp

All issues in NVIDIA/NeMo-Speech.cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.