Skip to content

Commit

Permalink
Change LooseVersion to parse
Browse files Browse the repository at this point in the history
  • Loading branch information
kamo-naoyuki committed May 12, 2022
1 parent d234b9a commit b7cfdd9
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions tools/installers/install_chainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ python_version=$(python3 -c "import sys; print(sys.version.split()[0])")
cuda_version_without_dot="${cuda_version/\./}"
python_plus(){
python3 <<EOF
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$python_version') >= L('$1'):
print("true")
else:
Expand All @@ -31,7 +31,7 @@ EOF
}
cuda_plus(){
python3 <<EOF
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$cuda_version') >= L('$1'):
print("true")
else:
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_fairscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

torch_version=$(python3 -c "import torch; print(torch.__version__)")
python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand All @@ -22,7 +22,7 @@ EOF
pt_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_fairseq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

torch_version=$(python3 -c "import torch; print(torch.__version__)")
python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand All @@ -22,7 +22,7 @@ EOF
pt_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand Down
6 changes: 3 additions & 3 deletions tools/installers/install_k2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi


python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand Down Expand Up @@ -64,7 +64,7 @@ libc_version="$(${libc_path} | grep "GNU C Library" | grep -oP "version [0-9]*.[
pytorch_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand All @@ -74,7 +74,7 @@ EOF
libc_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$libc_version') >= L('$1'):
print("true")
else:
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_longformer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

torch_version=$(python3 -c "import torch; print(torch.__version__)")
python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand All @@ -21,7 +21,7 @@ EOF
pt_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_s3prl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [ $# != 0 ]; then
fi

torch_17_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import torch
if V(torch.__version__) >= V("1.7"):
Expand All @@ -21,7 +21,7 @@ EOF
)

python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand Down
2 changes: 1 addition & 1 deletion tools/installers/install_speechbrain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $# != 0 ]; then
fi

torch_18_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import torch
if V(torch.__version__) >= V("1.8"):
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_torch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cuda_version_without_dot="${cuda_version/\./}"

python_plus(){
python3 <<EOF
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$python_version') >= L('$1'):
print("true")
else:
Expand All @@ -38,7 +38,7 @@ EOF
}
pytorch_plus(){
python3 <<EOF
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand Down
4 changes: 2 additions & 2 deletions tools/installers/install_torch_optimizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

torch_version=$(python3 -c "import torch; print(torch.__version__)")
python_36_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import sys
if V(sys.version) >= V("3.6"):
Expand All @@ -22,7 +22,7 @@ EOF
pt_plus(){
python3 <<EOF
import sys
from distutils.version import LooseVersion as L
from packaging.version import parse as L
if L('$torch_version') >= L('$1'):
print("true")
else:
Expand Down
6 changes: 3 additions & 3 deletions tools/installers/install_warp-ctc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ $# != 0 ]; then
fi

torch_17_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import torch
if V(torch.__version__) >= V("1.7"):
Expand All @@ -20,7 +20,7 @@ EOF
)

torch_11_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import torch
if V(torch.__version__) >= V("1.1"):
Expand All @@ -31,7 +31,7 @@ EOF
)

torch_10_plus=$(python3 <<EOF
from distutils.version import LooseVersion as V
from packaging.version import parse as V
import torch
if V(torch.__version__) >= V("1.0"):
Expand Down
2 changes: 1 addition & 1 deletion tools/installers/install_warp-transducer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi
# TODO(kamo): Consider clang case
# Note: Requires gcc>=4.9.2 to build extensions with pytorch>=1.0
if python3 -c 'import torch as t;assert t.__version__[0] == "1"' &> /dev/null; then \
python3 -c "from distutils.version import LooseVersion as V;assert V('$(gcc -dumpversion)') >= V('4.9.2'), 'Requires gcc>=4.9.2'"; \
python3 -c "from packaging.version import parse as V;assert V('$(gcc -dumpversion)') >= V('4.9.2'), 'Requires gcc>=4.9.2'"; \
fi

rm -rf warp-transducer
Expand Down

0 comments on commit b7cfdd9

Please sign in to comment.