Instructions to use mychen76/mistral7b_ocr_to_json_v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mychen76/mistral7b_ocr_to_json_v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mychen76/mistral7b_ocr_to_json_v1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mychen76/mistral7b_ocr_to_json_v1") model = AutoModelForCausalLM.from_pretrained("mychen76/mistral7b_ocr_to_json_v1", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mychen76/mistral7b_ocr_to_json_v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mychen76/mistral7b_ocr_to_json_v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mychen76/mistral7b_ocr_to_json_v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mychen76/mistral7b_ocr_to_json_v1
- SGLang
How to use mychen76/mistral7b_ocr_to_json_v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mychen76/mistral7b_ocr_to_json_v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mychen76/mistral7b_ocr_to_json_v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mychen76/mistral7b_ocr_to_json_v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mychen76/mistral7b_ocr_to_json_v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mychen76/mistral7b_ocr_to_json_v1 with Docker Model Runner:
docker model run hf.co/mychen76/mistral7b_ocr_to_json_v1
extract DOB
i want to promt the model to include in json file 'dob' that has been extracted by my 'OCR; which is in 'custom format' you can see my data is like this "text only:
wate Sale aratin fren aS 08436/00048
S.No. SSE/2007/ CENTRAL BOARD OF SECONDARY EDUCATION
151415 7 iii MARKS STATEMENT
Wve weet Wier, 2007
A ri
LL INDIA oe CONDARY SCHOOL EXAMINATION, 2007
ATH Neme AASHISH RANJAN STTPATS RollNe. Si BASS9
Sisil ST ATA Mother's Name PRATIMA KUMARI
| eT I ATS Father's Name ARUN KUMAR
SA FART Date of Birth ISTH AUGUST NINETEEN HUNDRED NINETY ONE
(eTeTS Schoo! OB4R6 SAINIK SCHOOL PURULIA WEST BENGAL
3 Whi MARKS OBTAINED
fsa SUBJECT
fer. | Weta} ala a ere) 9
TH | PR/IA | TOTAL TOTAL IN WORDS
ENGLISH COMM.
EIGHTY SIX
HINDI COURSE-B NINETY
MATHEMATICS NINETY SEVEN
SCIENCE & TECH. EIGHTY FOUR
PRAC.-INTERNAL 018
PRAC.-SKILLS EXT 018
SOCIAL SCIENCE
feria as
SEVENTY FIVE
AB : va A erqahVG Absent in the Subject uhvTa Result FASS
PR:3arTSs Practical oβ~
IA : siaRa YeaieT Internal Assessment (Mohar 4
fRe* Delhi uven Pris
RATS Dated 27β-05~β-200T Controlier of Examinations
Scanned by CamScanner
"