To use the advanced ESMFold notebook, you must install the required libraries and download the model parameters. This process installs esmfold, openfold, and several dependencies like omegaconf, pytorch_lightning, and biopython. It also downloads the esmfold.model file using aria2c.
Note on Colab Limitations: On a Tesla T4 GPU (standard free Colab), the maximum total sequence length is approximately 900 residues.
import os, time
import torch
if not os.path.isfile("esmfold.model"):
os.system("apt-get install aria2 -qq")
os.system("aria2c -q -x 16 https://colabfold.steineggerlab.workers.dev/esm/esmfold.model &")
print("installing libs...")
os.system("pip install -q omegaconf pytorch_lightning biopython ml_collections einops py3Dmol modelcif")
os.system("pip install -q git+https://github.com/NVIDIA/dllogger.git")
print("installing openfold...")
os.system(f"pip install -q git+https://github.com/sokrypton/openfold.git")
print("installing esmfold...")
os.system(f"pip install -q git+https://github.com/sokrypton/esm.git@beta")
if not os.path.isfile("esmfold.model"):
os.system("aria2c -q -x 16 https://files.ipd.uw.edu/pub/esmfold/esmfold.model")
else:
while os.path.isfile("esmfold.model.aria2"):
time.sleep(5)
if "model" not in dir():
model_path = "esmfold.model"
model = torch.load(model_path, weights_only=False)
model.cuda().requires_grad_(False)