Downloads · 30 days
0
rifukawa/ucrg-tinyllama-finetuned
ucrg-tinyllama-finetuned is a machine learning model from rifukawa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains the fine-tuned weights for a TinyLlama-1.1B model, specialized for generating natural-language compliance reports from structured JSON data.
Downloads · 30 days
0
Access
Public
Updated Jul 2, 2025
Repo size
5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors4.5 MB · 52%
From the Hugging Face model README
This repository contains the fine-tuned weights for a TinyLlama-1.1B model, specialized for generating natural-language compliance reports from structured JSON data.
This model is the AI core of the Utility Compliance Report Generator (UCRG), a full-stack proof-of-concept project demonstrating an end-to-end AI application workflow.
<br>▶️ Live Demo | 📖 GitHub Repository
The UCRG project showcases the entire lifecycle of a modern AI application:
This model was trained to translate JSON objects describing utility incidents (like power outages or gas leaks) into clear, concise, human-readable summaries suitable for internal reporting or regulatory review.
TinyLlama/TinyLlama-1.1B-Chat-v1.0peft and trl libraries.instruct base model.The model was trained using a specific instruction-following prompt format. To get the best results, your input should follow this structure:
### Instruction:
Generate a compliance report summary from the following structured data.
### Input:
{ "incident_type": "Power Outage", "duration": "3 hours", "location": "Zone 4", "resolved": true }
### Response:
This model is served via a public Flask API as part of the full application. The easiest way to use it is through the live demo.
For programmatic use, you can load the base model and apply this LoRA adapter:
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
# Define model paths
base_model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter_path = "rifukawa/ucrg-tinyllama-finetuned"
# Load tokenizer and base model
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.float16,
device_map="auto",
)
# Load the LoRA adapter
model = PeftModel.from_pretrained(base_model, adapter_path)
# Create a text-generation pipeline
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
# Prepare the prompt
prompt = """### Instruction:
Generate a compliance report summary from the following structured data.
### Input:
{ "incident_type": "Gas Leak", "duration": "45 minutes", "location": "Substation B", "resolved": true }
### Response:
"""
# Generate the report
result = generator(prompt, max_new_tokens=100, do_sample=False)
print(result[0]['generated_text'].split("### Response:")[1].strip())
# Expected output:
# A gas leak occurred at Substation B. The event lasted for 45 minutes. The issue has been resolved.
This model is a proof-of-concept and was trained on a small, simulated dataset.
Despite these limitations, it effectively demonstrates the viability of using fine-tuned smaller LLMs for specialized, high-value automation tasks.