初始化项目,由ModelHub XC社区提供模型
Model: kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small Source: Original Platform
This commit is contained in:
71
README.md
Normal file
71
README.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
tags:
|
||||
- pytorch
|
||||
- gpt2
|
||||
- molecule-nl
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# molcrawl-molecule-nat-lang-mol-instructions-gpt2-small
|
||||
|
||||
## Model Description
|
||||
|
||||
GPT-2 small (124M parameters) fine-tuned on molecule-oriented instruction data from [Mol-Instructions](https://huggingface.co/datasets/zjunlp/Mol-Instructions), starting from the `molcrawl-molecule-nat-lang-gpt2-small` pre-trained model.
|
||||
|
||||
## Datasets
|
||||
|
||||
- **Mol-Instructions**: [https://huggingface.co/datasets/zjunlp/Mol-Instructions](https://huggingface.co/datasets/zjunlp/Mol-Instructions) (Fine-tuning dataset)
|
||||
|
||||
- **Model Type**: gpt2
|
||||
- **Data Type**: Molecule-NL
|
||||
- **Training Date**: 2026-04-24
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
import torch
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained("kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small")
|
||||
tokenizer = AutoTokenizer.from_pretrained("kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small")
|
||||
|
||||
# Generate molecule-related text
|
||||
prompt = "The compound with SMILES CC(=O)Oc1ccccc1C(=O)O represents aspirin, which"
|
||||
inputs = tokenizer(prompt, return_tensors="pt")
|
||||
with torch.no_grad():
|
||||
output_ids = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=100,
|
||||
do_sample=True,
|
||||
temperature=0.8,
|
||||
eos_token_id=None, # HF config.json has legacy eos_token_id=0; disable early stop
|
||||
pad_token_id=0,
|
||||
)
|
||||
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
|
||||
|
||||
```
|
||||
|
||||
## Source Code
|
||||
|
||||
Training pipeline, configuration files, and data preparation scripts are
|
||||
available in the MolCrawl GitHub repository:
|
||||
[https://github.com/mmai-framework-lab/MolCrawl](https://github.com/mmai-framework-lab/MolCrawl)
|
||||
|
||||
## License
|
||||
|
||||
This model is released under the APACHE-2.0 license.
|
||||
|
||||
## Citation
|
||||
|
||||
If you use this model, please cite:
|
||||
|
||||
```bibtex
|
||||
@misc{molcrawl_molecule_nat_lang_mol_instructions_gpt2_small,
|
||||
title={molcrawl-molecule-nat-lang-mol-instructions-gpt2-small},
|
||||
author={{RIKEN}},
|
||||
year={2026},
|
||||
publisher={{Hugging Face}},
|
||||
url={{https://huggingface.co/kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small}}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user