Falconsai / florence-2-invoice

huggingface.co
Total runs: 11
24-hour runs: 0
7-day runs: -1
30-day runs: -6
Model's Last Updated: July 14 2024
image-text-to-text

Introduction of florence-2-invoice

Model Details of florence-2-invoice

Model Card: Falconsai/florence-2-invoice

  • Developed by: Michael Stattelman for Falcons.ai
  • Funded by [optional]: Falcons.ai
Model Sources:
Model Overview

Falconsai/florence-2-invoice is a fine-tuned version of the microsoft/Florence-2-base-ft model. This model has been specifically trained to identify and extract key fields from invoice images. The fine-tuning process utilized a curated dataset of invoices annotated to recognize the following fields:

  • Billing address, - Discount percentage, - Due date
  • Email client, - Header, - Invoice date
  • Invoice number, - Name client, - Products
  • Remise, - Shipping address, - Subtotal
  • Tax, - Tax percentage, - Tel client, - Total
Base Model

The base model used for fine-tuning is microsoft/Florence-2-base-ft , a state-of-the-art vision model developed by Microsoft.

Fine-tuning Configuration

The fine-tuning process was carried out using a Low-Rank Adaptation (LoRa) configuration with the following parameters:

LoraConfig(
    r=8,
    lora_alpha=8,
    target_modules=["q_proj", "o_proj", "k_proj", "v_proj", "linear", "Conv2d", "lm_head", "fc2"],
    task_type="CAUSAL_LM",
    lora_dropout=0.05,
    bias="none",
    inference_mode=False,
    use_rslora=True,
    init_lora_weights="gaussian",
    revision=REVISION
)
Hardware Used

The fine-tuning process was conducted on an Alienware system, ensuring robust performance and efficient training.

Dataset

The model was trained on a curated dataset of invoice images. Each invoice was annotated to identify the specific fields listed above. This dataset ensured that the model learned to accurately detect and extract key information from various invoice formats.

Usage
Inference

To use this model for inference, you can load it via the Hugging Face Transformers library:

import torch
from PIL import Image
from transformers import (
    AdamW,
    AutoModelForCausalLM,
    AutoProcessor,
    get_scheduler
)
def run_florence_invoice(img, task_prompt, text_input=None):
    image = Image.open(img)

    # Ensure the image is in RGB format
    if image.mode != "RGB":
        image = image.convert("RGB")
        
        model_id2 = "Falconsai/florence-2-invoice"
        model = AutoModelForCausalLM.from_pretrained(model_id2, trust_remote_code=True).eval().cuda()
        processor = AutoProcessor.from_pretrained(model_id2, trust_remote_code=True)

    with torch.no_grad():
        if text_input is None:
            prompt = task_prompt
        else:
            prompt = task_prompt + text_input
        inputs = processor(text=prompt, images=image, return_tensors="pt")
        generated_ids = model.generate(
        input_ids=inputs["input_ids"].cuda(),
        pixel_values=inputs["pixel_values"].cuda(),
        max_new_tokens=1024,
        num_beams=3
        )
        generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
        parsed_answer = processor.post_process_generation(generated_text, task=task_prompt, image_size=(image.width, image.height))

    del model
    del processor

    return parsed_answer
## Call the function as follows:
### Return all fields identified:
img = './invoice.png'
run_florence_invoice(img, '<OD>')

### Return Specific field
img = './invoice.png'
results = run_florence_invoice(img, "<CAPTION_TO_PHRASE_GROUNDING>", text_input="invoice date")
Applications

This model is ideal for automating the extraction of key information from invoices in various business and financial applications. It can significantly reduce the manual effort required for data entry and validation in accounting and bookkeeping processes.

Evaluation

The model has been evaluated on a held-out set of annotated invoice images. The evaluation metrics used included precision, recall, and F1-score for each of the identified fields. Detailed evaluation results and visualizations are available in the results directory of the repository.

Limitations
  • The model's performance is dependent on the quality and variability of the training dataset. It may not perform as well on invoices that significantly differ from those seen during training.
  • Fine-tuning was conducted with specific LoRa configurations, which may need to be adjusted for different use cases or datasets.
Contact

For more information or questions about this model, please contact the developers at [ [email protected] ].

License

This model is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

We would like to thank Microsoft for the development of the Florence2 vision model and the broader machine learning community for their contributions and support.

Runs of Falconsai florence-2-invoice on huggingface.co

11
Total runs
0
24-hour runs
0
3-day runs
-1
7-day runs
-6
30-day runs

More Information About florence-2-invoice huggingface.co Model

florence-2-invoice huggingface.co

florence-2-invoice huggingface.co is an AI model on huggingface.co that provides florence-2-invoice's model effect (), which can be used instantly with this Falconsai florence-2-invoice model. huggingface.co supports a free trial of the florence-2-invoice model, and also provides paid use of the florence-2-invoice. Support call florence-2-invoice model through api, including Node.js, Python, http.

florence-2-invoice huggingface.co Url

https://huggingface.co/Falconsai/florence-2-invoice

Falconsai florence-2-invoice online free

florence-2-invoice huggingface.co is an online trial and call api platform, which integrates florence-2-invoice's modeling effects, including api services, and provides a free online trial of florence-2-invoice, you can try florence-2-invoice online for free by clicking the link below.

Falconsai florence-2-invoice online free url in huggingface.co:

https://huggingface.co/Falconsai/florence-2-invoice

florence-2-invoice install

florence-2-invoice is an open source model from GitHub that offers a free installation service, and any user can find florence-2-invoice on GitHub to install. At the same time, huggingface.co provides the effect of florence-2-invoice install, users can directly use florence-2-invoice installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

florence-2-invoice install url in huggingface.co:

https://huggingface.co/Falconsai/florence-2-invoice

Url of florence-2-invoice

florence-2-invoice huggingface.co Url

Provider of florence-2-invoice huggingface.co

Falconsai
ORGANIZATIONS

Other API from Falconsai

huggingface.co

Total runs: 542
Run Growth: 314
Growth Rate: 57.93%
Updated:September 24 2026
huggingface.co

Total runs: 486
Run Growth: 486
Growth Rate: 100.00%
Updated:September 26 2026
huggingface.co

Total runs: 44
Run Growth: 31
Growth Rate: 70.45%
Updated:September 28 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 24 2026