You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know why this result is so bad. Could you please let me know.
from transformers import VisionEncoderDecoderModel, AutoTokenizer, AutoFeatureExtractor
import torch
from PIL import Image
load model, tokenizer, and feature extractor
model = VisionEncoderDecoderModel.from_pretrained("DGurgurov/im2latex")
tokenizer = AutoTokenizer.from_pretrained("DGurgurov/im2latex")
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k") # using the original feature extractor for now
I tried to check inference result.
Generated LaTeX formula: iabilityiabilitybenniaiabilityiabilityiabilityiornianm Dekazaazaazanmnmiabilityben Dek Dekexpexp Dekexpnmiabilityiabilityonductnm Dekexpazaaza recessexpexpexpiabilityiabilityercexpruns recess recess Dekazanm recess recessrunsnmruns recessnmexp Dek recess recessexprunsazaexprunsnm Dek recessnm recessnmrunsazaazarunsnm recessruns recessrunsexpiabilitybennmexprunsexpnm Deknmnm recessiabilityiabilityonest recess recessiabilitybeniabilityben recessnm Call recessrunsazanmrunsexpntnm recessexpiabilityercrunsnm Callazaazaexpexprunsiabilityerc recessnmnmexpexpbenexp recessexpnm recessben recessrunsrunsrunsiabilityiabilityiacnmnmnmntnmazaaza Callaza recess recess Callexpnmnmrunsrunsnmnt recessazaexpnmazarunsexpexp Call recessnmntexprunsnt recessrunsntexpazaexpntaza recessntrunsrunsbenexpexp Skipexpexp recessiabilityerciabilityercnt recessnt recessiabilityonductexp recess Dek recessntazaruns recess Callnm recessnt Call recess recessbennt recessexp Dekaza recessruns Callexprunsbenazaazant recessbenazarunsrunsexpercazaaza Dek recessiabilityonestexpexp fungiruns recessexp
I don't know why this result is so bad. Could you please let me know.
from transformers import VisionEncoderDecoderModel, AutoTokenizer, AutoFeatureExtractor
import torch
from PIL import Image
load model, tokenizer, and feature extractor
model = VisionEncoderDecoderModel.from_pretrained("DGurgurov/im2latex")
tokenizer = AutoTokenizer.from_pretrained("DGurgurov/im2latex")
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k") # using the original feature extractor for now
prepare an image
image = Image.open("path/to/your/image.png")
pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values
generate LaTeX formula
generated_ids = model.generate(pixel_values)
generated_texts = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
print("Generated LaTeX formula:", generated_texts[0])
The text was updated successfully, but these errors were encountered: