xformers icon indicating copy to clipboard operation
xformers copied to clipboard

importing `xformers.ops` implicitly initializes CUDA context

Open function2-llx opened this issue 2 months ago • 3 comments

Currently, importing xformers.ops will implicitly initializes CUDA context. This has an unpleasant effect that we cannot use the "fork" multi-processing method.

The line of code that initializes CUDA context is as follows:

https://github.com/facebookresearch/xformers/blob/f6637120b58c4b3626b18234f8c0c74c561b8d01/xformers/init.py#L52

function2-llx avatar Apr 20 '24 13:04 function2-llx