-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ModelAngelo to cmake and added weights download attempt during …
…cmake configure time.
- Loading branch information
Showing
4 changed files
with
114 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Get the directory of the currently executing script | ||
script_dir="$(dirname "$0")" | ||
|
||
# Call Class Ranker weight download ############################################## | ||
echo "Attempting to download weights for class ranker..." | ||
|
||
target_path="$script_dir/relion_python_classranker" | ||
|
||
if [ -x "$target_path" ]; then | ||
# Execute the target binary | ||
"$target_path" | ||
else | ||
echo "Error: $target_binary not found or not executable in $script_dir." | ||
exit 1 | ||
fi | ||
|
||
# Call Blush weight download ##################################################### | ||
echo "Attempting to download weights for Blush..." | ||
|
||
target_path="$script_dir/relion_python_blush" | ||
|
||
if [ -x "$target_path" ]; then | ||
# Execute the target binary | ||
"$target_path" | ||
else | ||
echo "Error: $target_binary not found or not executable in $script_dir." | ||
exit 1 | ||
fi | ||
|
||
# ModelAngelo weight download #################################################### | ||
echo "Attempting to download weights for ModelAngelo..." | ||
target_path="$script_dir/relion_python_modelangelo" | ||
|
||
if [ -x "$target_path" ]; then | ||
# Execute the target binary | ||
"$target_path" | ||
else | ||
echo "Error: $target_binary not found or not executable in $script_dir." | ||
exit 1 | ||
fi | ||
|
||
# Exit | ||
exit 0 | ||
|
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
print_error() { | ||
echo " | ||
---------------------------------- PYTHON ERROR --------------------------------- | ||
Has RELION been provided a Python interpreter with the correct environment? | ||
The interpreter can be passed to RELION either during Cmake configuration by | ||
using the Cmake flag -DPYTHON_EXE_PATH=<path/to/python/interpreter>. | ||
NOTE: For some modules TORCH_HOME needs to be set to find pretrained models | ||
--------------------------------------------------------------------------------- | ||
Using python executable: $1 | ||
" | ||
} | ||
|
||
# Set the Python executable path | ||
python_executable="@PYTHON_EXE_PATH@" | ||
torch_home="@TORCH_HOME_PATH@" | ||
|
||
# Check if the python executable exists | ||
if [ ! -x "$python_executable" ]; then | ||
# Check for default python executable | ||
python_executable=$(command -v python) | ||
|
||
if [ -z "$python_executable" ]; then | ||
print_error "$python_executable" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Run the Python script with forwarded arguments | ||
if [ -n "$torch_home" ]; then | ||
TORCH_HOME="$torch_home" "$python_executable" -c "from model_angelo.__main__ import main; exit(main())" "$@" | ||
else | ||
"$python_executable" -c "from model_angelo.__main__ import main; exit(main())" "$@" | ||
fi | ||
|
||
# Check the return status of the python command | ||
if [ $? -ne 0 ]; then | ||
print_error "$python_executable" | ||
exit 2 | ||
fi | ||
|
||
# Exit | ||
exit 0 | ||
|