-
Notifications
You must be signed in to change notification settings - Fork 734
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
Sending a request to the forward method of a model that expects more than one vector #1164
Comments
If you call, for example, |
Yes. When I call I think this is not the problem. I actually have another model that starts with the bi-lstm layer. It works fine when I send a request to its forward. Because its forward method expects a single variable. But bert wants three. Otherwise, the data types of the requested vector are the same. |
Maybe there's some incompatibility between versions of PyTorch. Are you sure you're using the same exact version of PyTorch? |
I'm not sure I understand what pytorch versions there would be incompatibility between. I am using maven distribution on linux. From what I've read on README.md I guess there is no need to download libtorch on linux and give it its path. In addition, if there was such a problem, I think it would not work at all, but I only cannot send requests to models with forward method that require more than one variable. |
I mean, you're not using the same binaries from C++ and from Java. There could be incompatibilities between say PyTorch 1.10.x and 1.11.x. JavaCPP is just calling the C++ API as is, and you're saying that the content of |
I understand, but I don't think there is a problem with binaries because I can already use the library on my own model. Actually, my reason for opening an issue is as I wrote in the first message, I am requesting a usage example for the following method in the JitModule class.
forward can be called in 2 different ways as you know. It works when I call it as below. Because my own model expects a single forward variable. But the Bert model expects 3 different variables. So I need an example of the usage above.
Thanks again for trying to help. |
Those 2 methods map to the same function in C++. It's just a way to emulate the default arguments that the Java language doesn't support. So you're saying you're having issues with |
Oh, that's not right. That |
I've fixed the Other than that, what you proposed at first using |
The fix for this has been released with version 1.5.8! Thanks for reporting |
Hi,
I'm trying to make a request to the bert model whose trace I have taken. I've tried this in different ways, I've also tried with K value args but I always get an error.
As you know, the Bert model expects 3 input vectors. Ids, attention_mask and token_type_ids. I'm making a test request as follows.
And I am getting this error. I think I got the trace of the model correctly. Because I can use the model on cpp.
It works fine when I request a model with a forward method that expects a single variable. But it doesn't work on bert. Can you share an example usage for models with multi-variable forward method? Or what is the reason for the error I get?
Thanks in advance.
The text was updated successfully, but these errors were encountered: