Slimmable interface and SlimmableContainer#242
Slimmable interface and SlimmableContainer#242jfsantos wants to merge 3 commits intosdatkinson:mainfrom
Conversation
3650ca5 to
91efeb0
Compare
|
Integration tests failed for some reason but that seems to be unrelated to anything I implemented here. Investigating. |
sdatkinson
left a comment
There was a problem hiding this comment.
A few things plz, see comments
| /// \param outputLevel Output level in dBu | ||
| void SetOutputLevel(const double outputLevel); | ||
|
|
||
| /// \brief Set the slimmable size of the model |
There was a problem hiding this comment.
Can you make a Slimmable interface class to mix in for slimmable models instead of adding it to this class?
| nlohmann::json large_model = load_nam_json(large_path); | ||
|
|
||
| nlohmann::json container; | ||
| container["version"] = "0.6.1"; |
There was a problem hiding this comment.
Is the code currently on 0.6.1?
Looks like 0.6.0
Can you bump here and there to 0.7.0? Since code that knows about 0.6.0 wouldn't know what to do with this at all.
| NAM_SAMPLE* out_ptr = output.data(); | ||
|
|
||
| // Test exact boundary values | ||
| dsp->SetSlimmableSize(0.33); // Should select first submodel (max_value=0.33) |
There was a problem hiding this comment.
So the high value is inclusive, right? Can you put that in the docstring for the class.
Frankly, I'd prefer Inclusive lower / exclusive upper...can we do that?
For the biggest model, one could make it null to be like "no limit" and we can assert that the biggest model is like that in a .nam file.
And then assert that only values between 0 and 1 (inclusive/inclusive) are given to the slimming method (can be validated in the base class).
sdatkinson
left a comment
There was a problem hiding this comment.
Just a few other asks since we were working in parallel :)
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "NAM/container.h" |
There was a problem hiding this comment.
Same while you were working & I was commenting, use the abstract class 🙏🏻
| // Test that SetSlimmableSize is called before processing (simulates --slim flow) | ||
| void test_slim_applied_before_processing() | ||
| { | ||
| std::cout << " test_slim_applied_before_processing" << std::endl; |
There was a problem hiding this comment.
Have the tests be quiet on the happy path
Added virtual void SetSlimmableSize(const double val) to DSP. Default is a no-op. val ranges from 0.0 (minimum size) to 1.0 (maximum size).
Subclasses override this to reduce computational cost in a model-specific way.
A new ContainerModel class that uses the slimmable interface to switch between multiple complete DSP models at different quality tiers.
immediately ready for process().
The NAM file format nests full model specs inside config.submodels[].model, with an empty top-level weights array.
A 3-tier container using lstm.nam (small, max_value=0.33), wavenet.nam (medium, max_value=0.66), and nano_relu.nam (large, max_value=1.0).
10 tests covering:
Developed with support and sponsorship from TONE3000