You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the input shape of an ONNX model has been set to a string (thus indicating that the axes are dynamic), then making a prediction will give an error of this kind:
cortex.lib.exceptions.UserException: error: key 'input_ids' for model '_cortex_default': failed to convert to NumPy array for model '_cortex_default': cannot reshape array of size 6 into shape (1,1)
Here's an example of a model's input shapes:
model input type shape
attention_mask int64 (batch, sequence)
input_ids int64 (batch, sequence)
Steps to reproduce
Within a given directory, run all the following steps.
Creating environment/model
Create a virtual environment for Python 3.6.9 and install the following pip dependencies:
Copy-paste the pip dependencies as mentioned above into a requirements.txt file and within the same directory as that of the cortex.yaml config file, run cortex deploy -e local. Wait for the API to be live and then run:
curl http://localhost:8888 -X POST -H "Content-Type: application/json" -d '{"text": "That is a nice"}'
Error
The above command will return a non-200 response code. Inspect the logs with cortex get api. The expected error is:
cortex.lib.exceptions.UserException: error: key 'input_ids' for model '_cortex_default': failed to convert to numpy array for model '_cortex_default': cannot reshape array of size 6 into shape (1,1)
The text was updated successfully, but these errors were encountered:
Version
Version 0.18.0
Description
When the input shape of an ONNX model has been set to a string (thus indicating that the axes are dynamic), then making a prediction will give an error of this kind:
Here's an example of a model's input shapes:
Steps to reproduce
Within a given directory, run all the following steps.
Creating environment/model
Create a virtual environment for Python 3.6.9 and install the following pip dependencies:
Within that environment, run the following instructions to export the XLM-Roberta model in ONNX format:
Now, let's run the following:
Creating the Cortex deployment
Create a
cortex.yaml
config file with the following content:Create a
predictor.py
script with the following content:Copy-paste the pip dependencies as mentioned above into a
requirements.txt
file and within the same directory as that of thecortex.yaml
config file, runcortex deploy -e local
. Wait for the API to be live and then run:Error
The above command will return a non-200 response code. Inspect the logs with
cortex get api
. The expected error is:The text was updated successfully, but these errors were encountered: