Skip to content
New issue

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

how to use ? #14

Open
zoldaten opened this issue Nov 18, 2023 · 0 comments
Open

how to use ? #14

zoldaten opened this issue Nov 18, 2023 · 0 comments

Comments

@zoldaten
Copy link

could you provide any inference example ?

i try someting like this (after downloaded ROBERTA model):

from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
from functools import wraps
import time

def job():
    image=Image.open("Screenshot_1.jpg")   
    #model_version = "microsoft/trocr-small-printed"

    model_version = "ruberta_base"   
   
    processor = TrOCRProcessor.from_pretrained(model_version)
    
    pixel_values = processor(image, return_tensors="bin").pixel_values

    model = VisionEncoderDecoderModel.from_pretrained(model_version)
    generated_ids = model.generate(pixel_values)
    generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
    print(generated_text)
job()

but failed with:
OSError: ruberta_base does not appear to have a file named preprocessor_config.json. Checkout 'https://huggingface.co/ruberta_base/main' for available files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant