-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from scipion-em/devel
release 3.1
- Loading branch information
Showing
15 changed files
with
227 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# Python compilation files | ||
*.pyc | ||
|
||
# Ignore temporary packaging folder | ||
*.egg-info | ||
|
||
# IDE files | ||
#### Eclipse and so on | ||
.project | ||
.cproject | ||
.pydevproject | ||
.classpath | ||
.idea | ||
|
||
#### Python | ||
build/ | ||
dist/ | ||
*.egg-info/ | ||
*.egg | ||
*.py[cod] | ||
__pycache__/ | ||
*.so | ||
*~ |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
3.0.1 | ||
----- | ||
- Installation does not fail but is never complete. So installb modelangelo will git pull all the time. | ||
3.1: | ||
- update installation | ||
- create constants | ||
- add MODEL_ANGELO_CUDA_LIB | ||
3.0.1: Installation does not fail but is never complete. So installb modelangelo will git pull all the time. |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
include *.txt | ||
include *.rst | ||
include LICENSE | ||
include LICENSE | ||
include modelangelo/protocols.conf | ||
include modelangelo/logo.jpeg |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# * | ||
# * This program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 2 of the License, or | ||
# * the Free Software Foundation; either version 3 of the License, or | ||
# * (at your option) any later version. | ||
# * | ||
# * This program is distributed in the hope that it will be useful, | ||
|
@@ -23,29 +23,18 @@ | |
# * e-mail address '[email protected]' | ||
# * | ||
# ************************************************************************** | ||
import datetime | ||
from datetime import datetime as dt | ||
import os | ||
|
||
import pwem | ||
import pyworkflow | ||
from pyworkflow.utils import runJob | ||
import pyworkflow.utils as pwutils | ||
from scipion.install.funcs import VOID_TGZ | ||
|
||
__version__ = "3.0.3" | ||
_logo = "icon.jpeg" | ||
_references = ['mabioarxive'] | ||
from .constants import * | ||
|
||
# TODO: move to constants | ||
MA_VERSION = 'git' | ||
# Use this variable to activate an environment from the Scipion conda | ||
MODEL_ANGELO_ENV_ACTIVATION_VAR = "MODEL_ANGELO_ENV_ACTIVATION" | ||
# Use this general activation variable when installed outside Scipion | ||
MODEL_ANGELO_ACTIVATION_VAR = "MODEL_ANGELO_ACTIVATION" | ||
|
||
# models | ||
MODELS_VERSION = '0.1' | ||
MODELS_PKG_NAME = 'modelangelomodels' | ||
TORCH_HOME_VAR = 'TORCH_HOME' | ||
__version__ = "3.1" | ||
_logo = "logo.jpeg" | ||
_references = ['jamali2023'] | ||
|
||
|
||
class Plugin(pwem.Plugin): | ||
|
@@ -55,9 +44,10 @@ def _defineVariables(cls): | |
cls._defineVar(MODEL_ANGELO_ACTIVATION_VAR, '') | ||
cls._defineVar(MODEL_ANGELO_ENV_ACTIVATION_VAR, cls.getActivationCmd(MA_VERSION)) | ||
cls._defineEmVar(TORCH_HOME_VAR, MODELS_PKG_NAME + "-" + MODELS_VERSION) | ||
cls._defineVar(MODEL_ANGELO_CUDA_LIB, pwem.Config.CUDA_LIB) | ||
|
||
@classmethod | ||
def getModelAngeloCmd(cls, *args): | ||
def getModelAngeloCmd(cls): | ||
cmd = cls.getVar(MODEL_ANGELO_ACTIVATION_VAR) | ||
if not cmd: | ||
cmd = cls.getCondaActivationCmd() | ||
|
@@ -67,11 +57,15 @@ def getModelAngeloCmd(cls, *args): | |
|
||
@classmethod | ||
def getEnviron(cls): | ||
environ = pyworkflow.utils.Environ(os.environ) | ||
environ = pwutils.Environ(os.environ) | ||
torch_home = cls.getVar(TORCH_HOME_VAR) | ||
# For GPU, we need to add to LD_LIBRARY_PATH the path to Cuda/lib | ||
environ.set(TORCH_HOME_VAR, torch_home) | ||
|
||
cudaLib = cls.getVar(MODEL_ANGELO_CUDA_LIB) | ||
environ.addLibrary(cudaLib) | ||
|
||
return environ | ||
|
||
@classmethod | ||
def getActivationCmd(cls, version): | ||
return'conda activate modelangelo-' + version | ||
|
@@ -80,14 +74,13 @@ def getActivationCmd(cls, version): | |
def defineBinaries(cls, env): | ||
|
||
def defineModelAngeloInstallation(version): | ||
installed = "last-pull-%s.txt" % dt.now().strftime("%y%h%d-%H%M%S") | ||
|
||
installed = "last-pull-%s.txt" % datetime.datetime.now().strftime("%y%h%d-%H%M%S") | ||
|
||
# For modelangelo | ||
modelangelo_commands = [] | ||
modelangelo_commands.append(('git clone https://github.com/3dem/model-angelo.git', 'model-angelo')) | ||
modelangelo_commands.append((getCondaInstallation(version), 'env-created.txt')) | ||
modelangelo_commands.append(('cd model-angelo && git pull && touch ../%s' % installed, installed)) | ||
modelangelo_commands = [ | ||
('git clone https://github.com/3dem/model-angelo.git', 'model-angelo'), | ||
(getCondaInstallation(version), 'env-created.txt'), | ||
('cd model-angelo && git pull && touch ../%s' % installed, installed) | ||
] | ||
|
||
env.addPackage('modelangelo', version=version, | ||
commands=modelangelo_commands, | ||
|
@@ -96,31 +89,26 @@ def defineModelAngeloInstallation(version): | |
|
||
def getCondaInstallation(version): | ||
installationCmd = cls.getCondaActivationCmd() | ||
installationCmd += 'conda create -y -n modelangelo-' + version + ' python=3.9 && ' | ||
installationCmd += 'conda create -y -n modelangelo-' + version + ' python=3.10 && ' | ||
installationCmd += cls.getActivationCmd(version) + ' && ' | ||
installationCmd += 'cd model-angelo && python -m pip install -r requirements.txt && ' | ||
installationCmd += 'conda install -y pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch && ' | ||
installationCmd += 'python -m pip install -e . && ' | ||
installationCmd += 'conda install -y pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia && ' | ||
installationCmd += 'cd model-angelo && pip install -r requirements.txt && ' | ||
installationCmd += 'pip install -e . && ' | ||
installationCmd += 'touch ../env-created.txt' | ||
|
||
return installationCmd | ||
|
||
# Define model angelo installations | ||
defineModelAngeloInstallation(MA_VERSION) | ||
|
||
# Models download | ||
installationCmd = "" | ||
installationCmd += 'export TORCH_HOME=$PWD && ' | ||
installationCmd += cls.getCondaActivationCmd() + " " + cls.getActivationCmd(MA_VERSION) + ' && ' | ||
installationCmd += cls.getCondaActivationCmd() + " " + cls.getActivationCmd(MA_VERSION) + ' && ' | ||
installationCmd += 'python -m model_angelo.utils.setup_weights --bundle-name original && ' | ||
installationCmd += 'python -m model_angelo.utils.setup_weights --bundle-name original_no_seq' | ||
|
||
|
||
env.addPackage('modelangelomodels', version="0.1", | ||
commands=[(installationCmd,["hub/checkpoints/model_angelo/original_no_seq/success.txt", | ||
"hub/checkpoints/model_angelo/original/success.txt"])], | ||
env.addPackage('modelangelomodels', version=MODELS_VERSION, | ||
commands=[(installationCmd, [f"hub/checkpoints/model_angelo_v{MODELS_VERSION}/original_no_seq/success.txt", | ||
f"hub/checkpoints/model_angelo_v{MODELS_VERSION}/original/success.txt"])], | ||
tar=VOID_TGZ, | ||
default=True) | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
# ************************************************************************** | ||
# * | ||
# * Authors: Roberto Marabini | ||
# * Authors: Grigory Sharov ([email protected]) | ||
# * | ||
# * MRC Laboratory of Molecular Biology (MRC-LMB) | ||
# * | ||
# * This program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 2 of the License, or | ||
# * the Free Software Foundation; either version 3 of the License, or | ||
# * (at your option) any later version. | ||
# * | ||
# * This program is distributed in the hope that it will be useful, | ||
|
@@ -23,3 +23,15 @@ | |
# * e-mail address '[email protected]' | ||
# * | ||
# ************************************************************************** | ||
|
||
MA_VERSION = 'git' | ||
# Use this variable to activate an environment from the Scipion conda | ||
MODEL_ANGELO_ENV_ACTIVATION_VAR = "MODEL_ANGELO_ENV_ACTIVATION" | ||
# Use this general activation variable when installed outside Scipion | ||
MODEL_ANGELO_ACTIVATION_VAR = "MODEL_ANGELO_ACTIVATION" | ||
MODEL_ANGELO_CUDA_LIB = "MODEL_ANGELO_CUDA_LIB" | ||
|
||
# models | ||
MODELS_VERSION = '1.0' | ||
MODELS_PKG_NAME = 'modelangelomodels' | ||
TORCH_HOME_VAR = 'TORCH_HOME' |
File renamed without changes
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 |
---|---|---|
@@ -1,6 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# ************************************************************************** | ||
# Module to declare protocols | ||
# Find documentation here: https://scipion-em.github.io/docs/docs/developer/creating-a-protocol | ||
# ************************************************************************** | ||
from .protocol_model_angelo import ProtModelAngelo | ||
# *************************************************************************** | ||
# * Authors: Roberto Marabini ([email protected]) | ||
# * | ||
# * | ||
# * This program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 3 of the License, or | ||
# * (at your option) any later version. | ||
# * | ||
# * This program is distributed in the hope that it will be useful, | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# * GNU General Public License for more details. | ||
# * | ||
# * You should have received a copy of the GNU General Public License | ||
# * along with this program; if not, write to the Free Software | ||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
# * 02111-1307 USA | ||
# * | ||
# * All comments concerning this program package may be sent to the | ||
# * e-mail address '[email protected]' | ||
# *************************************************************************** | ||
|
||
from .protocol_model_angelo import ProtModelAngelo |
Oops, something went wrong.