ml-explore / mlx-examples

Examples in the MLX framework
MIT License
6.18k stars 876 forks source link

AttributeError: module 'mlx.core.metal' has no attribute 'get_peak_memory' #554

Closed USMCM1A1 closed 8 months ago

USMCM1A1 commented 8 months ago

I updated my mlx-examples repo today and now when I try and use python txt2image.py I get the error: module 'mlx.core.metal' has no attribute 'get_peak_memory'

awni commented 8 months ago

Try updating MLX as well! pip install -U mlx.

USMCM1A1 commented 8 months ago

Requirement already satisfied: mlx in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (0.6.0)

awni commented 8 months ago

You still see the issue with 0.6? Can you do:

python -c "import mlx.core as mx; print(mx.__version__)"

It's possible your pip and python are diverged.. you have to make sure you are picking up the right version of mlx when you run the examples.

USMCM1A1 commented 8 months ago

0.0.9 Not sure what that means exactly :)

If it's helpful: (base) Williams-MBP-3:mlx-examples williammarcellino$ pip3 --version pip 24.0 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9) (base) Williams-MBP-3:mlx-examples williammarcellino$ python --version Python 3.11.5

awni commented 8 months ago

So pip has to use the right python otherwise it will install packages in the wrong place. A way to make sure that happens is:

python -m pip install -U mlx

That should give you the right mlx for whichever python you get when you do python ....

USMCM1A1 commented 8 months ago

Yes, thank you!