Skip to content
Open

CLI #65

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion maxsmi/full_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
NB_EPOCHS,
)

if __name__ == "__main__":

def main():

warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -432,3 +434,7 @@
)
results_metrics = results_metrics.to_pickle(f"{folder}/results_metrics.pkl")
logging.info("Script completed. \n \n")


if __name__ == "__main__":
main()
8 changes: 7 additions & 1 deletion maxsmi/full_workflow_earlystopping.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
NB_EPOCHS,
)

if __name__ == "__main__":

def main():

warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -451,3 +453,7 @@
)
results_metrics = results_metrics.to_pickle(f"{folder}/results_metrics.pkl")
logging.info("Script completed. \n \n")


if __name__ == "__main__":
main()
13 changes: 11 additions & 2 deletions maxsmi/prediction_unlabeled_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
From smiles to predictions

"""
from pathlib import Path
import argparse
import logging
import logging.handlers
Expand Down Expand Up @@ -36,7 +37,11 @@
from maxsmi.pytorch_evaluation import out_of_sample_prediction
from maxsmi.utils_optimal_model import retrieve_optimal_model

if __name__ == "__main__":
PATH_MAXSMI = Path(__file__).parent


def main():

warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -170,7 +175,7 @@

(ml_model_name, ml_model) = model_type(ml_model, device, smi_dict, max_length_smi)
logging.info(f"Summary of ml model used for the prediction: {ml_model} ")
file_path = f"maxsmi/prediction_models/{args.task}"
file_path = PATH_MAXSMI / f"prediction_models/{args.task}"
ml_model.load_state_dict(
torch.load(f"{file_path}/model_dict.pth", map_location=device)
)
Expand Down Expand Up @@ -246,3 +251,7 @@

logging.info("Script completed. \n \n")
print(f"Script completed. Output can be found at {folder}/")


if __name__ == "__main__":
main()
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
# Customize MANIFEST.in if the general case does not suit your needs
# Comment out this line to prevent the files from being packaged with your software
include_package_data=True,
entry_points={
"console_scripts": [
"maxsmi = maxsmi.full_workflow:main",
"maxsmi-earlystopping = maxsmi.full_workflow_earlystopping:main",
"maxsmi-pred = maxsmi.prediction_unlabeled_data:main",
]
},
# Allows `setup.py test` to work correctly with pytest
setup_requires=[] + pytest_runner,
# Additional entries you may want simply uncomment the lines you want and fill in the data
Expand Down