HISE Logo Forum
    • Categories
    • Register
    • Login

    Swapping a neural network model at runtime.

    Scheduled Pinned Locked Moved General Questions
    11 Posts 5 Posters 243 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      scottmire
      last edited by scottmire

      I know the NN topic has had it's share of coverage for a while now. Thanks to all the hard work and efforts of so many here, I've got working NN that loads AIDA-X guitar amp captures. Now my challenge is that I want to be able to swap out NN models at runtime based on a user selection. What I am seeing is that once I instantiate the NN and load in the initial model, I cannot load another model at runtime. The first loaded models stays firmly in place.

      I am creating and loading the NN using the following:

      const MLmodel = {MODEL JSON HERE};
      
      const var tf = Engine.createNeuralNetwork("TensorFlowNetwork");
      
      tf.loadTensorFlowModel(MLmodel);
      

      I had assumed that, if I created multiple vars to hold the different models (MLmodel_1, MLmodel_2, etc), I could simply swap them out by calling ".loadTensorFlowModel(model)". But alas no.

      Has anyone gotten something like this working? Any advise would be greatly appreciated.

      1 Reply Last reply Reply Quote 1
      • S
        sinewavekid
        last edited by

        would you be able to share a full working project? i've been working to create something similar, a free plugin for archiving and making old and un-updated free vst effects plugins available for modern pcs (windows only old compressors, unique saturation algorithms, etc), and im happy to help troubleshoot and get something working for everyone! i've been using NAM for my captures but havent had luck getting them to load yet in HISE so ill happily test with AIDA-X if it actually is running in HISE right now

        S 1 Reply Last reply Reply Quote 0
        • S
          scottmire @sinewavekid
          last edited by

          @sinewavekid
          The snip found in this thread will get you going

          Link Preview Image
          Hardcoded Neural Network does not work as expected

          If anyone wants to start learning about RTneural, here's a snip that contains a model of the ProCo Rat pedal: HiseSnippet 20992.3oc6810imccdcmUKp1Rh1dlDj.ja4...

          favicon

          Forum (forum.hise.audio)

          clevername27C 1 Reply Last reply Reply Quote 1
          • S
            sinewavekid
            last edited by sinewavekid

            awesome thank you! ill try to get one network working smoothly today, then test out some methods to make a combobox to select between networks and also somehow reload/clear/initialize them. my first guess would be to make some function which clears out/resets the old network somehow, a quick chatgpt gave me something like this, but im sure itll need tweaking

            // Define the model(s)
            
            const var MLmodel_1 = {MODEL1 JSON HERE};
            const var MLmodel_2 = {MODEL2 JSON HERE};
            
            
            const var tf = Engine.createNeuralNetwork("TensorFlowNetwork");
            
            
            //function to clear/initialize the models (can be linked to a combobox in the future)
            
            function loadModel()
            {
            
               tf.clearModel();
               tf.reset(); //no idea if this is needed lol
               tf.loadTensorFlowModel(MLmodel_1);
            }
            
            
            loadModel();
            
            
            

            hopefully it's a start to keep experimenting !

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @sinewavekid
              last edited by

              @sinewavekid you need to create multiple networks for each model and then select them from the node via the drop down.

              JulesVJ S S 3 Replies Last reply Reply Quote 0
              • JulesVJ
                JulesV @Christoph Hart
                last edited by JulesV

                @Christoph-Hart said in Swapping a neural network model at runtime.:

                @sinewavekid you need to create multiple networks for each model and then select them from the node via the drop down.

                But, beyond multiple neural models, the CPU usage is not working efficiently even in a single model right now.

                Did you fix the high cpu usage problem?

                Christoph HartC 1 Reply Last reply Reply Quote 0
                • S
                  scottmire @Christoph Hart
                  last edited by

                  @Christoph-Hart
                  I had assumed that "NeuralNetwork.clearModel()" would allow me to reset the NN, then I could follow with a new "NeuralNetwork.loadTensorFlowModel( var modelJSON)" function call. It obviously doesn't work this way.....but it would be amazing if it could....just sayin...lol.

                  1 Reply Last reply Reply Quote 0
                  • S
                    sinewavekid @Christoph Hart
                    last edited by

                    @Christoph-Hart awesome thank you for the info that is super helpful! is it possible to then select between them via scripting or by linking to a combobox or slider?

                    1 Reply Last reply Reply Quote 0
                    • clevername27C
                      clevername27 @scottmire
                      last edited by

                      @scottmire The photo from HISE Developer for Tinder.

                      S 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @JulesV
                        last edited by

                        @JulesV no.

                        1 Reply Last reply Reply Quote 1
                        • S
                          scottmire @clevername27
                          last edited by

                          @clevername27 LOL....I feel a bit bad about that. I didn't know it would do that.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          17

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          102.6k

                          Posts