juncongmoo/pyllama

Cannot run on Mac with Python 3.11.3

kornhill opened this issue ยท 6 comments

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

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'))

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

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`

This issue should contain the solution to that #47

Most probably you need to do:

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

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

After trying everything else, this finally solved it for me:
#47 (comment)

you have to brew install md5sha1sum for mac m1