Views
No views yet
colab/Deepseek_OCR_FULL_T4_Test.ipynb from the Files tab of this repo.1from unsloth import FastVisionModel
2from transformers import AutoModel
3import torch
4
5model, tokenizer = FastVisionModel.from_pretrained(
6 "Tcyber/deepseek_ocr_ethiopian_legal_FULL",
7 load_in_4bit=True, # ~4GB weights, fits 16GB T4
8 dtype=torch.float16, # T4 has no bf16 kernels
9 auto_model=AutoModel,
10 trust_remote_code=True,
11 unsloth_force_compile=False, # avoid RAM spike
12 use_gradient_checkpointing=False,
13)
14FastVisionModel.for_inference(model)
15
16res = model.infer(tokenizer, prompt="<image>\nFree OCR. ", image_file="page.png",
17 output_path="out/", image_size=768, base_size=1024,
18 crop_mode=False, save_results=False)
19print(res)