meta-llama / llama

Inference code for Llama models
Other
56.34k stars 9.56k forks source link

Unable to run example.py #98

Open jessebikman opened 1 year ago

jessebikman commented 1 year ago

I am running torchrun --nproc_per_node 1 example.py --ckpt_dir ./7B/ --tokenizer_path ./tokenizer.model

and my output is

NOTE: Redirects are currently not supported in Windows or MacOs.
Traceback (most recent call last):
  File "/opt/homebrew/bin/torchrun", line 33, in <module>
    sys.exit(load_entry_point('torch==1.13.0a0+git49444c3', 'console_scripts', 'torchrun')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/run.py", line 762, in main
    run(args)
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/run.py", line 753, in run
    elastic_launch(
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 237, in launch_agent
    result = agent.run()
             ^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/metrics/api.py", line 129, in wrapper
    result = f(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/agent/server/api.py", line 709, in run
    result = self._invoke_run(role)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/agent/server/api.py", line 844, in _invoke_run
    self._initialize_workers(self._worker_group)
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/metrics/api.py", line 129, in wrapper
    result = f(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/agent/server/api.py", line 681, in _initialize_workers
    worker_ids = self._start_workers(worker_group)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/metrics/api.py", line 129, in wrapper
    result = f(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/agent/server/local_elastic_agent.py", line 271, in _start_workers
    self._pcontext = start_processes(
                     ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/multiprocessing/__init__.py", line 207, in start_processes
    redirs = to_map(redirects, nprocs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/torch/distributed/elastic/multiprocessing/api.py", line 162, in to_map
    map[i] = val_or_map.get(i, Std.NONE)
             ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
(base)

Any idea what's happening here?

dondaha commented 1 year ago

In Windows, I met the same problem.But in Ubuntu, it's okay.

neuhaus commented 1 year ago

You need to provide more information about your OS, python, the libraries and their versions and your GPU.

jessebikman commented 1 year ago

@neuhaus Thank you for suggesting that. Here is the information:

MacOS Ventura 13.2.1 (22D68) with M1 Pro, 16 core GPU, 16 GB RAM

Python 3.11.2

Here's my output from pip list

Package                            Version
---------------------------------- ---------------
alabaster                          0.7.12
anaconda-client                    1.7.2
anaconda-navigator                 1.9.6
anaconda-project                   0.8.2
appnope                            0.1.0
appscript                          1.0.1
asn1crypto                         0.24.0
astroid                            2.1.0
astropy                            3.1
atomicwrites                       1.2.1
attrs                              18.2.0
Babel                              2.6.0
backcall                           0.1.0
backports.os                       0.1.1
backports.shutil-get-terminal-size 1.0.0
beautifulsoup4                     4.6.3
bitarray                           0.8.3
bkcharts                           0.2
blaze                              0.11.3
bleach                             3.0.2
bokeh                              1.0.2
boto                               2.49.0
Bottleneck                         1.2.1
certifi                            2022.12.7
cffi                               1.11.5
chardet                            3.0.4
Click                              7.0
cloudpickle                        0.6.1
clyent                             1.2.2
colorama                           0.4.1
conda                              23.1.0
conda-build                        3.23.3
conda-package-handling             2.0.2
conda_package_streaming            0.7.0
conda-verify                       3.1.1
contextlib2                        0.5.5
cryptography                       2.4.2
cycler                             0.10.0
Cython                             0.29.2
cytoolz                            0.9.0.1
dask                               1.0.0
datashape                          0.5.4
decorator                          4.3.0
defusedxml                         0.5.0
distributed                        1.25.1
docutils                           0.14
entrypoints                        0.2.3
et-xmlfile                         1.0.1
fairscale                          0.4.6
fastcache                          1.0.2
filelock                           3.0.10
fire                               0.5.0
Flask                              1.0.2
Flask-Cors                         3.0.7
flit_core                          3.6.0
fsspec                             2022.11.0
future                             0.17.1
gevent                             1.3.7
glob2                              0.6
gmpy2                              2.0.8
greenlet                           0.4.15
h5py                               2.8.0
heapdict                           1.0.0
html5lib                           1.0.1
idna                               2.8
imageio                            2.4.1
imagesize                          1.1.0
importlib-metadata                 6.0.0
ipykernel                          5.1.0
ipython                            7.2.0
ipython_genutils                   0.2.0
ipywidgets                         7.4.2
isort                              4.3.4
itsdangerous                       1.1.0
jdcal                              1.4
jedi                               0.13.2
Jinja2                             2.10
joblib                             1.1.1
json5                              0.9.6
jsonschema                         2.6.0
jupyter                            1.0.0
jupyter-client                     5.2.4
jupyter-console                    6.0.0
jupyter-core                       4.4.0
jupyterlab                         0.35.3
jupyterlab-server                  0.2.0
keyring                            17.0.0
kiwisolver                         1.0.1
lazy-object-proxy                  1.3.1
libarchive-c                       2.8
lief                               0.9.0
llvmlite                           0.26.0
locket                             0.2.0
lxml                               4.2.5
MarkupSafe                         1.1.0
matplotlib                         3.0.2
mccabe                             0.6.1
mistune                            0.8.4
mkl-fft                            1.0.6
mkl-random                         1.0.2
mkl-service                        2.3.0
mock                               4.0.3
more-itertools                     4.3.0
mpmath                             1.1.0
msgpack                            0.5.6
multipledispatch                   0.6.0
navigator-updater                  0.2.1
nbconvert                          5.4.0
nbformat                           4.4.0
networkx                           2.2
nltk                               3.4
nose                               1.3.7
notebook                           5.7.4
numba                              0.41.0
numexpr                            2.6.8
numpy                              1.19.2
numpydoc                           0.8.0
odo                                0.5.1
olefile                            0.46
openpyxl                           2.5.12
packaging                          18.0
pandas                             0.23.4
pandocfilters                      1.4.2
parso                              0.3.1
partd                              0.3.9
path.py                            11.5.0
pathlib2                           2.3.3
patsy                              0.5.1
pep8                               1.7.1
pexpect                            4.6.0
pickleshare                        0.7.5
Pillow                             5.3.0
pip                                23.0.1
pkginfo                            1.4.2
pluggy                             1.0.0
ply                                3.11
prometheus-client                  0.5.0
prompt-toolkit                     2.0.7
psutil                             5.4.8
ptyprocess                         0.6.0
py                                 1.7.0
pycodestyle                        2.4.0
pycosat                            0.6.3
pycparser                          2.19
pycrypto                           2.6.1
pycurl                             7.43.0.2
pyflakes                           2.0.0
Pygments                           2.3.1
pylint                             2.2.2
pyodbc                             4.0.25
pyOpenSSL                          18.0.0
pyparsing                          2.3.0
pyrsistent                         0.18.0
PySocks                            1.6.8
pytest                             4.0.2
pytest-arraydiff                   0.3
pytest-astropy                     0.5.0
pytest-doctestplus                 0.2.0
pytest-openfiles                   0.3.1
pytest-remotedata                  0.3.1
python-dateutil                    2.7.5
pytz                               2018.7
PyWavelets                         1.0.1
PyYAML                             3.13
pyzmq                              17.1.2
QtAwesome                          0.5.3
qtconsole                          4.4.3
QtPy                               1.5.2
requests                           2.21.0
rope                               0.11.0
ruamel.yaml                        0.17.21
ruamel_yaml                        0.15.46
ruamel.yaml.clib                   0.2.6
scikit-image                       0.14.1
scikit-learn                       0.20.1
scipy                              1.1.0
seaborn                            0.9.0
Send2Trash                         1.5.0
sentencepiece                      0.1.97
setuptools                         67.4.0
simplegeneric                      0.8.1
singledispatch                     3.4.0.3
six                                1.12.0
snowballstemmer                    1.2.1
sortedcollections                  1.0.1
sortedcontainers                   2.1.0
soupsieve                          2.3.2.post1
Sphinx                             1.8.2
sphinxcontrib-applehelp            1.0.2
sphinxcontrib-devhelp              1.0.2
sphinxcontrib-htmlhelp             2.0.0
sphinxcontrib-jsmath               1.0.1
sphinxcontrib-qthelp               1.0.3
sphinxcontrib-serializinghtml      1.1.5
sphinxcontrib-websupport           1.1.0
spyder                             3.3.2
spyder-kernels                     0.3.0
SQLAlchemy                         1.2.15
statsmodels                        0.9.0
sympy                              1.3
tables                             3.4.4
tblib                              1.3.2
termcolor                          2.2.0
terminado                          0.8.1
testpath                           0.4.2
toml                               0.10.2
toolz                              0.9.0
torch                              1.13.1
torchaudio                         0.7.0a0+a853dff
torchvision                        0.8.2
tornado                            5.1.1
tqdm                               4.28.1
traitlets                          4.3.2
typing_extensions                  4.5.0
unicodecsv                         0.14.1
urllib3                            1.24.1
wcwidth                            0.1.7
webencodings                       0.5.1
Werkzeug                           1.0.1
wheel                              0.32.3
widgetsnbextension                 3.4.2
wrapt                              1.10.11
wurlitzer                          1.0.2
xlrd                               1.2.0
XlsxWriter                         1.1.2
xlwings                            0.15.1
xlwt                               1.3.0
zict                               0.1.3
zipp                               3.15.0
zstandard                          0.19.0
yoroshikun commented 1 year ago

Same issue, bumping 👍 Macosx, Monterey, M1Pro 32gb

yoroshikun commented 1 year ago

To avoid this issue, downgrade python. try 3.7~ (use a version manager like asdf, rtx). then make sure to install the requirements using the command.

yadongwang110 commented 1 year ago

the same quesiton

piyushmutha commented 1 year ago

any solution found? I'm facing the same issue in Windows

amitsangani commented 1 year ago

Are you still seeing this issue on Llama 2?

arferreira commented 1 year ago

Same here, I am using a MacBook M1, I will try to downgrade my python to 3.7 to see.