ESMFold-Sapelo2

From Research Computing Center Wiki
Jump to navigation Jump to search


Category

Bioinformatics

Program On

Sapelo2

Version

20260825 (based on the last set of updates, made August 1, 2024)

Author / Distributor

Please see https://github.com/facebookresearch/ESM#esmfold

Description

From https://github.com/facebookresearch/ESM: "Evolutionary Scale Modeling (esm): Pretrained language models for proteins"

Running Program

Also refer to Running Jobs on Sapelo2

  • Version 20260825

This version is installed as a singularity container:

/apps/singularity-images/esmfold-20260825.sif

The primary command is "esm-fold" and you can view the documentation for this with the following command, in an interactive job (i.e., NOT a login/submit node, where Singularity does not work):

singularity exec /apps/singularity-images/esmfold-20260825.sif esm-fold --help



Note that ESMFold is GPU dependent but, unlike AlphaFold and other protein structure prediction pipelines, is not CPU intensive because it does not depend on multiple sequence alignments (MSAs) for the prediction process. This means that you will need to request only a few CPUs for your job. However, for most proteins, it will only run on the A100 and H100 nodes (it has been tested on the L4 nodes but only for fairly small proteins). Unfortunately, unlike with AlphaFold 3, unified memory is not available for ESMFold, which places a firm upper limit on the size of protein that can be modeled; to date, the largest complex observed to run successfully was 2,547 amino acids long (the human protein talin-1), and this required the use of the "--chunk-size" flag to reduce memory usage. Also, be aware that ESMFold expects the input file to be FASTA formatted, not JSON formatted like AlphaFold 3 and others, and that it will use whatever is in the FASTA header to name the output PDB file for that particular sequence (there does not appear to be a way to work around this).


Note that while ESMFold doesn't depend on any database files, it does depend on a set of model files, which you must download for yourself because the software expects them to be in a user-writable directory. The directory containing model files must be included with the '-B' or "--bind" option at runtime, as must the location of the input file and output directory (see example below).

Sample job submission script (including the model download with the '-m' option, which only needs to be run once):

#!/bin/bash
#SBATCH --job-name=ESMFold			#Name your job something original
#SBATCH --partition=gpu_p			#Use the GPU partition
#SBATCH --ntasks=1		
#SBATCH --cpus-per-task=2			#Because there's no MSA step, CPU usage is minimal
#SBATCH --gres=gpu:1				#If you don’t care whether your job uses an A100 node or an H100 node (and there isn’t much difference in run time)…
#SBATCH --constraint=Milan|SapphireRapids	#…this is the easiest way to specify either one without accidentally using an L4, which has less device memory
#SBATCH --mem=60gb
#SBATCH --time=1:00:00				#Most runs will be extremely quick		
#SBATCH --output=%x.%j.out     
#SBATCH --error=%x.%j.err          

cd $SLURM_SUBMIT_DIR

#Note that the "-m" option only needs to be included the very first time you run ESMFold,
#after which the model files will be downloaded and you can simply re-use them (this is
#the point of the "--env TORCH_HOME=/root/esm_models" part); it is recommended that you
#specify a path in your /home directory for safe keeping.

singularity exec \
     --nv \
     --bind /Path/to/input/file:/root/esm_input \
     --bind /Path/to/output_directory:/root/esm_output \
     --bind /Path/to/models_directory:/root/esm_models \
     --env TORCH_HOME=/root/esm_models \
     /apps/singularity-images/esmfold-20260825.sif esm-fold \
     -i /root/esm_input/NAME_OF_INPUT_FILE.fasta \
     -o /root/esm_output \
     -m /root/esm_models

Documentation

Details and references are at: https://github.com/facebookresearch/ESM#esmfold

Version 20260825: Full help options

$ singularity exec /apps/singularity-images/esmfold-20260825.sif esm-fold --help
usage: esm-fold [-h] -i FASTA -o PDB [-m MODEL_DIR] [--num-recycles NUM_RECYCLES] [--max-tokens-per-batch MAX_TOKENS_PER_BATCH] [--chunk-size CHUNK_SIZE]

optional arguments:
  -h, --help            show this help message and exit
  -i FASTA, --fasta FASTA
                        Path to input FASTA file
  -o PDB, --pdb PDB     Path to output PDB directory
  -m MODEL_DIR, --model-dir MODEL_DIR
                        Parent path to Pretrained ESM data directory.
  --num-recycles NUM_RECYCLES
                        Number of recycles to run. Defaults to number used in training (4).
  --max-tokens-per-batch MAX_TOKENS_PER_BATCH
                        Maximum number of tokens per gpu forward-pass. This will group shorter sequences together for batched prediction. Lowering this can help with out of memory issues, if these occur on short sequences.
  --chunk-size CHUNK_SIZE
                        Chunks axial attention computation to reduce memory usage from O(L^2) to O(L). Equivalent to running a for loop over chunks of of each dimension. Lower values will result in lower memory usage at the cost of speed. Recommended values: 128, 64,
                        32. Default: None.

Back to Top