llm4mat-sft-dudez / README.md
mryufei's picture
Add README with inference examples for dudez
774cc1c verified
|
Raw History Blame Contribute Delete
1.4 kB
---
library_name: transformers
tags:
- llm4mat
- sft
- moleculenet
base_model: LLM-Research/Llama-3.2-1B-Instruct
---
# DUDEZ SFT Artifacts
This repository contains supervised fine-tuning artifacts generated from the llm4mat benchmark workflow.
## Included Artifacts
- merged model: `merged`
## Prompt Template
Template used to build QA prompts for this dataset:
> ### Instructions:
> Predict whether the molecule with SMILES {smiles} can bind to the target protein '{target}' (1 = active, 0 = inactive).
>
> ### Prediction (0/1):
## Inference (Transformers)
### Load merged model
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "mryufei/llm4mat-sft-dudez"
subfolder = "merged"
tokenizer = AutoTokenizer.from_pretrained(repo_id, subfolder=subfolder)
model = AutoModelForCausalLM.from_pretrained(
repo_id,
subfolder=subfolder,
torch_dtype=torch.bfloat16,
device_map="auto",
)
prompt = "Question: Is this molecule active?\nAnswer:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=128, temperature=0.1)
print(tokenizer.decode(output[0], skip_special_tokens=True))
```
## Notes
- Training/evaluation scripts are from this project workflow.
- Recommended prompt format: follow the benchmark prompt template used for this dataset.