HISE Logo Forum
    • Categories
    • Register
    • Login

    Little trouble with nested includes

    Scheduled Pinned Locked Moved C++ Development
    31 Posts 4 Posters 2.5k 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.
    • ?
      A Former User @Christoph Hart
      last edited by

      @Christoph-Hart do I have to manually target HISE if this happens?

      or just debug the HISE project instead?

      fa55241b-e136-41bc-8adf-dcc4c89648d8-image.png

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @A Former User
        last edited by

        @iamlamprey Yes, go to the Project properties and select the HISE x64 Debug.exe as Command:

        dc09cb53-1bf7-4b3e-b7d9-f8fe6de94b88-image.png

        If you then click on the Debug play button in VS it will launch HISE and as soon as you load a node from your DLL it will jump into the code and you can step through it and print stuff. DBG("Funky"); is your friend here.

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Christoph Hart
          last edited by

          @Christoph-Hart Got it, thank you :)

          ? 1 Reply Last reply Reply Quote 0
          • ?
            A Former User @A Former User
            last edited by

            @Christoph-Hart What would be the best way to add JSON-loadability to a node? Is that a realistic ask or would I be better off trying to just make this a base processor instead of a node?

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @A Former User
              last edited by

              @iamlamprey there is no API for communication with Strings so that will be a bit tricky. What data do you want to communicate?

              ? 1 Reply Last reply Reply Quote 0
              • ?
                A Former User @Christoph Hart
                last edited by

                @Christoph-Hart Yeh that would explain the error.

                I'm trying to load a tensorflow model, so the data would be both the model itself (layers & their hyperparameters) and the actual weights & bias of the network (the "trained" part). They're mostly doubles I think but there's some strings in there as well for the type of layer & activation functions

                The goal is

                audio sample -> [network] -> output, where [network] is a big ol bunch of matrix math that does all the blackbox stuff automatically

                Not gonna lie I may have bit off more than i can chew here, I've been watching Cherno's C++ series and I'm starting to grasp some of it but man my brain hurts lol.

                I think I'll have to just get familiar with the tensorflow C api, all these other libraries and dependencies seem to pile up errors, and I really only need a few pieces of tensorflow (conv1d, leakyrelu, layernorm etc)

                Christoph HartC 1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart @A Former User
                  last edited by

                  @iamlamprey Do you need to load different JSON files on runtime or can you include them in the C++ source?

                  ? 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @Christoph Hart
                    last edited by

                    @Christoph-Hart Ideally different ones at runtime (loading different models), but I could probably get away with including all of the models, then just use a node Parameter to switch between them and hide that parameter from the end user

                    worst case scenario I can copy the weight values manually into a struct or something and write my own activations (those are pretty simple), then the only part left really is re-creating the convolution layer, which is probably the hardest part

                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User
                      last edited by

                      Here's an example of a "trained" model (it's not actually trained, the weights just get randomized on initialization) if it helps explain it better

                      encoder_weights.json

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @A Former User
                        last edited by

                        @iamlamprey Is the structure of the JSON always the same? Because if it is then I would recommend spending some time writing a batch tool that converts it to C structs, otherwise I would stick to loading and parsing JSON - there are classes available in JUCE that do this for you but embedding Strings as hardcoded values with escaping the special characters is a bit annoying.

                        And yes I would definitely go the route of embedding all model data and then choosing the one you want with a parameter.

                        ? 1 Reply Last reply Reply Quote 0
                        • ?
                          A Former User @Christoph Hart
                          last edited by

                          @Christoph-Hart It is the same "for now" because Tensorflow is Tensorflow and they'll probably change everything in a week for no apparent reason

                          Embedding sounds good, while I've got you here, can you recommend any great C++ resources? Now that I'm finally getting around to learning it :) anything specifically JUCE-related would be bonus points

                          1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User
                            last edited by

                            @Christoph-Hart do you have any suggestions for this?

                            ed6f2008-ae90-42bc-aff8-359ca461d7b0-image.png

                            I've added the directories to the Additional Include Directories in the C/C++ properties, added the lib path to the Linker->General->Additional Library Directories, and included all (and also tried selectively including) the .lib files in the Linker->Input->Additional Dependencies options, using the Debug build for both the node & HISE (and I double-checked that all the options I changed were Debug-Specific, and the Library is the debug-build), and everything seems to build and link just fine.

                            But when I open HISE and load the project, the node is "missing" from the Hardcoded FX & ScriptNode. I know there's an issue with the library, since commenting out the #include fixes the issue, but there's no error messages or anything up until HISE loads the project so I'm not sure where to even start looking.

                            Also happens for Release node/HISE/library.

                            Christoph HartC 1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart @A Former User
                              last edited by

                              1. Compile the debug dll from within Visual Studio and check if there are any error messages
                              2. Check if the DLL exists at the place that is shown in your screenshot above. If not, then the compilation didn't went through
                              ? 1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @Christoph Hart
                                last edited by

                                @Christoph-Hart No error messages compiling, I cleaned the build folder and re-built and the .dll shows up just fine.

                                I noticed:

                                'HISE Debug.exe' (Win32): Loaded 'D:\Documents\HISE\TensorflowHISE\DspNetworks\Binaries\dll\Dynamic Library\TensorflowHISE_debug.dll'. Symbols loaded.
                                
                                

                                Followed shortly after by:

                                'HISE Debug.exe' (Win32): Unloaded 'D:\Documents\HISE\TensorflowHISE\DspNetworks\Binaries\dll\Dynamic Library\TensorflowHISE_debug.dll'
                                
                                

                                a9c0ae89-595f-4fb5-aa28-07fcffd1e26a-image.png

                                8ba0ed90-f0d5-4017-b56a-13118cdadebe-image.png

                                The Torch library has some .dll's as well as .libs (but no dynamic .libs), so I've only included the .libs. Could that be what's causing it?

                                3d941eab-92ea-4677-86b7-02c75cfd4a08-image.png

                                Christoph HartC 1 Reply Last reply Reply Quote 0
                                • ?
                                  A Former User
                                  last edited by

                                  Hmm I tried building a blank .sln in VS and now I'm getting 50 bajillion errors... I'll try the release version of Torch and see if I can get that one working...

                                  1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart @A Former User
                                    last edited by

                                    Hmm, that's not so easy to remote debug.

                                    The error message indicates that it can't open the DLL which might be related to the library itself trying to load the other dlls or whatever.

                                    There are tools available to inspect DLLs (I think one is called DependencyWalker) so maybe if you look into the .dll you'll find whether the other libraries are imported, but yeah, this is one of the more frustrating areas of C / C++.

                                    1 Reply Last reply Reply Quote 0
                                    • ?
                                      A Former User
                                      last edited by

                                      this is one of the more frustrating areas of C / C++.

                                      f6b5e3ba-3c9e-4692-855c-a64dbba9fa08-image.png

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User
                                        last edited by

                                        @Christoph-Hart So do these nodes not support strings at all? Would that be a pain to implement? Every ML library seems to rely heavily on strings for instantiating network layers and don't seem to support alternatives ie calling them by numbers.

                                        1 Reply Last reply Reply Quote 0
                                        • ?
                                          A Former User
                                          last edited by

                                          actually I just realized I could probably just do manual matrix math since i have access to all the saved weights, im not sure how different the end result would be

                                          1 Reply Last reply Reply Quote 0
                                          • ?
                                            A Former User
                                            last edited by

                                            @Christoph-Hart Does the parameter class not support step size? I need whole numbers so it isn't calling a randomize method every .01 steps

                                            0831bd64-041a-4331-b48c-850c7c721f2c-image.png

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

                                            10

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.5k

                                            Posts