File size: 1,395 Bytes
774cc1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
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.