-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
121a77d
commit df4536b
Showing
6 changed files
with
108 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
MAKE=make | ||
|
||
if [ $# != 0 ]; then | ||
echo "Usage: $0" | ||
exit 1; | ||
fi | ||
|
||
if ! python -c "import packaging.version" &> /dev/null; then | ||
python3 -m pip install packaging | ||
fi | ||
torch_17_plus=$(python3 <<EOF | ||
from packaging.version import parse as V | ||
import torch | ||
if V(torch.__version__) >= V("1.7.0"): | ||
print("true") | ||
else: | ||
print("false") | ||
EOF | ||
) | ||
|
||
python_38_plus=$(python3 <<EOF | ||
from packaging.version import parse as V | ||
import sys | ||
if V("{}.{}.{}".format(*sys.version_info[:3])) >= V("3.8.0"): | ||
print("true") | ||
else: | ||
print("false") | ||
EOF | ||
) | ||
|
||
cuda_version=$(python3 <<EOF | ||
import torch | ||
if torch.cuda.is_available(): | ||
version=torch.version.cuda.split(".") | ||
# 10.1.aa -> 101 | ||
print(version[0] + version[1]) | ||
else: | ||
print("") | ||
EOF | ||
) | ||
echo "cuda_version=${cuda_version}" | ||
|
||
if "${torch_17_plus}" && "${python_38_plus}"; then | ||
python -m pip install loralib | ||
else | ||
echo "[ERROR] lora does not work with pytorch<1.7.0, python<3.8" | ||
fi |