Downloads · 30 days
12
18% of all-time downloads
BSVGK/phi35-mini-lora-text2kg-adapter
phi35-mini-lora-text2kg-adapter is a text generation model from BSVGK. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
This is the LoRA adapter for the Phi-3.5 Mini Instruct model fine-tuned to extract structured RDF knowledge graph triples from UK government procurement contract text.
Downloads · 30 days
12
18% of all-time downloads
All-time downloads
68
Public
Repo size
36.2 MB
Likes
0
Public
Click a slice to open those files.
.safetensors35.7 MB · 90%
From the Hugging Face model README
This is the LoRA adapter for the Phi-3.5 Mini Instruct model fine-tuned to extract structured RDF knowledge graph triples from UK government procurement contract text.
For the full merged model ready for inference, use: 👉 BSVGK/phi35-mini-lora-text2kg-merged
| Metric | Score |
|---|---|
| F1 Score | 0.9954 |
| BERTScore F1 | 0.9997 |
| Hallucination Rate | 0.00% (Zero) |
| Test Contracts | 1,387 unseen contracts |
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-3.5-mini-instruct"
)
tokenizer = AutoTokenizer.from_pretrained(
"microsoft/Phi-3.5-mini-instruct"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"BSVGK/phi35-mini-lora-text2kg-adapter"
)
prompt = """Extract RDF triples from the following UK government contract:
Contract: [paste your contract text here]
RDF Triples:"""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))