Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

This a finetune codellama model finetuned to convert OCR scan result (eg. PaddleOCR) text array to structure json object. the input include ocr text array and ground truth boxes.

Model Details

training dataset: [ mychen76/cord-ocr-text-v2 ] enhanced version of original: naver-clova-ix/cord-v2

Usage-1 Input OCR text array and context boxes:

eval_prompt = """### Instruction: Use the Input below and Context details to create an strucuture receipt data. The output must be a well-formed JSON object: ```json

Input:

["BAKS", "Nasgor Jawa", "32.727", "Jeruk Panas", "19.091", "1Air Mineral", "9.091", "Net Total", "60.909", "P.Resto 10", "6.091", "3 Total", "67.000", "CASH", "67.000"]

Context:

[[[[131.0, 210.0], [327.0, 210.0], [327.0, 251.0], [131.0, 251.0]], ["BAKS", 0.9765313863754272]], [[[120.0, 378.0], [273.0, 380.0], [273.0, 400.0], [120.0, 398.0]], ["Nasgor Jawa", 0.9626438021659851]], [[[340.0, 381.0], [419.0, 381.0], [419.0, 399.0], [340.0, 399.0]], ["32.727", 0.9828599095344543]], [[[106.0, 398.0], [271.0, 400.0], [271.0, 418.0], [106.0, 416.0]], ["Jeruk Panas", 0.9557318091392517]], [[[340.0, 401.0], [417.0, 401.0], [417.0, 419.0], [340.0, 419.0]], ["19.091", 0.995367705821991]], [[[98.0, 417.0], [269.0, 419.0], [269.0, 436.0], [98.0, 434.0]], ["1Air Mineral", 0.9278557300567627]], [[[348.0, 416.0], [418.0, 418.0], [418.0, 439.0], [348.0, 437.0]], ["9.091", 0.9945915937423706]], [[[97.0, 455.0], [217.0, 455.0], [217.0, 475.0], [97.0, 475.0]], ["Net Total", 0.9419357776641846]], [[[336.0, 455.0], [419.0, 457.0], [419.0, 478.0], [336.0, 476.0]], ["60.909", 0.9923689961433411]], [[[97.0, 475.0], [243.0, 474.0], [243.0, 494.0], [97.0, 495.0]], ["P.Resto 10", 0.8946446180343628]], [[[350.0, 477.0], [415.0, 477.0], [415.0, 495.0], [350.0, 495.0]], ["6.091", 0.9968243837356567]], [[[94.0, 495.0], [193.0, 497.0], [192.0, 533.0], [93.0, 531.0]], ["3 Total", 0.9634256362915039]], [[[334.0, 495.0], [420.0, 495.0], [420.0, 535.0], [334.0, 535.0]], ["67.000", 0.9943265914916992]], [[[91.0, 552.0], [154.0, 552.0], [154.0, 596.0], [91.0, 596.0]], ["CASH", 0.9981260895729065]], [[[335.0, 553.0], [419.0, 553.0], [419.0, 594.0], [335.0, 594.0]], ["67.000", 0.9952940344810486]]]

Response:

"""

expect output

{"menu": [{"nm": "Nasgor Jawa", "cnt": "1", "price": "32.727"}, {"nm": "Jeruk Panas", "cnt": "1", "price": "19.091"}, {"nm": "Air Mineral", "cnt": "1", "price": "9.091"}], "sub_total": {"subtotal_price": "60.909", "tax_price": "6.091"}, "total": {"total_price": "67.000", "cashprice": "67.000", "menutype_cnt": "3"}}

input_ids = tokenizer(eval_prompt, return_tensors="pt", truncation=True).input_ids.cuda() outputs = model.generate(input_ids=input_ids, max_new_tokens=100, do_sample=True, top_p=0.9,temperature=0.9) print(f"Generated instruction:\n{tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0][len(eval_prompt):]}")

Generated instruction:

{"menu": [{"nm": "BAKS"}, {"nm": "apple"}, {"nm": "banada"}, {"nm": "Mineral Water"}], "sub_total": {"subtotal_price": "60.909"}, "total": {"total_price": "67.000", "cashprice": "67.000", "changeprice": "0"}}

Model Description

<!-- Provide a longer summary of what this model is. -->

Model Sources [optional]

<!-- Provide the basic links for the model. -->

Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->

Direct Use

<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->

[More Information Needed]

Downstream Use [optional]

<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->

[More Information Needed]

Out-of-Scope Use

<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->

[More Information Needed]

Bias, Risks, and Limitations

<!-- This section is meant to convey both technical and sociotechnical limitations. -->

[More Information Needed]

Recommendations

<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

Use the code below to get started with the model.

[More Information Needed]

Training Details

Training Data

<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->

[More Information Needed]

Training Procedure

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

Speeds, Sizes, Times [optional]

<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->

[More Information Needed]

Evaluation

<!-- This section describes the evaluation protocols and provides the results. -->

Testing Data, Factors & Metrics

Testing Data

<!-- This should link to a Data Card if possible. -->

[More Information Needed]

Factors

<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->

[More Information Needed]

Metrics

<!-- These are the evaluation metrics being used, ideally with a description of why. -->

[More Information Needed]

Results

[More Information Needed]

Summary

Model Examination [optional]

<!-- Relevant interpretability work for the model goes here -->

[More Information Needed]

Environmental Impact

<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

Technical Specifications [optional]

Model Architecture and Objective

[More Information Needed]

Compute Infrastructure

[More Information Needed]

Hardware

[More Information Needed]

Software

[More Information Needed]

Citation [optional]

<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]