Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

No GPU support for predictor #141

Open
vivansxu opened this issue Jul 11, 2019 · 8 comments
Open

No GPU support for predictor #141

vivansxu opened this issue Jul 11, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@vivansxu
Copy link

May I confirm if there is no GPU support for the predictor service?
If no, how do I implement prediction for models which have to use GPUs?
Is it possible to add GPU support for the predictor to Rafiki?
Besides, I notice it is said in the documentation that it is required for the model to train and evaluate with only CPUs if there is no GPU hardware available. Since my model only supports GPU environment, do I have to follow this requirement?
Thank you.

@nginyc
Copy link
Owner

nginyc commented Jul 16, 2019

Yes, there is currently no GPU support when the trained model is deployed for inference on Rafiki. Currently, it is expected that models can always fallback to using CPU. Is there a workaround for your model? @nudles should we support using GPU for inference as well?

@nudles
Copy link
Collaborator

nudles commented Jul 17, 2019 via email

@nginyc
Copy link
Owner

nginyc commented Jul 17, 2019

Shouldn't be that difficult. Will add as a task

@nginyc nginyc added the enhancement New feature or request label Jul 17, 2019
@nginyc nginyc self-assigned this Jul 17, 2019
@nginyc
Copy link
Owner

nginyc commented Jul 29, 2019

Hi @vivansxu, we've recently added this functionality on the branch add_gpu_for_inference! Let us know if it works for you. Refer to the documentation on testing latest code changes to verify the changes since it's not on the master branch

@vivansxu
Copy link
Author

Hi @nginyc, thank you so much for adding GPU support! I just tried to run the inference job, and it works well!

By the way, since I want to return a list of strings as prediction, I changed line 64 of rafiki/predictor/ensemble.py from:
if isinstance(prediction, Iterable):
to:
if isinstance(prediction, list):

@nudles
Copy link
Collaborator

nudles commented Jul 30, 2019

I think iterable is more general than list.
a list is also an Iterable instance.
If no other problems, I am going to merge the PR into the dev branch.

@vivansxu
Copy link
Author

Hi @nudles, actually if just using Iterable here, since a string object is always iterable(explain at the end), there would be a RecursionError: maximum recursion depth exceeded in comparison

If I run:

for x in ('abc'):
print(isinstance(x, Iterable))

The output would be:
True
True
True

@nginyc
Copy link
Owner

nginyc commented Jul 30, 2019

Hi @vivansxu
Thanks for the catch. I have a fix for this bug in #132, which is pending to be merged into dev.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants