RamanGPT: Bidirectional Mapping Between Crystal Structures and Raman Spectra with Graph Neural Networks and Generative Transformers
Paper • 2606.03764 • Published
How to use knc6/ramangpt_dft_model with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/mistral-7b-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "knc6/ramangpt_dft_model")LoRA adapter fine-tuned from unsloth/mistral-7b-bnb-4bit on
knc6/ramangpt_dft. This is
the inverse model of the RamanGPT framework: given a chemical formula and the
main Raman peaks, it generates a crystal structure (lattice + fractional
coordinates). The forward model (ALIGNN) predicts the 200-bin Raman spectrum
(50--1000 cm$^{-1}$) from a structure, and an inverse->relax->forward loop couples
the two. Part of the AtomGPT spectroscopy suite (cf. IRGPT, DiffractGPT).
QLoRA (initialized from the DiffractGPT explicit-formula checkpoint), LoRA r=16, alpha=16 on q,k,v,o,gate,up,down; lr 2e-4 linear, effective batch 8, 2 epochs, 4-bit base, seed 3407.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = "unsloth/mistral-7b-bnb-4bit"
tok = AutoTokenizer.from_pretrained(base)
model = PeftModel.from_pretrained(
AutoModelForCausalLM.from_pretrained(base, device_map="auto"),
"knc6/ramangpt_dft_model")
prompt = ("### Instruction:\nBelow is a description of a material.\n### Input:\n"
"The chemical formula is: MoS2.\nThe Raman spectrum shows main peaks at: "
"383 cm-1(1.0), 408 cm-1(0.9).\nGenerate atomic structure description with "
"lattice lengths, angles, coordinates and atom types.\n### Output:\n")
ids = tok(prompt, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(**ids, max_new_tokens=512)[0][ids.input_ids.shape[1]:],
skip_special_tokens=True))
Base model
unsloth/mistral-7b-bnb-4bit