-
Notifications
You must be signed in to change notification settings - Fork 98
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
Allow using a custom Process class #80
Comments
Hey @ShakedDovrat! I do believe we can expose a config option to let users specify which 1. Add the option to all API functionsThe workers are initialized here: pypeln/pypeln/process/worker.py Line 224 in f4160d0
They this is called by the start method here: pypeln/pypeln/process/worker.py Line 131 in f4160d0
To get the information you need to add the worker_class field here: pypeln/pypeln/process/worker.py Lines 54 to 66 in f4160d0
and here: pypeln/pypeln/process/stage.py Lines 15 to 24 in f4160d0
After that you have add this to all public functions that want to use this. 2. Add a context managerThis simplifies a lot of stuff since during with pl.process.config(worker_class=torch.multiprocessing.Process):
# run your pipeline here |
Option 2 sounds way easier to implement but sets all workers to the same class (which I think is probably what you want 99% of the time), the other method is more general but requires the user to specify the class per stage which can be tedious. |
Thank you @cgarciae! I will look into it. |
BTW: you might want to check https://github.com/pytorch/data |
Thank you for creating this great package.
I would like to create a pipeline where some of the stages use PyTorch (with GPU usage). PyTorch cannot access the GPU from inside a
multiprocessing.Process
subprocess. For that reason PyTorch includes atorch.multiprocessing.Process
class which has the same API asmultiprocessing.Process
.I would like the ability to use a custom
Process
class instead of the defaultmultiprocessing.Process
, so I can use PyTorch in the pipeline. Without it I'm afraid pypeln is unusable to me.For instance, add an optional
process_class
arguement tomap
(and other functions) with a default valuemultiprocessing.Process
.Alternatively, maybe there's a walkaround for what I need that I'm unaware of. In that case, please let me know.
The text was updated successfully, but these errors were encountered: