We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformers
@amyeroberts @qubvel
examples
When trying to run this official example code from the GOT-OCR2_0 HuggingFace page:
from transformers import AutoModel, AutoTokenizer tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True) model = AutoModel.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True, low_cpu_mem_usage=True, device_map='cuda', use_safetensors=True, pad_token_id=tokenizer.eos_token_id) model = model.eval().cuda() # input your test image image_file = 'xxx.jpg' # plain texts OCR res = model.chat(tokenizer, image_file, ocr_type='ocr') # format texts OCR: # res = model.chat(tokenizer, image_file, ocr_type='format') # fine-grained OCR: # res = model.chat(tokenizer, image_file, ocr_type='ocr', ocr_box='') # res = model.chat(tokenizer, image_file, ocr_type='format', ocr_box='') # res = model.chat(tokenizer, image_file, ocr_type='ocr', ocr_color='') # res = model.chat(tokenizer, image_file, ocr_type='format', ocr_color='') # multi-crop OCR: # res = model.chat_crop(tokenizer, image_file, ocr_type='ocr') # res = model.chat_crop(tokenizer, image_file, ocr_type='format') # render the formatted OCR results: # res = model.chat(tokenizer, image_file, ocr_type='format', render=True, save_render_file = './demo.html') print(res)
Should print result.
The text was updated successfully, but these errors were encountered:
Hi @test3211234! You are using 3rd party implementation, it's better to open discussion directly on the hub https://huggingface.co/stepfun-ai/GOT-OCR2_0/discussions
We also have transformers native implementation ongoing, you can try this out by installing it from the PR #34721
Sorry, something went wrong.
No branches or pull requests
System Info
transformers
version: 4.47.1Who can help?
@amyeroberts @qubvel
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
When trying to run this official example code from the GOT-OCR2_0 HuggingFace page:
Expected behavior
Should print result.
The text was updated successfully, but these errors were encountered: