Downloads · 30 days
20
7% of all-time downloads
manuelaschrittwieser/llama-3-invoice-extractor-merged
llama-3-invoice-extractor-merged is a text generation model from manuelaschrittwieser. Use it when you need the model to write or continue text. It is set up for unsloth. The card lists the license as apache-2.0.
- License: apache-2.0 - Finetuned from model : unsloth/llama-3-8b-bnb-4bit
Downloads · 30 days
20
7% of all-time downloads
All-time downloads
282
Public
Parameters
8B
31 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
This model is a fine-tuned version of Meta's Llama-3-8B, specifically optimized for Structured Information Extraction. It is designed to act as a "Parser Agent" that transforms messy, unstructured financial text—such as invoice descriptions, receipt notes, and purchase logs—into machine-readable, valid JSON objects.
Primary Intended Use:
Target Schema:
{
"item": "string",
"quantity": "integer",
"date": "string",
"vendor": "string",
"total": "float",
"currency": "string"
}
The model was trained on the manuelaschrittwieser/invoice-extraction-dataset-v2, which consists of 601 high-quality examples.
The training was conducted using Parameter-Efficient Fine-Tuning (PEFT) with the QLoRA method via the Unsloth library, which significantly reduced VRAM usage while maintaining performance.
| Feature | Baseline Model | Fine-Tuned Model (v2) |
|---|---|---|
| Output Format | Conversational / Explanatory | Strict JSON Only |
| JSON Validity | Often fails (includes extra text) | 100% Valid JSON in test runs |
| Entity Recognition | High accuracy, but low precision | High Precision (mapped to schema) |
| Instruction Following | Moderate | High (Stays within Response block) |
Tracking: Training performance was monitored via Weights & Biases (W&B), showing a consistent reduction in loss over 120 steps without signs of overfitting.
Since this is a merged model, it can be used with standard transformers or vLLM.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "manuelaschrittwieser/llama-3-invoice-extractor-merged"
# Load Model and Tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.float16
)
# Inference Example
prompt = """### Instruction:
Extract invoice details into JSON.
### Input:
Bought 2 monitors at Dell for 900 USD on Jan 15 2024.
### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("### Response:\n")[-1])
Developed by: Manuela Schrittwieser, Project: Structured Data Extractor