-
Notifications
You must be signed in to change notification settings - Fork 657
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
Running TimeSeries Demo, got the TranslateException: ai.djl.engine.EngineException #2641
Comments
Is it exactly the same as the demo code? |
I just replace the json resolving code because I don't have the "data.json.gz" file. origin: /** prepare the file data */
// private void prepare() {
// Path filePath = path.resolve("test").resolve("data.json.gz");
// try {
// URL url = filePath.toUri().toURL();
// try (GZIPInputStream is = new GZIPInputStream(url.openStream())) {
// Reader reader = new InputStreamReader(is);
// data =
// new GsonBuilder()
// .setDateFormat("yyyy-MM")
// .create()
// .fromJson(reader, AirPassengerData.class);
// }
// } catch (IOException e) {
// throw new IllegalArgumentException("Invalid url: " + filePath, e);
// }
// } replace: private void prepare(){
String airPassangers = "{\"start\":\"1949-01\",\"target\":[112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,508.0,461.0,390.0,432.0]}";
data =
new GsonBuilder()
.setDateFormat("yyyy-MM")
.create()
.fromJson(airPassangers, AirPassengerData.class);
} |
I notice that your demo is from the readme.md. Sorry that may be outdated. The reliable demo is that in the unit test as I sent above. |
That works. Thxs a lot. It would be great if you could update the official demos on your website because it really confused me a bit time. |
Description
When I run the TimeSeries Demo, I got an exception called "Exception in thread "main" ai.djl.translate.TranslateException: ai.djl.engine.EngineException: Expected at most 7 argument(s) for operator 'forward', but received 8 argument(s). Declaration: forward(torch.gluonts.torch.model.deepar.module.DeepARModel self, Tensor feat_static_cat, Tensor feat_static_real, Tensor past_time_feat, Tensor past_target, Tensor past_observed_values, Tensor future_time_feat) -> Tensor"
Expected Behavior
(what's the expected behavior?)
Expected that I can get a successful running result
Error Message
(Paste the complete error message, including stack trace.)
Exception in thread "main" ai.djl.translate.TranslateException: ai.djl.engine.EngineException: Expected at most 7 argument(s) for operator 'forward', but received 8 argument(s). Declaration: forward(torch.gluonts.torch.model.deepar.module.DeepARModel self, Tensor feat_static_cat, Tensor feat_static_real, Tensor past_time_feat, Tensor past_target, Tensor past_observed_values, Tensor future_time_feat) -> Tensor
at ai.djl.inference.Predictor.batchPredict(Predictor.java:189)
at ai.djl.inference.Predictor.predict(Predictor.java:126)
at com.demo.djl.TimeSeriesTest.predict(TimeSeriesTest.java:68)
at com.demo.djl.TimeSeriesTest.main(TimeSeriesTest.java:34)
Caused by: ai.djl.engine.EngineException: Expected at most 7 argument(s) for operator 'forward', but received 8 argument(s). Declaration: forward(torch.gluonts.torch.model.deepar.module.DeepARModel self, Tensor feat_static_cat, Tensor feat_static_real, Tensor past_time_feat, Tensor past_target, Tensor past_observed_values, Tensor future_time_feat) -> Tensor
at ai.djl.pytorch.jni.PyTorchLibrary.moduleRunMethod(Native Method)
at ai.djl.pytorch.jni.IValueUtils.forward(IValueUtils.java:53)
at ai.djl.pytorch.engine.PtSymbolBlock.forwardInternal(PtSymbolBlock.java:145)
at ai.djl.nn.AbstractBaseBlock.forward(AbstractBaseBlock.java:79)
at ai.djl.nn.Block.forward(Block.java:127)
at ai.djl.inference.Predictor.predictInternal(Predictor.java:140)
at ai.djl.inference.Predictor.batchPredict(Predictor.java:180)
... 3 more
How to Reproduce?
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)
Steps to reproduce
(Paste the commands you ran that produced the error.)
1.run TimeSeriesTest.main()
What have you tried to solve it?
1.upgrade the pytorch version to 1.12.1
Environment Info
Please run the command
./gradlew debugEnv
from the root directory of DJL (if necessary, clone DJL first). It will output information about your system, environment, and installation that can help us debug your issue. Paste the output of the command below:The text was updated successfully, but these errors were encountered: