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

Argument type for Input generates issues #27

Open
mosoriob opened this issue May 12, 2021 · 0 comments
Open

Argument type for Input generates issues #27

mosoriob opened this issue May 12, 2021 · 0 comments

Comments

@mosoriob
Copy link
Contributor

Problem

Argument type for InputFile (pathlib.Path) generates issues in some cases.

For example, the function tflite.Interpreter from TensorFlow library excepts a string

'InterpreterWrapper_CreateWrapperCPPFromFile'.
  Possible C/C++ prototypes are:
    tflite::interpreter_wrapper::InterpreterWrapper::CreateWrapperCPPFromFile(char const *,std::vector< std::string > const &,std::string *)

However, ipython2cwl adds the parameter as pathlib.Path. Then, the code is not the same and generates the following issue

tflite::interpreter_wrapper::InterpreterWrapper::tflite_interpreter_wrapper_InterpreterWrapper_CreateWrapperCPPFromFile__SWIG_1(char const *,PyObject *)

Solution

A quick solution can be to change the type of argument but I'm not the effects.

     54     parser.add_argument('--modelPath', type=str, required=True)

Full error

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/app/cwl/bin/main in <module>
     54     parser.add_argument('--modelPath', type=pathlib.Path, required=True)
     55     args = parser.parse_args()
---> 56     main(cameraType=args.cameraType, siteID=args.siteID, modelPath=args.
     57         modelPath)

/app/cwl/bin/main in main(cameraType, siteID, modelPath)
     29     testObj.urlToImage(imageURL)
     30     testObj.writeImage(imagePath)
---> 31     interpreter = tflite.Interpreter(model_path=modelPath)
     32     interpreter.allocate_tensors()
     33     result, percent = testObj.inference(interpreter)

/srv/conda/envs/notebook/lib/python3.6/site-packages/tflite_runtime/interpreter.py in __init__(self, model_path, model_content, experimental_delegates)
    202       self._interpreter = (
    203           _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromFile(
--> 204               model_path, self._custom_op_registerers))
    205       if not self._interpreter:
    206         raise ValueError('Failed to open {}'.format(model_path))

NotImplementedError: Wrong number or type of arguments for overloaded function 'InterpreterWrapper_CreateWrapperCPPFromFile'.
  Possible C/C++ prototypes are:
    tflite::interpreter_wrapper::InterpreterWrapper::CreateWrapperCPPFromFile(char const *,std::vector< std::string > const &,std::string *)
    tflite::interpreter_wrapper::InterpreterWrapper::tflite_interpreter_wrapper_InterpreterWrapper_CreateWrapperCPPFromFile__SWIG_1(char const *,PyObject *)

mosoriob added a commit to KnowledgeCaptureAndDiscovery/ipython2cwl that referenced this issue May 12, 2021
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