Open dennisbader opened 9 months ago
You can also have support for both; for example, Habana does; see, for example:
https://github.com/Lightning-AI/lightning-Habana/blob/0dd25af5b83e6a166b359c2de538075d5feaff88/src/lightning_habana/utils/hpu_distributed.py#L19-L28
If this is welcome PR
issue, I can have a look at it :rabbit:
Hi @Borda,
Sorry for not coming back to you earlier, I think that another user proposer a very similar approach (inspired by the Ray library, in #2432) and I think that it's an elegant way to solve this problem.
I don't know if the other user will have the time to contribute but feel free to open a PR for this if you can.
@Borda For the method in #2432: I like it because it's clean, but multiple imports in the function make it not very easy or clean to return multiple imports - I believe that imports within the function aren't accessible outside unless returned like pl
is. I'm no code whiz, but I think it might be best to use a try-except
or if-elif
block like in your example, unless there's a good way to write that function.
I like the module_available
approach used in that Habana link! Ping if you end up going with an option, I might jump on your branch and give a hand!
At some point
pytorch-lightning
will be deprecated in favor oflightning
. We can start migrating as well.Addresses #2192.