Edit model card

Model Card for Model ID

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

  • Developed by: mychen776 [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: [More Information Needed]
  • Language(s) (NLP): [More Information Needed]
  • License: [More Information Needed]
  • Finetuned from model [codellama/CodeLlama-34b-Instruct-hf]: [More Information Needed]

Model Sources [optional]

  • Repository: [More Information Needed]
  • Paper [optional]: [More Information Needed]
  • Demo [optional]: [More Information Needed]

Uses

Direct Use

[More Information Needed]

Downstream Use [optional]

[More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

[More Information Needed]

Recommendations

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

[More Information Needed]

Training Procedure

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

  • Training regime: [More Information Needed]

Speeds, Sizes, Times [optional]

[More Information Needed]

Evaluation

Testing Data, Factors & Metrics

Testing Data

[More Information Needed]

Factors

[More Information Needed]

Metrics

[More Information Needed]

Results

[More Information Needed]

Summary

Model Examination [optional]

[More Information Needed]

Environmental Impact

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

  • Hardware Type: [More Information Needed]
  • Hours used: [More Information Needed]
  • Cloud Provider: [More Information Needed]
  • Compute Region: [More Information Needed]
  • Carbon Emitted: [More Information Needed]

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]

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]

Downloads last month
7

Collection including mychen76/codellama-7b-ocr