Skip to content

Commit

Permalink
Upgrade numpy version requirement to 2.0 (#7599)
Browse files Browse the repository at this point in the history
Upgrade numpy version requirement to

Summary:

1.21 is too old now. For 3.10 or above, we should be able to use 2.0.0

We are already on CoreMLTools 8.1, which is https://github.com/apple/coremltools/blob/8.1/reqs/build.pip

We had to upgrade to the latest transformers as well

(cherry picked from commit a7b5297)
  • Loading branch information
mergennachin committed Jan 17, 2025
1 parent 4750927 commit cf65801
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 deletions.
11 changes: 4 additions & 7 deletions .ci/docker/requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
mpmath==1.3.0
numpy==1.21.3; python_version == '3.10'
numpy==1.23.2; python_version == '3.11'
numpy; python_version >= '3.12'
numpy==2.0.0; python_version >= '3.10'
PyYAML==6.0.1
ruamel.yaml==0.17.32
sympy==1.12
timm==0.6.13
tomli==2.0.1
torchsr==1.0.4
transformers==4.38.0
transformers==4.47.1
zstd==1.5.5.1
pandas==2.0.3; python_version == '3.10'
pandas; python_version >= '3.11'
pandas==2.2.2; python_version >= '3.10'
pytest==7.2.0
pytest-cov==4.1.0
expecttest==0.1.6
Expand All @@ -24,7 +21,7 @@ sphinx-gallery==0.14.0
breathe==4.34.0
exhale==0.2.3
docutils==0.16
matplotlib==3.7.2
matplotlib==3.9.4
# PyTorch Theme
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
myst-parser==0.18.1
Expand Down
6 changes: 1 addition & 5 deletions backends/apple/coreml/scripts/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ cmake --build "$COREMLTOOLS_DIR_PATH/build" --parallel

echo "${green}ExecuTorch: Installing coremltools."
pip install "$COREMLTOOLS_DIR_PATH"
# CoreMLTools have started supporting numpy 2.0,
# but ExecuTorch example model test env is still using older transformers,
# so for now we will need to downgrade numpy to 1.x
# TODO: Remove this numpy downgrade once later transformers starts to be used
pip install numpy==1.26.4

STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "${red}ExecuTorch: Failed to install coremltools."
Expand Down
2 changes: 0 additions & 2 deletions examples/models/llama/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pip install snakeviz sentencepiece
# Install tiktoken for tokenizer
pip install lm_eval==0.4.5
pip install tiktoken blobfile
# Restore numpy if >= 2.0
pip install "numpy<2.0"

# Call the install helper for further setup
python examples/models/llama/install_requirement_helper.py
2 changes: 1 addition & 1 deletion install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def python_is_compatible():
"timm==1.0.7",
"torchaudio==2.6.0" if USE_PYTORCH_NIGHTLY else "torchaudio",
"torchsr==1.0.4",
"transformers==4.46.1",
"transformers==4.47.1",
]

# pip packages needed for development.
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ dependencies=[
"flatbuffers",
"hypothesis",
"mpmath==1.3.0",
"numpy==1.21.3; python_version == '3.10'",
"numpy==1.23.2; python_version == '3.11'",
"numpy; python_version >= '3.12'",
"numpy==2.0.0; python_version >= '3.10'",
"packaging",
"pandas==2.0.3; python_version == '3.10'",
"pandas; python_version >= '3.11'",
"pandas==2.2.2; python_version >= '3.10'",
"parameterized",
"pytest",
"pytest-xdist",
Expand Down
2 changes: 1 addition & 1 deletion third-party/pybind11
Submodule pybind11 updated 189 files

0 comments on commit cf65801

Please sign in to comment.