Instructions to use liyuesen/druggpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liyuesen/druggpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="liyuesen/druggpt")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("liyuesen/druggpt") model = AutoModelForCausalLM.from_pretrained("liyuesen/druggpt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use liyuesen/druggpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "liyuesen/druggpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liyuesen/druggpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/liyuesen/druggpt
- SGLang
How to use liyuesen/druggpt with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "liyuesen/druggpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liyuesen/druggpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "liyuesen/druggpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liyuesen/druggpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use liyuesen/druggpt with Docker Model Runner:
docker model run hf.co/liyuesen/druggpt
|
Download README.md from liyuesen/druggpt: direct link, hf CLI and curl.
- Browser
- Download file 3.53 kB
-
https://huggingface.co/liyuesen/druggpt/resolve/main/README.md
- Command line
-
hf download hf://liyuesen/druggpt/README.md
-
curl -L -o README.md https://huggingface.co/liyuesen/druggpt/resolve/main/README.md
3.53 kB
| license: gpl-3.0 | |
| tags: | |
| - chemistry | |
| - biology | |
| - medical | |
| - gpt2 | |
| # DrugGPT | |
| A generative drug design model based on GPT2. | |
| <img src="https://img.shields.io/github/license/LIYUESEN/druggpt"><img src="https://img.shields.io/badge/python-3.7-blue"><img src="https://img.shields.io/github/stars/LIYUESEN/druggpt?style=social"> | |
| ## π© Introduction | |
| DrugGPT is a generative pharmaceutical strategy based on GPT structure, which aims to bring innovation to drug design by using natural language processing technique. | |
| This project applies the GPT model to the exploration of chemical space to discover new molecules with potential binding abilities for specific proteins. | |
| DrugGPT provides a fast and efficient method for the generation of drug candidate molecules by training on up to 1.8 million protein-ligand binding data. | |
| ## π₯ Deployment | |
| 1. Clone | |
| ```shell | |
| git clone https://github.com/LIYUESEN/druggpt.git | |
| cd druggpt | |
| ``` | |
| Or you can visit our [GitHub repo](https://github.com/LIYUESEN/druggpt) and click *Code>Download ZIP* to download this repo. | |
| 2. Create virtual environment | |
| ```shell | |
| conda create -n druggpt python=3.7 | |
| conda activate druggpt | |
| ``` | |
| 3. Download python dependencies | |
| ```shell | |
| pip install datasets transformers scipy scikit-learn | |
| pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 | |
| conda install -c openbabel openbabel | |
| ``` | |
| ## π How to use | |
| Use [drug_generator.py](https://github.com/LIYUESEN/druggpt/blob/main/drug_generator.py) | |
| Required parameters: | |
| - `-p` | `--pro_seq`: Input a protein amino acid sequence. | |
| - `-f` | `--fasta`: Input a FASTA file. | |
| > Only one of -p and -f should be specified. | |
| - `-l` | `--ligand_prompt`: Input a ligand prompt. | |
| - `-e` | `--empty_input`: Enable directly generate mode. | |
| - `-n` | `--number`: At least how many molecules will be generated. | |
| - `-d` | `--device`: Hardware device to use. Default is 'cuda'. | |
| - `-o` | `--output`: Output directory for generated molecules. Default is './ligand_output/'. | |
| - `-b` | `--batch_size`: How many molecules will be generated per batch. Try to reduce this value if you have low RAM. Default is 32. | |
| ## π¬ Example usage | |
| - If you want to input a protein FASTA file | |
| ```shell | |
| python drug_generator.py -f bcl2.fasta -n 50 | |
| ``` | |
| - If you want to input the amino acid sequence of the protein | |
| ```shell | |
| python drug_generator.py -p MAKQPSDVSSECDREGRQLQPAERPPQLRPGAPTSLQTEPQGNPEGNHGGEGDSCPHGSPQGPLAPPASPGPFATRSPLFIFMRRSSLLSRSSSGYFSFDTDRSPAPMSCDKSTQTPSPPCQAFNHYLSAMASMRQAEPADMRPEIWIAQELRRIGDEFNAYYARRVFLNNYQAAEDHPRMVILRLLRYIVRLVWRMH -n 50 | |
| ``` | |
| - If you want to provide a prompt for the ligand | |
| ```shell | |
| python drug_generator.py -f bcl2.fasta -l COc1ccc(cc1)C(=O) -n 50 | |
| ``` | |
| - Note: If you are running in a Linux environment, you need to enclose the ligand's prompt with single quotes (''). | |
| ```shell | |
| python drug_generator.py -f bcl2.fasta -l 'COc1ccc(cc1)C(=O)' -n 50 | |
| ``` | |
| ## π How to reference this work | |
| DrugGPT: A GPT-based Strategy for Designing Potential Ligands Targeting Specific Proteins | |
| Yuesen Li, Chengyi Gao, Xin Song, Xiangyu Wang, Yungang Xu, Suxia Han | |
| bioRxiv 2023.06.29.543848; doi: [https://doi.org/10.1101/2023.06.29.543848](https://doi.org/10.1101/2023.06.29.543848) | |
| [](https://doi.org/10.1101/2023.06.29.543848) | |
| ## β License | |
| [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) |