Skip to content

Commit

Permalink
Enforce "compatible release" syntax instead of ==
Browse files Browse the repository at this point in the history
  • Loading branch information
crasm committed Dec 23, 2023
1 parent dc209c0 commit 91f318c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
20 changes: 11 additions & 9 deletions check-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements-convert-hf-to-gguf.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-r ./requirements-convert.txt
torch==2.1.1
transformers==4.35.2
torch~=2.1.1
transformers~=4.35.2
2 changes: 1 addition & 1 deletion requirements/requirements-convert-lora-to-ggml.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r ./requirements-convert.txt
torch==2.1.1
torch~=2.1.1
2 changes: 1 addition & 1 deletion requirements/requirements-convert-persimmon-to-gguf.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r ./requirements-convert.txt
torch==2.1.1
torch~=2.1.1
4 changes: 2 additions & 2 deletions requirements/requirements-convert.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 91f318c

Please sign in to comment.