Skip to content
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

Packaging TensorFlow Model in HISE Crashes in JSON Parser (Works in Editor) #628

Open
mcrespoae opened this issue Dec 4, 2024 · 0 comments

Comments

@mcrespoae
Copy link

Description:

When using HISE to load and test a TensorFlow model, everything works correctly in the editor. However, when packaging the app for distribution, it crashes during the JSON parsing process. This issue occurs even with the official NeuralNetworkExample from the HISE tutorial repository.

Steps to Reproduce:

  1. Load a TensorFlow model in HISE using the NeuralNetworkExample.
  2. Test the model in the HISE editor (works as expected).
  3. Attempt to package the project for distribution.
  4. Observe the crash during the execution process.

Observed Behavior:

The application crashes during packaging with the following error trace in the json.hpp file (line 21107):

       // at only works for objects
        if (JSON_HEDLEY_UNLIKELY(!is_object()))
        {
            JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this)); -----> HERE
        }

Call Stack:
Line 608, model_loader.h:

   /** Creates a neural network model from a json stream. */
    template <typename T>
    std::unique_ptr<Model<T>> parseJson(const nlohmann::json& parent, const bool debug = false)
    {
        auto shape = parent.at("in_shape"); ----> HERE

     ...}

Line 326, hi_neural.cpp:

	TensorFlowModel(const var& obj)
	{
		auto s = JSON::toString(obj, false).toStdString();
		modelData = nlohmann::json::parse(s);
		model = RTNeural::json_parser::parseJson<float>(modelData); -----> HERE

		numInputs = model->getInSize();
		numOutputs = model->getOutSize();
		model->reset();
	}

Expected Behavior:

The app should successfully package and run the TensorFlow model without issues, as it does in the HISE editor.

Environment:

HISE Version: 4.1.0
Operating System: [Windows 11/macOS Sequoia]

Please let me know if any additional details or files are required to assist in reproducing the issue.

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

No branches or pull requests

1 participant