From 0ec8d85aba1d30c1c53781b90fb18707c005a225 Mon Sep 17 00:00:00 2001 From: Mergen Nachin Date: Fri, 10 Jan 2025 15:42:28 -0500 Subject: [PATCH] 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 --- .ci/docker/requirements-ci.txt | 9 +++------ backends/apple/coreml/scripts/install_requirements.sh | 6 +----- examples/models/llama/install_requirements.sh | 2 -- install_requirements.py | 2 +- pyproject.toml | 7 ++----- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.ci/docker/requirements-ci.txt b/.ci/docker/requirements-ci.txt index c33cc533c0..c9f9b1dd64 100644 --- a/.ci/docker/requirements-ci.txt +++ b/.ci/docker/requirements-ci.txt @@ -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 diff --git a/backends/apple/coreml/scripts/install_requirements.sh b/backends/apple/coreml/scripts/install_requirements.sh index b6a0a18b77..140ba09c70 100755 --- a/backends/apple/coreml/scripts/install_requirements.sh +++ b/backends/apple/coreml/scripts/install_requirements.sh @@ -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." diff --git a/examples/models/llama/install_requirements.sh b/examples/models/llama/install_requirements.sh index 6b6c4ed999..f72d0ea3cc 100755 --- a/examples/models/llama/install_requirements.sh +++ b/examples/models/llama/install_requirements.sh @@ -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 diff --git a/install_requirements.py b/install_requirements.py index b5dbd0dddf..dabf470dcf 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -157,7 +157,7 @@ def python_is_compatible(): "timm==1.0.7", f"torchaudio==2.6.0.{NIGHTLY_VERSION}" if USE_PYTORCH_NIGHTLY else "torchaudio", "torchsr==1.0.4", - "transformers==4.46.1", + "transformers==4.47.1", ] # pip packages needed for development. diff --git a/pyproject.toml b/pyproject.toml index 8b7ee5304b..11673f9c96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",