### Install PaddleHelix using pip Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/readme.md Installs the PaddleHelix library directly using pip. This is the quickest way to get started with the library. Ensure you have Python 3.6+ and the required dependencies like PaddlePaddle and pgl installed. ```console pip install paddlehelix ``` -------------------------------- ### Example: Multi-Node, Multi-GPU Initial Training Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Shows how to start initial training across eight nodes and sixty-four GPUs using the 'demo_initial_N8C64' mode in the 'gpu_train.sh' script. ```bash sh gpu_train.sh demo_initial_N8C64 ``` -------------------------------- ### Install PaddleHelix from Source Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/readme.md Installs the PaddleHelix library from its GitHub repository. This method is useful for developers who want to use the latest unreleased features or contribute to the project. It requires Git to be installed. ```console pip install --upgrade git+https://github.com/PaddlePaddle/PaddleHelix.git ``` -------------------------------- ### Install PaddleHelix using Pip (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Installs the PaddleHelix library using pip. This is the final step in the installation process, assuming all prerequisites and dependencies are met. ```console $ pip install paddlehelix ``` -------------------------------- ### Pretraining Example: Transformer Model Training Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This bash script provides a complete example for pretraining a Transformer model. It sets up model type, task, configuration, data paths, and then executes the training script. It requires the PYTHONPATH to be set correctly. ```bash #!/bin/bash model_type="transformer" # candidate model_types: transformer, lstm, resnet task="secondary_structure" # candidate tasks: pfam, secondary_structure, remote_homology, fluorescence, stability model_config="./configs/${model_type}_${task}_config.json" train_data="./secondary_structure_toy_data/" valid_data="./secondary_structure_toy_data/" export PYTHONPATH="../../../" python train.py \ --train_data ${train_data} \ --valid_data ${valid_data} \ --model_config ${model_config} \ ``` -------------------------------- ### Start Model Training (Shell) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial_cn.ipynb This shell command initiates the training process for a regression model using the 'train_reg.py' script. It specifies the number of epochs to train for (10) and directs the execution to use GPU device 5. This is a common way to launch training jobs in a distributed or GPU-accelerated environment. ```shell !CUDA_VISIBLE_DEVICES='5' python train_reg.py --epochs 10 ``` -------------------------------- ### Install PGL using Pip (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Installs the PGL (Paddle Graph Learning) library using pip. PGL is a dependency for PaddleHelix and is installed after paddlepaddle. ```console $ pip install pgl ``` -------------------------------- ### Warm Start / Finetune Model Training with init_model Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This snippet demonstrates how to initialize a model or finetune supervised tasks during training using the `--init_model` parameter. It specifies the directory for initialization and the hot start type. ```bash python train.py \ ... \ --init_model ./init_model # Directory of the initialization model. If this parameter is unset, the model is randomly initialized. \ --hot_start "hot_start" # init_model for "hot_start" or "finetune" \ ... ``` -------------------------------- ### Install Requirements from requirement.txt Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial.ipynb Installs all necessary Python packages listed in the 'requirement.txt' file. This is a crucial first step before running any code in the project. It ensures all dependencies are met. ```python file1 = open("requirement.txt","r") file1.read().splitlines() ``` -------------------------------- ### Install PaddlePaddle and Dependencies Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Installs the PaddlePaddle 'dev' package and other necessary dependencies using a setup script. It involves downloading a specific PaddlePaddle wheel file and then executing the 'setup_env' script to create and activate a conda environment. ```bash wget https://paddle-wheel.bj.bcebos.com/develop/linux/linux-gpu-cuda11.6-cudnn8.4.0-mkl-gcc8.2-avx/paddlepaddle_gpu-0.0.0.post116-cp37-cp37m-linux_x86_64.whl sh setup_env conda activate helixfold ``` -------------------------------- ### Install CPU Version of PaddlePaddle (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Installs the CPU-only version of the paddlepaddle library. This command uses a specific mirror for PyPI to ensure compatibility. ```console $ python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` -------------------------------- ### Install ppfleetx for Advanced Training Modes Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Installs the 'ppfleetx' library, which is required for running scripts with DAP/BP/DP-DAP-BP training modes. This involves downloading a specific wheel file for ppfleetx and then installing it using pip. ```bash wget https://paddle-qa.bj.bcebos.com/PaddleFleetX/ppfleetx-0.0.0-py3-none-any.whl python -m pip install ppfleetx-0.0.0-py3-none-any.whl ``` -------------------------------- ### Example: Multi-Node, Multi-GPU with Yet Another DP/BP/DAP Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Presents a final example for multi-node, multi-GPU training with a specific set of parallelism parameters (DP=32, BP=2, DAP=1) using the 'demo_initial_N8C64_dp32_bp2_dap1' mode in 'gpu_train.sh'. ```bash sh gpu_train.sh demo_initial_N8C64_dp32_bp2_dap1 ``` -------------------------------- ### Install PaddlePaddle CPU Version Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/installation_guide.md Installs the CPU-only version of PaddlePaddle using a specific mirror. This is for users without a compatible GPU. The version must be >= 2.0.0rc0. ```bash python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` -------------------------------- ### Example: Single Node, Single GPU Training Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Demonstrates how to initiate training on a single node with one GPU using the 'demo_initial_N1C1' mode within the 'gpu_train.sh' script. ```bash sh gpu_train.sh demo_initial_N1C1 ``` -------------------------------- ### Example: Single Node, Multi-GPU Fine-tuning Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Illustrates how to perform fine-tuning on a single node with eight GPUs using the 'demo_finetune_N1C8' mode in the 'gpu_train.sh' script. ```bash sh gpu_train.sh demo_finetune_N1C8 ``` -------------------------------- ### Example: Multi-Node, Multi-GPU with DP, BP, DAP Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Provides an example of initiating training on eight nodes with sixty-four GPUs, utilizing specific Distributed Parallelism (DP), Batch Parallelism (BP), and Data Parallelism (DAP) configurations (DP=16, BP=2, DAP=2) via the 'demo_initial_N8C64_dp16_bp2_dap2' mode in 'gpu_train.sh'. ```bash sh gpu_train.sh demo_initial_N8C64_dp16_bp2_dap2 ``` -------------------------------- ### Install PaddlePaddle (CPU/GPU) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/competition/ogbg_molhiv/README.md Installs the PaddlePaddle deep learning framework. Users can choose between the CPU or GPU version based on their hardware availability. Version 1.8.4 is specified. ```bash pip install paddlepaddle==1.8.4 # cpu or pip install paddlpaddle-gpu == 1.8.4 # gpu ``` -------------------------------- ### Install PGL Library Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/competition/ogbg_molhiv/README.md Installs the Paddle Graph Learning (PGL) library, version 1.2.1. PGL is essential for graph neural network operations within the PaddlePaddle ecosystem. ```bash pip install pgl==1.2.1 ``` -------------------------------- ### Model Configuration Example for Sequence Classification Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This JSON object shows an example configuration for a sequence classification model, likely a Transformer, used in PaddleHelix. It defines parameters such as model name, task, class number, hidden size, and dropout. ```json { "model_name": "secondary_structure", "task": "seq_classification", "class_num": 3, "label_name": "labels3", "hidden_size": 512, "layer_num": 12, "head_num": 8, "comment": "The following hyper-parameters are optional.", "dropout": 0.1, "weight_decay": 0.01 } ``` -------------------------------- ### Install PaddleHelix Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/linearrna_tutorial.ipynb Installs the paddlehelix library using pip. This is a prerequisite for using the LinearRNA tools. ```python !pip install paddlehelix from IPython.display import clear_output clear_output() print("Install successfully") ``` -------------------------------- ### Example: Multi-Node, Multi-GPU with Different DP/BP/DAP Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold/README_train.md Demonstrates another configuration for multi-node, multi-GPU training with different parallelism settings (DP=32, BP=1, DAP=2) using the 'demo_initial_N8C64_dp32_bp1_dap2' mode in 'gpu_train.sh'. ```bash sh gpu_train.sh demo_initial_N8C64_dp32_bp1_dap2 ``` -------------------------------- ### Install OGB for Evaluation Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/competition/ogbg_molhiv/README.md Installs the Open Graph Benchmark (OGB) library, which is used for dataset loading and evaluation metrics, specifically ROC-AUC in this context. ```bash pip install ogb ``` -------------------------------- ### Install PaddlePaddle GPU Version Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/installation_guide.md Installs the GPU-enabled version of PaddlePaddle. This command is for users who have a compatible NVIDIA GPU and CUDA installed. The version must be >= 2.0.0rc0. ```bash python -m pip install paddlepaddle-gpu -f https://paddlepaddle.org.cn/whl/stable.html ``` -------------------------------- ### Running Finetuning Script Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_compound/pretrain_gnns/README.md This snippet shows how to execute the finetuning process using a provided shell script. This script encapsulates the command-line arguments needed for finetuning, allowing for easy execution. ```bash sh scripts/finetune.sh ``` -------------------------------- ### Install RDKit using Conda (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Installs the RDKit package from the 'conda-forge' channel. RDKit is a dependency for PaddleHelix and is typically installed using conda due to its complex build process. ```console $ conda install -c conda-forge rdkit ``` -------------------------------- ### Finetuning GNN Models Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_compound/pretrain_gnns/README.md This snippet illustrates the command for finetuning a pre-trained GNN model. It involves specifying batch size, maximum epochs, dataset name, data path, configuration files for the encoder and model, the path to the pre-trained model weights, the output model directory, and learning rates for the encoder and head, along with the dropout rate. ```bash CUDA_VISIBLE_DEVICES=0 python finetune.py \ --batch_size=32 \ --max_epoch=4 \ --dataset_name=tox21 \ --data_path=../../../data/chem_dataset/tox21 \ --compound_encoder_config=model_configs/pregnn_paper.json \ --model_config=model_configs/down_linear.json \ --init_model=../../../output/pretrain_gnns/pregnn_paper-pre_Attrmask-pre_Supervised/epoch40/compound_encoder.pdparams \ --model_dir=../../../output/pretrain_gnns/finetune/tox21 \ --encoder_lr=1e-3 \ --head_lr=1e-3 \ --dropout_rate=0.2 ``` -------------------------------- ### Train Models: Multi-CPU or Single-GPU Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This command demonstrates how to initiate model training using either multiple CPU cores or a single GPU. It requires specifying directories for training and validation data, the learning rate, and whether to utilize CUDA for GPU acceleration. Additional model and task parameters can be appended. ```bash python train.py \ --train_data ./train_data # Directory of training data for training models, including multiple training files. \ --valid_data ./valid_data # Directory of validation data for evaluating models, including multiple validation files. \ --lr 0.0001 # Basic learning rate. \ --use_cuda # Whether use cuda for training. \ ... # Model parameter settings and task parameter settings will be introduced in the following chapters. ``` -------------------------------- ### Install GPU Version of PaddlePaddle (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Installs the GPU-enabled version of the paddlepaddle library. This command specifies a custom index URL for fetching the correct stable build. ```console $ python -m pip install paddlepaddle-gpu -f https://paddlepaddle.org.cn/whl/stable.html ``` -------------------------------- ### Activate Conda Environment Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/installation_guide.md Activates the 'paddlehelix' conda environment. This command must be run before installing or using PaddleHelix to ensure all dependencies are correctly loaded. ```bash conda activate paddlehelix ``` -------------------------------- ### Setup Environment for PaddleHelix Pretraining Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/compound_property_prediction_tutorial.ipynb Initializes the Python environment by adding the parent directory to the system path and changing the current working directory to the pretraining scripts location. This ensures that PaddleHelix modules and scripts can be imported and executed correctly. ```python import os import numpy as np import sys sys.path.insert(0, os.getcwd() + "/..") os.chdir("../apps/pretrained_compound/pretrain_gnns") ``` -------------------------------- ### Activate Conda Environment (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Activates the 'paddlehelix' conda environment that was previously created. This ensures that subsequent installations are made within the correct isolated environment. ```console $ conda activate paddlehelix ``` -------------------------------- ### Train Models: Multi-GPU Training Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This command illustrates multi-GPU training using paddle.distributed.launch. It requires specifying a log directory, training and validation data paths, learning rate, and enabling CUDA and distributed training. Other parameters are consistent with single-GPU training. ```bash python -m paddle.distributed.launch --log_dir log_dir train.py # Specify the log directory by "--log_dir" \ --train_data ./train_data # Directory of training data for training models, including multiple training files. \ --valid_data ./valid_data # Directory of validation data for evaluating models, including multiple validation files. \ --lr 0.0001 # Basic learning rate. \ --use_cuda # Only support gpu for now. \ --distributed # Distributed training. \ ... # Model parameter settings and task parameter settings will be introduced in the following chapters. ``` -------------------------------- ### Create Conda Environment for PaddleHelix (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Creates a new conda environment named 'paddlehelix' with Python version 3.7. This is a prerequisite for installing PaddleHelix and its dependencies. ```console $ conda create -n paddlehelix python=3.7 ``` -------------------------------- ### Initialize Model Parameters and Loss Function in PaddlePaddle Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial_cn.ipynb Sets up basic training parameters such as optimal mean squared error (MSE), optimal concordance index (CI), logging frequency, and maximum epochs. It also initializes the Mean Squared Error (MSE) loss function using PaddlePaddle's nn.MSELoss. ```python import paddle from paddle import nn # 基本设置 optimal_mse = 10000 optimal_CI = 0 log_iter = 50 log_step = 0 max_epoch = 10 # 设置损失函数 reg_loss_fn = paddle.nn.MSELoss() ``` -------------------------------- ### Download and Extract Small Dataset using wget Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/compound_property_prediction_tutorial.ipynb Downloads a small chemical dataset using `wget` and extracts it using `tar`. This is a demonstration step, and commented-out lines show how to download the full dataset if needed. The extracted data is expected in the `./chem_dataset_small` directory. ```bash ### Download a toy dataset for demonstration: !wget "https://baidu-nlp.bj.bcebos.com/PaddleHelix%2Fdatasets%2Fcompound_datasets%2Fchem_dataset_small.tgz" --no-check-certificate !tar -zxf "PaddleHelix%2Fdatasets%2Fcompound_datasets%2Fchem_dataset_small.tgz" !ls "./chem_dataset_small" ### Download the full dataset as you want: # !wget "http://snap.stanford.edu/gnn-pretrain/data/chem_dataset.zip" --no-check-certificate # !unzip "chem_dataset.zip" # !ls "./chem_dataset" ``` -------------------------------- ### Deactivate Conda Environment (Console) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/docs/installation.md Deactivates the currently active conda environment. This command is used to exit the 'paddlehelix' environment and return to the base environment or any previously active environment. ```console $ conda deactivate ``` -------------------------------- ### Initialize Model and Optimizer Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial.ipynb Initializes the MolTransModel with the specified configuration and moves the model to the selected device (GPU if available). It also sets up the Adam optimizer with the defined learning rate. ```python model = MolTransModel(model_config) model = model.cuda() optim = utils.Adam(parameters=model.parameters(), learning_rate=lr) ``` -------------------------------- ### Install HelixProtX Environment Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/helixprotx/README.md Installs the necessary environment for HelixProtX using Conda. It creates a new environment named 'helixprotx' with Python 3.8 and installs dependencies from 'requirements.txt'. ```bash conda create -n helixprotx python=3.8 conda activate helixprotx python install -r requirements.txt ``` -------------------------------- ### Configure Basic Training Settings for Regression Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial.ipynb Sets up fundamental parameters for the regression training process. This includes initializing variables for optimal Mean Squared Error (MSE) and Concordance Index (CI), setting logging frequency and step counters, and defining the maximum number of training epochs. It also initializes the Mean Squared Error (MSE) loss function using PaddlePaddle. ```python import paddle from paddle import nn # Basic setting optimal_mse = 10000 optimal_CI = 0 log_iter = 50 log_step = 0 max_epoch = 10 # Set loss function reg_loss_fn = paddle.nn.MSELoss() ``` -------------------------------- ### Install MSA Environment and HelixFold Dependencies Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold3/README.md This snippet details the installation process for the necessary environment and dependencies for HelixFold3, including MSA tools and PaddlePaddle. It uses conda for environment management and pip for Python package installation. ```bash # install msa env conda create -n msa_env -c conda-forge python=3.9 conda install -c bioconda aria2 hmmer==3.3.2 kalign2==2.04 hhsuite==3.3.0 -n msa_env -y # install paddlepaddle and other requirements conda create -n helixfold -c conda-forge python=3.10 conda activate helixfold python3 -m pip install paddlepaddle-gpu==3.1.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/ python3 -m pip install -r requirements.txt ``` -------------------------------- ### Train Sequence Models with Configuration Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This snippet demonstrates how to initiate the training process for sequence models using a Python script. It highlights the importance of specifying the model configuration file, which is organized in JSON format. ```bash python train.py \ ... # The way to set training parameters has been introduced. \ --model_config ./transformer_config # The configuration file of the model, organized by json format. \ ... # Task parameter settings will be introduced in the following chapters. ``` -------------------------------- ### Run BindingDB Training Script Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/drug_target_interaction/batchdta/README.md This command initiates the training script for the BindingDB dataset. It configures the batch size, number of epochs, number of rounds, and learning rate. The 'train_bindingdb.py' script and its prerequisites must be accessible. ```bash CUDA_VISIBLE_DEVICES=0 python train_bindingdb.py --batchsize 64 --epochs 50 --rounds 1 --lr 5e-4 ``` -------------------------------- ### Install PaddlePaddle and Dependencies Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/protein_folding/helixfold-single/README.md Installs the necessary PaddlePaddle deep learning framework and other project dependencies from a requirements file and a specific wheel package. This is crucial for running HelixFold. ```bash python -m pip install -r requirements.txt wget https://baidu-nlp.bj.bcebos.com/PaddleHelix/HelixFold/paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl python -m pip install paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl ``` -------------------------------- ### Supervised Pre-training for Entire Graph Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_compound/pretrain_gnns/README.md This snippet shows how to run the supervised pre-training script for the entire graph using `pretrain_supervised.py`. The command executes a shell script that likely contains the necessary parameters for this type of pre-training. ```bash sh scripts/pretrain_supervised.sh ``` -------------------------------- ### Example PaddlePaddle Model Output Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/protein_pretrain_and_property_prediction_tutorial_cn.ipynb This snippet provides an example of the numerical output generated by a PaddlePaddle model after inference. The output is a multi-dimensional array representing predictions. ```plaintext [[[ 0.00206075 -0.18510963 0.14306527] [-0.00598011 -0.29795507 0.26141614] [ 0.02770892 -0.34859642 0.2977559 ] ... [ 0.03656919 -0.35195014 0.31259197] [ 0.05244845 -0.27018723 0.23991765] [ 0.07729451 -0.1549773 0.11793666]] [[ 0.00581718 -0.1909214 0.15050192] [ 0.00434499 -0.3047068 0.25408033] [ 0.0205324 -0.3687356 0.3084018 ] ... [ 0.05517479 -0.34367785 0.3028638 ] [ 0.04513036 -0.26964056 0.23201282] [ 0.07147305 -0.14828885 0.11901551]]] ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/competition/kddcup2021-PCQM4M-LSC/README.md Lists the required Python packages and their versions for installing the LiteGEM project. These dependencies are crucial for setting up the correct environment to run the code. ```shell ogb==1.3.0 rdkit>=2019.03.1 obabel>=3.1.0 torch>=1.7.0 paddlepaddle-gpu>=2.1.0 pgl>=2.1.4 ``` -------------------------------- ### Configure Python Path and List Directory Contents (Python) Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial_cn.ipynb This Python snippet modifies the system's path to include a parent directory and then lists the files and directories in the current working directory. It's useful for managing project dependencies and understanding the project structure. ```python import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) os.chdir('../apps/drug_target_interaction/moltrans_dti/') os.listdir(os.getcwd()) ``` -------------------------------- ### HelixFold3 Installation (Bash) Source: https://context7.com/paddlepaddle/paddlehelix/llms.txt Installs HelixFold3 using Conda and pip, including PaddlePaddle GPU version. It also provides commands to download necessary databases and model parameters. ```bash # Installation conda create -n helixfold -c conda-forge python=3.10 conda activate helixfold python3 -m pip install paddlepaddle-gpu==3.1.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/ python3 -m pip install -r requirements.txt # Download databases (reduced version ~190GB download, ~530GB unzipped) scripts/download_all_data.sh ./data reduced_dbs # Download model parameters wget https://paddlehelix.bd.bcebos.com/HelixFold3/params/HelixFold3-params-20250714.zip unzip HelixFold3-params-20250714.zip -d ./init_models/ ``` -------------------------------- ### Graph-level GNN Supervised Pre-training Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_compound/pretrain_gnns/README.md This script executes graph-level multi-task supervised pre-training for GNNs, building upon node-level pre-training. It requires similar parameters to node-level pre-training, including batch size, epochs, learning rate, dropout, data path, and configuration files. Crucially, it also takes an initialized model path from a previous node-level pre-training stage. ```bash CUDA_VISIBLE_DEVICES=0 python pretrain_supervised.py \ --batch_size=256 \ --max_epoch=100 \ --lr=1e-3 \ --dropout_rate=0.2 \ --data_path=../../../data/chem_dataset/chembl_filtered \ --compound_encoder_config=model_configs/pregnn_paper.json \ --model_config=model_configs/pre_Supervised.json \ --init_model=../../../output/pretrain_gnns/pregnn_paper-pre_Attrmask/epoch40/compound_encoder.pdparams \ --model_dir=../../../output/pretrain_gnns/pretrain_supervised ``` -------------------------------- ### Import Core PaddleHelix Packages Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/drug_target_interaction_moltrans_tutorial.ipynb Imports essential libraries and modules required for building and training models. This includes PaddlePaddle core, neural network modules, data loading utilities, and custom model components like MolTransModel. ```python import paddle import numpy as np from paddle import nn from paddle import io from helper import utils from double_towers import MolTransModel ``` -------------------------------- ### Create Conda Environment and Install RDKit Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/competition/ogbg_molhiv/README.md This snippet shows how to create a new conda environment named 'ogbg_hiv' with Python 3.6 and install the RDKit library, a crucial dependency for molecular processing. ```bash conda create -n ogbg_hiv python=3.6 conda activate ogbg_hiv conda install -c conda-forge rdkit ``` -------------------------------- ### Evaluate Models: CPU or Single-GPU Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_protein/tape/README.md This command shows how to evaluate trained models using either CPU or a single GPU. It requires the path to the evaluation data, the model file to be evaluated, and a flag to indicate CUDA usage. Additional model and task parameters can be specified. ```bash python eval.py \ --data ./eval_data # Directory of test data for evaluating models, including multiple test files. \ --eval_model ./model # The model to be evaluated. \ --use_cuda # Whether the model runs in CPU or GPU. \ ... # Model parameter settings and task parameter settings will be introduced in the following chapters. ``` -------------------------------- ### Install Dependencies for PaddleHelix Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/cancer_drug_response/STR/README.md These commands install the necessary Python packages for running the STR model, including PaddlePaddle, PaddleHelix, PGL, and RDKit. Ensure your environment meets the Python version requirement. ```sh python -m pip install paddlepaddle-gpu==2.3.2.post101 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html pip install paddlehelix pip install pgl ``` -------------------------------- ### Running Node-Level Pretraining Script Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/apps/pretrained_compound/pretrain_gnns/README.md This snippet demonstrates how to run the node-level pretraining script (`pretrain_attrmask.py`) using a shell script. This approach allows for predefined parameters to be used for the pretraining process. ```bash sh scripts/pretrain_attrmask.sh ``` -------------------------------- ### Define Training Settings and Optimizer Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/tutorials/molecular_generation_tutorial.ipynb Sets up training parameters such as batch size, learning rate, number of epochs, and KL weight. An Adam optimizer is initialized for model training. ```python # define the training settings batch_size = 64 learning_rate = 0.001 n_epoch = 1 kl_weight = 0.1 # define optimizer optimizer = paddle.optimizer.Adam(parameters=model.parameters(), learning_rate=learning_rate) ``` -------------------------------- ### Example: Calculate RNA Partition Function with Cutoff Source: https://github.com/paddlepaddle/paddlehelix/blob/dev/c/pahelix/toolkit/linear_rna/README.md Demonstrates how to calculate the partition function and base pair probabilities for an RNA sequence with a specified base pair probability cutoff. This example shows the usage of both the machine learning-based (linear_partition_c) and thermodynamic model-based (linear_partition_v) functions. ```python import pahelix.toolkit.linear_rna as linear_rna linear_rna.linear_partition_c("UGAGUUCUCGAUCUCUAAAAUCG", bp_cutoff = 0.2) linear_rna.linear_partition_v("UGAGUUCUCGAUCUCUAAAAUCG", bp_cutoff = 0.2) ```