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")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("liyuesen/druggpt") model = AutoModelForCausalLM.from_pretrained("liyuesen/druggpt") - 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
XJTU_WangXiangyu commited on
Commit ·
ce1da01
1
Parent(s): 37c1967
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,31 +1,45 @@
|
|
| 1 |
---
|
| 2 |
license: artistic-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
conda create -n druggpt python=3.7
|
| 7 |
conda activate druggpt
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
pip install transformers
|
| 12 |
-
pip install
|
| 13 |
conda install -c openbabel openbabel
|
| 14 |
-
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
3. Navigate to the directory containing the drug_generator.py file using cd path/to/directory.
|
| 20 |
-
4. Run the script with the desired arguments, such as the protein sequence, ligand prompt, number of molecules to generate, and output directory.
|
| 21 |
-
|
| 22 |
-
# Example usage:
|
| 23 |
-
|
| 24 |
-
## If you want to input a protein FASTA file,
|
| 25 |
python drug_generator.py -f bcl2.fasta -n 50
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
python drug_generator.py -p MAKQPSDVSSECDREGRQLQPAERPPQLRPGAPTSLQTEPQGNPEGNHGGEGDSCPHGSPQGPLAPPASPGPFATRSPLFIFMRRSSLLSRSSSGYFSFDTDRSPAPMSCDKSTQTPSPPCQAFNHYLSAMASMRQAEPADMRPEIWIAQELRRIGDEFNAYYARRVFLNNYQAAEDHPRMVILRLLRYIVRLVWRMH -n 50
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: artistic-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- chemistry
|
| 5 |
+
- biology
|
| 6 |
+
- medical
|
| 7 |
+
- gpt2
|
| 8 |
---
|
| 9 |
+
# DrugGPT
|
| 10 |
+
A generative drug design model based on GPT2.
|
| 11 |
+
<img src="https://img.shields.io/badge/license-Artistic%20License%202.0-green"><img src="https://img.shields.io/badge/python-3.7-blue">
|
| 12 |
+
## Deployment
|
| 13 |
+
1. Clone
|
| 14 |
+
```shell
|
| 15 |
+
git lfs install
|
| 16 |
+
git clone https://huggingface.co/liyuesen/druggpt
|
| 17 |
+
```
|
| 18 |
+
2. Create virtual environment
|
| 19 |
+
```shell
|
| 20 |
conda create -n druggpt python=3.7
|
| 21 |
conda activate druggpt
|
| 22 |
+
```
|
| 23 |
+
3. Download python dependencies
|
| 24 |
+
```shell
|
| 25 |
+
pip install datasets transformers scipy scikit-learn
|
| 26 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
|
| 27 |
conda install -c openbabel openbabel
|
| 28 |
+
```
|
| 29 |
+
## Example usage
|
| 30 |
+
Run the script with the desired arguments, such as the protein sequence, ligand prompt, number of molecules to generate, and output directory.
|
| 31 |
+
- If you want to input a protein FASTA file
|
| 32 |
+
```shell
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
python drug_generator.py -f bcl2.fasta -n 50
|
| 34 |
+
```
|
| 35 |
+
- If you want to input the amino acid sequence of the protein
|
| 36 |
+
```shell
|
| 37 |
python drug_generator.py -p MAKQPSDVSSECDREGRQLQPAERPPQLRPGAPTSLQTEPQGNPEGNHGGEGDSCPHGSPQGPLAPPASPGPFATRSPLFIFMRRSSLLSRSSSGYFSFDTDRSPAPMSCDKSTQTPSPPCQAFNHYLSAMASMRQAEPADMRPEIWIAQELRRIGDEFNAYYARRVFLNNYQAAEDHPRMVILRLLRYIVRLVWRMH -n 50
|
| 38 |
+
```
|
| 39 |
|
| 40 |
+
- If you want to provide a prompt for the ligand
|
| 41 |
+
```shell
|
| 42 |
+
python drug_generator.py -f bcl2.fasta -l COc1ccc(cc1)C(=O) -n 50
|
| 43 |
+
```
|
| 44 |
+
## License
|
| 45 |
+
[Artistic License 2.0](https://opensource.org/license/artistic-license-2-0-php/)
|