juncongmoo / pyllama

LLaMA: Open and Efficient Foundation Language Models
GNU General Public License v3.0
2.8k stars 312 forks source link

Cannot run on Mac with Python 3.11.3 #81

Open kornhill opened 1 year ago

kornhill commented 1 year ago

python3 -m llama.download --model_size 7B

Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/itree/init.py", line 5, in from . import _itree ImportError: cannot import name '_itree' from partially initialized module 'itree' (most likely due to a circular import) (/opt/homebrew/lib/python3.11/site-packages/itree/init.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 189, in _run_module_as_main File "", line 112, in _get_module_details File "/opt/homebrew/lib/python3.11/site-packages/llama/init.py", line 17, in from .model_single import ModelArgs, Transformer File "/opt/homebrew/lib/python3.11/site-packages/llama/model_single.py", line 7, in import hiq File "/opt/homebrew/lib/python3.11/site-packages/hiq/init.py", line 59, in from .tree import get_duration_from_hiq_string, get_graph_from_string, Tree File "/opt/homebrew/lib/python3.11/site-packages/hiq/tree.py", line 9, in import itree File "/opt/homebrew/lib/python3.11/site-packages/itree/init.py", line 7, in import _itree ImportError: dlopen(/opt/homebrew/lib/python3.11/site-packages/_itree.cpython-311-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.11/site-packages/_itree.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.11/site-packages/_itree.cpython-311-darwin.so' (no such file), '/opt/homebrew/lib/python3.11/site-packages/_itree.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

fivol commented 1 year ago

Same

Traceback (most recent call last): File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/itree/init.py", line 5, in from . import _itree ImportError: cannot import name '_itree' from partially initialized module 'itree' (most likely due to a circular import) (/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/itree/init.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/fiobond/.conda/envs/llama/lib/python3.10/runpy.py", line 187, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/Users/fiobond/.conda/envs/llama/lib/python3.10/runpy.py", line 110, in _get_module_details import(pkg_name) File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/llama/init.py", line 17, in from .model_single import ModelArgs, Transformer File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/llama/model_single.py", line 7, in import hiq File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/hiq/init.py", line 59, in from .tree import get_duration_from_hiq_string, get_graph_from_string, Tree File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/hiq/tree.py", line 9, in import itree File "/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/itree/init.py", line 7, in import _itree ImportError: dlopen(/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/_itree.cpython-310-darwin.so, 0x0002): tried: '/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/_itree.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/_itree.cpython-310-darwin.so' (no such file), '/Users/fiobond/.conda/envs/llama/lib/python3.10/site-packages/_itree.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

dguerri commented 1 year ago

It's a problem with py-itree. This should work:

pip uninstall py-itree
ARCHFLAGS="-arch arm64" pip install https://github.com/juncongmoo/itree/archive/refs/tags/v0.0.18.tar.gz --compile --no-cache-dir

The link is from the py-itree PyPi page

drathi599 commented 1 year ago

This did resolve the error, however, nothing is getting downloaded at least for me.

` python -m llama.download --model_size 7B

❤️ Resume download is supported. You can ctrl-c and rerun the program to resume the downloading Downloading tokenizer... ✅ pyllama_data/tokenizer.model ✅ pyllama_data/tokenizer_checklist.chk Downloading 7B ✅ pyllama_data/7B/params.json ✅ pyllama_data/7B/checklist.chk Checking checksums (base) ➜ vicuna_weights ls pyllama_data (base) ➜ vicuna_weights cd pyllama_data (base) ➜ pyllama_data ls 7B (base) ➜ pyllama_data cd 7B (base) ➜ 7B ls (base) ➜ 7B ls -a -l total 0 drwxr-xr-x 2 drathi 64 Apr 15 11:59 . drwxr-xr-x 3 drathi 96 Apr 15 11:59 .. (base) ➜ 7B`

dguerri commented 1 year ago

This issue should contain the solution to that https://github.com/juncongmoo/pyllama/issues/47

Most probably you need to do:

pip uninstall pyllama git clone https://github.com/juncongmoo/pyllama pip install -e pyllama

Syazvinski commented 1 year ago

Same issue and after following both directions here it didnt error out anymore but now when I try and download I get this. Looks like im in some sort of loop. I could paste more but it just goes on and on.

`❤️ Resume download is supported. You can ctrl-c and rerun the program to resume the downloading Downloading tokenizer... ✅ pyllama_data/tokenizer.model ✅ pyllama_data/tokenizer_checklist.chk

❤️ Resume download is supported. You can ctrl-c and rerun the program to resume the downloading `

kryt commented 1 year ago

After trying everything else, this finally solved it for me: https://github.com/juncongmoo/pyllama/issues/47#issuecomment-1531119077

you have to brew install md5sha1sum for mac m1