mlx-examples
mlx-examples copied to clipboard
Lora example's `convert.py` throws `TypeError` because of `tuple[mx.array, mx.array]`
Description
I ran the following and observed an error
- Created a new condo env
conda create -q -n mlx-examples python=3.8
conda activate mlx-examples
- Ran pip install from lora dir
pip install -r requirements.txt(from..../mlx-examples/lora) - Ran
convert.pyasconvert.py --hf-path mistralai/Mistral-7B-v0.1 -q - Observed the error
↪ python convert.py --hf-path mistralai/Mistral-7B-v0.1 -q (mlx-examples)
Traceback (most recent call last):
File "convert.py", line 8, in <module>
import utils
File "/Users/aditya_d/projects/mlx-examples/lora/utils.py", line 13, in <module>
import models.phi2 as phi2
File "/Users/aditya_d/projects/mlx-examples/lora/models/phi2.py", line 120, in <module>
class Model(nn.Module):
File "/Users/aditya_d/projects/mlx-examples/lora/models/phi2.py", line 131, in Model
) -> tuple[mx.array, mx.array]:
TypeError: 'type' object is not subscriptable
Seems like I need to use python 3.9 or newer? https://stackoverflow.com/questions/41535881/how-do-i-upgrade-to-python-3-6-with-conda
I upgraded my python env and that got sufficed for me.
I'll leave this issue open for mlx owners to decide best path forward. It seems like mlx may consider prescribing a python version for the lora example, or edit the convert.py script to be robust to slight version differences.
Hope this helps; else please pardon opening a nit/minor issue :)