### Install Project Dependencies Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Installs the necessary packages for MolecularGPT using conda and pip. Ensure you are in the project root directory. ```bash conda create -n MolecularGPT python==3.10 conda activate MolecularGPT cd .\MolecularGPT bash init_env.sh pip install git+https://github.com/ashvardanian/usearch-molecules.git@main ``` -------------------------------- ### Prepare QM9 Dataset Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Instructions for downloading and uncompressing the QM9 dataset. The dataset should be placed at `./prompt_data/qm9.csv`. ```bash Download from https://figshare.com/articles/dataset/Data_for_6095_constitutional_isomers_of_C7H10O2/1057646?backTo=/collections/Quantum_chemistry_structures_and_properties_of_134_kilo_molecules/978904 \ Then uncompress file `dsgdb9nsd.xyz.tar.bz2` to `./prompt_data/qm9.csv` ``` -------------------------------- ### Download and Prepare ChEMBL Dataset Source: https://github.com/nyushcs/moleculargpt/blob/main/prompt_data/README.md This script downloads the ChEMBL dataset, unzips it, and organizes the files into a 'chembl_raw/raw' directory. It also downloads additional necessary files like 'chembl20Smiles.pckl' and 'chembl20LSTM.pckl', and moves them to the appropriate location. Finally, it cleans up the downloaded zip file and moves the extracted data into the 'chembl_raw/raw' directory, including 'mol_cluster.csv'. ```bash mkdir -p ./datasets cd datasets wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced.zip unzip dataPythonReduced.zip cd dataPythonReduced wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced/chembl20Smiles.pckl wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced/chembl20LSTM.pckl cd .. rm dataPythonReduced.zip mkdir -p chembl_raw/raw mv dataPythonReduced/* chembl_raw/raw wget 'https://www.dropbox.com/s/vi084g0ol06wzkt/mol_cluster.csv?dl=1' mv 'mol_cluster.csv?dl=1' chembl_raw/raw/mol_cluster.csv ``` -------------------------------- ### Construct K-Shot Instruction Datasets (Train) Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Scripts to generate and process training instruction datasets, including text generation, encoding, indexing, and creating 0-4 shot and 0,1,2,3,4-shot datasets. ```bash mkdir -p train_process mkdir -p train_dataset cd prompts python generate_pretrain_dataset.py --generate_assay_text --generate_mole_text --generate_qm9_text --split_non_overlap --add_negation cd .. python prep_encode_train.py python prep_index_train.py python ICL_train.py # 0,4-shot instruction dataset mkdir -p train_dataset/0-4-shot prep_0_4_shot.py # 0,1,2,3,4-shot instruction dataset mkdir -p train_dataset/01234-shot prep_01234.py ``` -------------------------------- ### Construct K-Shot Instruction Datasets (Test) Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Scripts to generate and process test instruction datasets, including prompt augmentation, encoding, indexing, and constructing datasets for similarity-based and diversity-based retrieval. ```bash mkdir -p test_process mkdir -p test_dataset python prep_test_dataset_aug.py --prompt_augmentation '' # choices=['','rewrite','expand','detail','shorten','name'] python prep_encode_test.py python prep_index_test.py For classfication and regression task: ICL_test_sim_cls.py ICL_test_sim_reg.py To construct the k-shot instructions arranged by ascending order: ICL_test_reverse_cls.py ICL_test_reverse_reg.py To construct the k-shot instructions retrieved based on diversity : ICL_test_diversity.py ``` -------------------------------- ### Download LoRA Weights Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Creates a directory for LoRA weights and instructs to download adapter configuration and model weights from HuggingFace. ```bash mkdir -p ckpts/lora Download the `adapter_config.json` and `adapter_model.bin` from https://huggingface.co/YuyanLiu/MolecularGPT and move to ./ckpts/lora ``` -------------------------------- ### Download LLaMA-2-7b-chat Model Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Creates a directory for LLaMA-2-7b-chat model weights and instructs to download them from HuggingFace. ```bash mkdir -p ckpts/llama Download from https://huggingface.co/meta-llama/Llama-2-7b-chat-hf and move to ./ckpts/llama ``` -------------------------------- ### Download and Prepare Chembl Dataset Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Downloads, unzips, and processes the Chembl dataset for training. This includes downloading specific pickle files and transforming the raw data. ```bash cd prompt_data/ wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced.zip unzip dataPythonReduced.zip cd dataPythonReduced wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced/chembl20Smiles.pckl wget http://bioinf.jku.at/research/lsc/chembl20/dataPythonReduced/chembl20LSTM.pckl cd .. rm dataPythonReduced.zip mkdir -p chembl_raw/raw mv dataPythonReduced/* chembl_raw/raw wget 'https://www.dropbox.com/s/vi084g0ol06wzkt/mol_cluster.csv?dl=1' mv 'mol_cluster.csv?dl=1' chembl_raw/raw/mol_cluster.csv python transform.py --input-dir chembl_raw/raw --output-dir chembl_full > transform.out cd .. ``` -------------------------------- ### Prepare CYP450 Dataset Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Instructions for downloading and uncompressing the CYP450 dataset. The raw CSV file should be placed in `./property_data/cyp450/raw/CYP450.csv`. ```bash Downloaded from https://github.com/shenwanxiang/ChemBench/blob/master/src/chembench/data_and_index/CYP450/CYP450.csv.gz \ Then uncompress file `CYP450.csv` to `./property_data/cyp450/raw/CYP450.csv`. ``` -------------------------------- ### Train MolecularGPT Model Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Initiates the fine-tuning process for the MolecularGPT model using a provided shell script. ```bash sbatch finetune_moleculargpt.sh ``` -------------------------------- ### Download MoleculeNet Datasets Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Downloads and unzips the MoleculeNet datasets, moving them into the property_data directory. ```bash mkdir -p property_data wget http://snap.stanford.edu/gnn-pretrain/data/chem_dataset.zip unzip chem_dataset.zip mv dataset property_data ``` -------------------------------- ### usearch-molecules Project Link Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Link to the usearch-molecules project. ```markdown [usearch-molecules](https://github.com/ashvardanian/usearch-molecules) ``` -------------------------------- ### Mol-Instructions Project Link Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Link to the Mol-Instructions dataset, a large-scale biomolecular instruction dataset for LLMs. ```markdown [Mol-Instructions: A Large-Scale Biomolecular Instruction Dataset for Large Language Models](https://github.com/zjunlp/Mol-Instructions) ``` -------------------------------- ### Prepare ChEMBL-Dense Datasets Source: https://github.com/nyushcs/moleculargpt/blob/main/prompt_data/README.md This bash script prepares ChEMBL-Dense datasets by creating directories, copying data, and creating ablation versions. It filters the ChEMBL dataset based on drug and assay degrees. ```bash bash chembl_gen.sh mkdir -p chembl_dense_10/processed mkdir -p chembl_dense_50/processed mkdir -p chembl_dense_100/processed cp -r chembl_dense_10 chembl_dense_10_ablation cp -r chembl_dense_50 chembl_dense_50_ablation cp -r chembl_dense_100 chembl_dense_100_ablation ``` -------------------------------- ### Download Chembl Property Dataset Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Downloads the Chembl property dataset from Google Drive using a wget command that handles confirmation links. ```bash cd prompt_data filename='mole_graph_property.csv' fileid='1oLxIDOzp8MY0Jhzc1m6E7SCOVAZO5L4D' wget --load-cookies /tmp/cookies.txt "https://drive.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://drive.google.com/uc?export=download&id=${fileid}' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=${fileid}" -O ${filename} && rm -rf /tmp/cookies.txt cd .. ``` -------------------------------- ### Chinese-LLaMA-Alpaca-2 Project Link Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Link to the Chinese-LLaMA-Alpaca-2 project. ```markdown [Chinese-LLaMA-Alpaca-2](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2) ``` -------------------------------- ### Stanford Alpaca Project Link Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Link to the stanford_alpaca project. ```markdown [stanford_alpaca](https://github.com/tatsu-lab/stanford_alpaca) ``` -------------------------------- ### GIMLET Project Link Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Link to the GIMLET project, a unified graph-text model for molecule learning. ```markdown [GIMLET: A Unified Graph-Text Model for Instruction-Based Molecule Zero-Shot Learning](https://github.com/zhao-ht/GIMLET) ``` -------------------------------- ### Map ChEMBL to STRING Database Source: https://github.com/nyushcs/moleculargpt/blob/main/prompt_data/README.md This sequence of commands integrates ChEMBL data with the STRING database. It involves multiple Python scripts to generate various mapping and scoring files, including assay-target relationships, STRING protein IDs, and protein-protein interaction scores. The final filtered task score file is copied to the 'chembl_full' directory. ```bash cd ChEMBL_STRING python step_01.py --dataset chembl_raw > step_01.out python step_02.py python step_03.py --dataset chembl_raw python step_04.py --dataset chembl_raw python step_05.py --dataset chembl_raw cp filtered_task_score.tsv ../chembl_full/ cd .. ``` -------------------------------- ### Transform Raw ChEMBL Data Source: https://github.com/nyushcs/moleculargpt/blob/main/prompt_data/README.md This command preprocesses the raw ChEMBL dataset located in 'chembl_raw/raw' and outputs transformed files to 'chembl_full'. The transformation includes discarding None values, filtering molecules by atom count and molecular weight, and retaining only the largest molecule in SMILES strings. ```bash python transform.py --input-dir chembl_raw/raw --output-dir chembl_full > transform.out ``` -------------------------------- ### Evaluate Model Performance (Regression) Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Evaluates the model's performance on regression tasks using specified parameters for base model, LoRA weights, data path, and shot count. ```python python downstream_test_llama_reg.py --load_8bit --base_model $model --lora_weights $lora --path $path --shot $shot ``` -------------------------------- ### Evaluate Model Performance (Classification) Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md Evaluates the model's performance on classification tasks using specified parameters for base model, LoRA weights, data path, and shot count. ```python mkdir -p cache python downstream_test_llama_cla.py --load_8bit --base_model $model --lora_weights $lora --path $path --shot $shot ``` -------------------------------- ### MolecularGPT Citation Source: https://github.com/nyushcs/moleculargpt/blob/main/README.md BibTeX citation for the MolecularGPT paper: 'MolecularGPT: Open Large Language Model (LLM) for Few-Shot Molecular Property Prediction'. ```bibtex @article{liu2024moleculargpt, title={MolecularGPT: Open Large Language Model (LLM) for Few-Shot Molecular Property Prediction}, author={Yuyan Liu and Sirui Ding and Sheng Zhou and Wenqi Fan and Qiaoyu Tan}, year={2024}, eprint={2406.12950}, archivePrefix={arXiv} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.