From 91f318c228c233cb7737b468c49c701fac3b6b07 Mon Sep 17 00:00:00 2001 From: crasm Date: Sat, 23 Dec 2023 18:27:43 -0500 Subject: [PATCH] Enforce "compatible release" syntax instead of == --- check-requirements.sh | 20 ++++++++++--------- .../requirements-convert-hf-to-gguf.txt | 4 ++-- .../requirements-convert-lora-to-ggml.txt | 2 +- ...requirements-convert-persimmon-to-gguf.txt | 2 +- requirements/requirements-convert.txt | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/check-requirements.sh b/check-requirements.sh index 50a8dad03..ac23b46cb 100755 --- a/check-requirements.sh +++ b/check-requirements.sh @@ -135,18 +135,20 @@ check_convert_script() { python3 -m venv "$venv" check_requirements "$venv" "$reqs" - set +e - ( + + # Because we mask the return value of the subshell, + # we don't need to use set +e/-e. + # shellcheck disable=SC2155 + local py_err=$( # shellcheck source=/dev/null source "$venv/bin/activate" - py_err="$workdir/$pyname.out" - python "$py" 2> "$py_err" - >&2 cat "$py_err" - grep -e 'ModuleNotFoundError' "$py_err" + python "$py" 2>&1 ) - set -e + # shellcheck disable=SC2181 - (( $? )) && fatal "$py: some imports not declared in $reqs" + if grep -Fe 'ModuleNotFoundError' <<< "$py_err"; then + fatal "$py: some imports not declared in $reqs" + fi info "$py: imports OK" } @@ -162,7 +164,7 @@ for req in "$reqs_dir"/*; do # Filters out the ignore string req_no_ignore_eq_eq="$(grep -vF "$ignore_eq_eq" "$req")" if grep -Fe '==' <<< "$req_no_ignore_eq_eq" ; then - fatal "Avoid pinning exact package versions. Use '=~' instead.\nYou can suppress this error by appending the following to the line: \n\t# $ignore_eq_eq" + fatal "Avoid pinning exact package versions. Use '~=' instead.\nYou can suppress this error by appending the following to the line: \n\t# $ignore_eq_eq" fi done diff --git a/requirements/requirements-convert-hf-to-gguf.txt b/requirements/requirements-convert-hf-to-gguf.txt index ddde1431b..0d16e2da9 100644 --- a/requirements/requirements-convert-hf-to-gguf.txt +++ b/requirements/requirements-convert-hf-to-gguf.txt @@ -1,3 +1,3 @@ -r ./requirements-convert.txt -torch==2.1.1 -transformers==4.35.2 +torch~=2.1.1 +transformers~=4.35.2 diff --git a/requirements/requirements-convert-lora-to-ggml.txt b/requirements/requirements-convert-lora-to-ggml.txt index 0605b9816..6ac402610 100644 --- a/requirements/requirements-convert-lora-to-ggml.txt +++ b/requirements/requirements-convert-lora-to-ggml.txt @@ -1,2 +1,2 @@ -r ./requirements-convert.txt -torch==2.1.1 +torch~=2.1.1 diff --git a/requirements/requirements-convert-persimmon-to-gguf.txt b/requirements/requirements-convert-persimmon-to-gguf.txt index 0605b9816..6ac402610 100644 --- a/requirements/requirements-convert-persimmon-to-gguf.txt +++ b/requirements/requirements-convert-persimmon-to-gguf.txt @@ -1,2 +1,2 @@ -r ./requirements-convert.txt -torch==2.1.1 +torch~=2.1.1 diff --git a/requirements/requirements-convert.txt b/requirements/requirements-convert.txt index 1a1162566..09311906f 100644 --- a/requirements/requirements-convert.txt +++ b/requirements/requirements-convert.txt @@ -1,5 +1,5 @@ -numpy==1.24.4 -sentencepiece==0.1.98 +numpy~=1.24.4 +sentencepiece~=0.1.98 transformers>=4.34.0 gguf>=0.1.0 protobuf>=4.21.0