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

Support pathlib.Path when paths are required in python module #3843

Open
daniel-j-h opened this issue May 6, 2020 · 4 comments
Open

Support pathlib.Path when paths are required in python module #3843

daniel-j-h opened this issue May 6, 2020 · 4 comments
Labels
api issues related to all other APIs: C, C++, Python, etc. feature request request for unsupported feature or enhancement

Comments

@daniel-j-h
Copy link

Right now we only support string paths as in

rt.InferenceSession("myfile.pb")

We should support semantically accurate pathlib.Path types, too

rt.InferenceSession(Path("myfile.pb"))

and not throw an exception.

if isinstance(self._path_or_bytes, str):
self._sess.load_model(self._path_or_bytes, providers)
elif isinstance(self._path_or_bytes, bytes):
self._sess.read_bytes(self._path_or_bytes, providers)
elif isinstance(self._path_or_bytes, tuple):
# to remove, hidden trick
self._sess.load_model_no_init(self._path_or_bytes[0], providers)
else:
raise TypeError("Unable to load from type '{0}'".format(type(self._path_or_bytes)))

Note: not just in InferenceSession but everywhere we require a path.

@hariharans29 hariharans29 added feature request request for unsupported feature or enhancement Python API labels May 6, 2020
@stale
Copy link

stale bot commented Jul 18, 2020

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@stale stale bot added the wontfix label Jul 18, 2020
@daniel-j-h
Copy link
Author

daniel-j-h commented Jul 18, 2020 via email

@stale stale bot removed the wontfix label Jul 18, 2020
@stale
Copy link

stale bot commented Sep 20, 2020

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@stale stale bot added the stale issues that have not been addressed in a while; categorized by a bot label Sep 20, 2020
@daniel-j-h
Copy link
Author

Still an issue. I will not update this every other month to keep the bot happy from now on..

@stale stale bot removed the stale issues that have not been addressed in a while; categorized by a bot label Sep 20, 2020
@sophies927 sophies927 added api issues related to all other APIs: C, C++, Python, etc. and removed api:Python labels Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api issues related to all other APIs: C, C++, Python, etc. feature request request for unsupported feature or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants