KULL-Centre / _2024_cagiada_stability

Apache License 2.0
34 stars 5 forks source link

Notebook getting stuck in installation mode for a long time #2

Open deepsatflow opened 1 month ago

deepsatflow commented 1 month ago

image

hdieckhaus commented 2 weeks ago

I am having the same issue with the Colab notebook. It appears to be stalling on the first pip install of torch-scatter.

My solution:

so the install block looks like this:

#@title <b><font color='#f0e422'>PRELIMINARY OPERATIONS:</font> Install dependencies

#@markdown Run the cell to install all the extra necessaries packages <b>(~1min 30s)</b>, including:
#@markdown - ESM-IF (library and parameters)
#@markdown - Torch libraries: torch-scatter,-sparse,-cluster,spline-conv,-geometric
#@markdown - Python libraries: biopython, biotite

%%time
import os,time,subprocess,re,sys,shutil
from google.colab import files
import torch
import numpy as np
import pandas as pd

def format_pytorch_version(version):
  return version.split('+')[0]

def format_cuda_version(version):
  return 'cu' + version.replace('.', '')

TORCH_version = torch.__version__
TORCH = format_pytorch_version(TORCH_version)
CUDA_version = torch.version.cuda
CUDA = format_cuda_version(CUDA_version)

TORCH='2.3.1'
print('\n', TORCH, '\n', CUDA)
IF_model_name = "esm_if1_gvp4_t16_142M_UR50.pt"

if not os.path.isfile(IF_model_name):
  # download esmfold params
  os.system("apt-get install aria2 -qq")
  os.system(f"aria2c -x 16 https://sid.erda.dk/share_redirect/eIZVVNEd8B --out={IF_model_name} &")

  if not os.path.isfile("finished_install"):
    # install libs
    print("installing libs...")
    # !pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.3.0+cu121.html
    os.system(f"pip install torch-scatter -v -f https://data.pyg.org/whl/torch-{TORCH}+{CUDA}.html")
    os.system(f"pip install torch-sparse -f https://data.pyg.org/whl/torch-{TORCH}+{CUDA}.html")
    os.system(f"pip install torch-cluster -f https://data.pyg.org/whl/torch-{TORCH}+{CUDA}.html")
    os.system(f"pip install torch-spline-conv -f https://data.pyg.org/whl/torch-{TORCH}+{CUDA}.html")
    os.system(f"pip install torch-geometric")
    os.system(f"pip install biopython")
    # os.system(f"pip install biotite")
    os.system(f"pip install biotite==0.41")

    print("installing esmfold...")
    # install esmfold
    os.system(f"pip install git+https://github.com/matteo-cagiada/esm.git")
    os.system("touch finished_install")

    #wait for Params to finish downloading...
    while not os.path.isfile(IF_model_name):
      time.sleep(5)
    if os.path.isfile(f"{IF_model_name}.aria2"):
      print("downloading params...")
    while os.path.isfile(f"{IF_model_name}.aria2"):
      time.sleep(5)

## Verify that pytorch-geometric is correctly installed

import esm

from esm.inverse_folding.util import load_structure, extract_coords_from_structure,CoordBatchConverter
from esm.inverse_folding.multichain_util import extract_coords_from_complex,_concatenate_coords,load_complex_coords

print("importing the model")

model, alphabet = esm.pretrained.load_model_and_alphabet(IF_model_name)
model.eval().cuda().requires_grad_(False)

print("--> Installations succeeded")