MyNiuuu / MOFA-Video

Official Pytorch implementation for MOFA-Video: Controllable Image Animation via Generative Motion Field Adaptions in Frozen Image-to-Video Diffusion Model.
https://myniuuu.github.io/MOFA_Video
Other
358 stars 22 forks source link

AttributeError: module 'cupy.cuda' has no attribute 'compile_with_cache' #8

Closed howardgriffin closed 2 weeks ago

howardgriffin commented 3 weeks ago

I was using cupy-cuda12, I got this error. Any suggestions?

MyNiuuu commented 3 weeks ago

Hello, it seems that the issue might be due to the deprecation of cupy.cuda.compile_with_cache() in cupy-cuda12. A potential solution to support cupy-cuda12 can be found in this issue.

Based on the issue, you could replace the cuda_launch function here with the following implementation:

@cupy.memoize(for_each_device=True)
def cuda_launch(strKey:str):
    if 'CUDA_HOME' not in os.environ:
        os.environ['CUDA_HOME'] = cupy.cuda.get_cuda_path()
    # end

    return cupy.RawKernel(objCudacache[strKey]['strKernel'], objCudacache[strKey]['strFunction'], tuple(['-I ' + os.environ['CUDA_HOME'], '-I ' + os.environ['CUDA_HOME'] + '/include']))

This code snippet is taken from the latest implementation of softmax-splatting found here.

Alternatively, you can resolve this issue by downgrading cupy to cupy-cuda117.