Downloads · 30 days
22
1% of all-time downloads
pat-jj/text2graph-llama-3.2-3b
text2graph-llama-3.2-3b is a text generation model from pat-jj. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.2.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
22
1% of all-time downloads
All-time downloads
1.9K
Public
Parameters
3.2B
57.8 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors6.4 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of unsloth/Llama-3.2-3B-Instruct on a text2triple dataset curated by Sonnet-3.5.
This model has much faster inference speed than our previous trained T5-based model. Also, it performs better for longer (> 512 tokens) input.
"William Gerald Standridge (November 27, 1953 – April 12, 2014) was an American stock car racing driver. He was a competitor in the NASCAR Winston Cup Series and Busch Series."
(S> William gerald standridge| P> Nationality| O> American),
(S> William gerald standridge| P> Occupation| O> Stock car racing driver),
(S> William gerald standridge| P> Competitor| O> Busch series),
(S> William gerald standridge| P> Competitor| O> Nascar winston cup series),
(S> William gerald standridge| P> Birth date| O> November 27, 1953),
(S> William gerald standridge| P> Death date| O> April 12, 2014)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "pat-jj/text2graph-llama-3.2-3b"
def load_model_and_tokenizer():
# Load the model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Set up chat template
tokenizer.chat_template = tokenizer.chat_template or "llama-3.1"
return model, tokenizer
def generate_triples(model, tokenizer, input_text, max_length=2048):
# Format the input using chat template
messages = [{
"role": "user",
"content": f"Convert the following text to triples:\n\nText: {input_text}"
}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Tokenize input
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(
**inputs,
max_length=max_length,
num_return_sequences=1,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.pad_token_id
)
# Decode and return the response
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
def main():
print("Loading model and tokenizer...")
model, tokenizer = load_model_and_tokenizer()
print("\nModel loaded! Enter text to convert to triples (type 'quit' to exit):")
while True:
user_input = input("\nEnter text: ")
if user_input.lower() == 'quit':
break
print("\nGenerating triples...")
response = generate_triples(model, tokenizer, user_input)
print("\nResponse:", response)
if __name__ == "__main__":
main()
The following hyperparameters were used during training:
@misc{jiang2025rasretrievalandstructuringknowledgeintensivellm,
title={RAS: Retrieval-And-Structuring for Knowledge-Intensive LLM Generation},
author={Pengcheng Jiang and Lang Cao and Ruike Zhu and Minhao Jiang and Yunyi Zhang and Jimeng Sun and Jiawei Han},
year={2025},
eprint={2502.10996},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2502.10996},
}