Getting mpi4py Error When Trying to Integrate Accelerate

Hi, I’m running into a strange error when I try adding accelerate to my finetuning notebook. I get the error ModuleNotFoundError: No module named ‘mpi4py’ under accelerator.prepare(model, trainer).

Here’s a link to a Colab notebook in which this error is shown. For context, the service I’m experiencing this error on is RunPod.

Thanks in advance.

You need to install mpi4py as mentioned. I recommend doing so via conda as the pip install version can have some issues

Thank you for your response. It turned out that I needed to install a dependency for mpi4py for the pip installation (pip install mpi4py) to succeed! The dependency I installed was libopenmpi-dev.

1 Like