-
Notifications
You must be signed in to change notification settings - Fork 904
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
Example_input_array missing for converting to ONNX #1521
Comments
Hi, Thank you for reporting this bug; it seems to be caused by the fact that darts is not using the Pytorch Lightning In the meantime, It's possible to mimic the preprocessing performed by darts using the following snippet (modified from dim_component = 2
(
past_target,
past_covariates,
future_past_covariates,
static_covariates,
) = [torch.Tensor(x).unsqueeze(0) if x is not None else None for x in loaded_model.train_sample]
n_past_covs = (
past_covariates.shape[dim_component] if past_covariates is not None else 0
)
input_past = torch.cat(
[ds for ds in [past_target, past_covariates] if ds is not None],
dim=dim_component,
)
input_sample = [input_past.double(), static_covariates.double()]
loaded_model.model.to_onnx("filename", input_sample=input_sample) |
Cool that you could take a look! Thanks! Maybe if the storage is a problem because of "leaking data" or privacy reasons, some random, but well shaped data can be put in there I think, like here, so maybe doing it that way can help... Should I close this issue or you plan to work on it? |
Describe the bug
Since the
example_input_array
attribute is not set in case of a checkpoint loaded NHiTS model, converting to ONNX with theto_onnx()
function fails.To Reproduce
Expected behavior
To output an ONNX file.
System (please complete the following information):
Additional context
The lack of
input_sample
andmodel.example_input_array
also makes it pretty difficult to use graph visualization tools to take a look at the network, since they typically require something to do a single forward pass with.The text was updated successfully, but these errors were encountered: