One small model that reads photos of invoices, job-site forms or menus. Swap in your own labeled images.
How to run it
Commands are copied from the source, unchanged except where a notebook cell is cut at 40 lines (marked in the code). Placeholders like <you> are the source's own. Credit goes to the authors named on each block.
Install (as written in the notebook)
%%capture
import os, re
if "COLAB_" not in "".join(os.environ.keys()):
!pip install unsloth # Do this in local & cloud setups
else:
!pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer
!pip install --no-deps unsloth_zoo bitsandbytes accelerate peft trl triton unsloth
!unsloth install-kernels
!pip install --no-deps --upgrade "torchao>=0.16.0"
!pip install --no-deps transformers==5.5.0 "tokenizers>=0.22.0,<=0.23.0"
!pip install "huggingface_hub>=1.5.0,<2.0"
import importlib.metadata as _md
try: _tv = tuple(int(x) for x in _md.version("torch").split("+")[0].split(".")[:2])
except Exception: _tv = (2, 11)
_torchcodec = {(2, 11): "torchcodec>=0.11.0", (2, 10): "torchcodec==0.10.*", (2, 9): "torchcodec==0.9.*", (2, 8): "torchcodec==0.7.*", (2, 7): "torchcodec==0.5.*"}.get(_tv, "torchcodec>=0.12.0" if _tv >= (2, 12) else "torchcodec")
!pip install "{_torchcodec}"
import torch; torch._dynamo.config.recompile_limit = 64;