Skip to content

Fixed Issue when USE_WEIGHTS_FILE Flag Enabled #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yymin1022
Copy link

Summary

Fixed some issues when USE_WEIGHTS_FILE Flag is enabled.

Description

  • When USE_WEIGHTS_FILE Flag is enabled, rnnoise_data.c which has huge huge lines is not used for compile program. But init_rnnoise Function is included in rnnoise_data.c so compile must be needed.
  • So moved init_rnnoise Function into denoise.c.
  • And also, when generate weight_blob.bin with write_weights.c, it generated .bin file with w mode, but we are generating just b file so I edited w as wb of file function parameter.
  • write_weights.c has same work as old one, but I improved code readability and debugability.
  • .sh scripts are compile helper for debuggers.
  • I think almost guys contributing this project are related to AI, ML, or Audio Training, but I am just Android developer so I got too hard to use this project. I think this PR fixed some many of just developmenting issue using this project. Please merge this PR so that many client developers can use this project for their projects.

@yymin1022
Copy link
Author

@jmvalin

@jmvalin
Copy link
Member

jmvalin commented Apr 9, 2025

About the first three patches, building should be handled by the build system, but hardcoded shell sccripts. About the last one, I'm not sure what it's meant to fix. You cannot just just copy that code to a different file since it's actually auto-generated.

As for the readability patch, I see there's a missing "b" for writing on Windows, but beyond that it's mostly just re-indenting the code, which is pointless.

@yymin1022
Copy link
Author

@jmvalin
As you said, sh scripts and write_weights.c might be just for my convenience.
But function in denoise.c is meaningful contribution.
When USE_WEIGHTS_FILE Flag is enabled, rnnoise_data.c is no more necessary because all of the model data is from weights_blob.bin file, not in the float/int array from rnnoise_data.c.
But init_rnnoise function is still in rnnoise_data.c so we must compile with it, so output binary gets bigger size.
So I thought moving init_rnnoise function into denoise.c make us exclude rnnoise_data.c file when compiling, and I successed as I thought.
If this idea is wrong because of auto-generating, please think about another method to exclude rnnoise_data.c when use USE_WEIGHTS_FILE Flag.

@jmvalin
Copy link
Member

jmvalin commented Apr 10, 2025

The weights in rnnoise_data.c are all inside a
#ifndef USE_WEIGHTS_FILE
so they don't get compiled at all if you compile with -DUSE_WEIGHTS_FILE

@yymin1022
Copy link
Author

Yes but the source code is too heavy. rnnoise_data.c has about 75MB Size. So I think seperation is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants