Skip to content

Commit

Permalink
Merge pull request #636 from myhloli/dev
Browse files Browse the repository at this point in the history
fix(pdf-extract): ensure model is set to evaluation mode before processing
  • Loading branch information
myhloli authored Sep 19, 2024
2 parents 19a74db + 4811a3d commit 3a616cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions magic_pdf/model/pdf_extract_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def mfr_model_init(weight_dir, cfg_path, _device_='cpu'):
task = tasks.setup_task(cfg)
model = task.build_model(cfg)
model = model.to(_device_)
model.eval()
vis_processor = load_processor('formula_image_eval', cfg.config.datasets.formula_rec_eval.vis_processor.eval)
mfr_transform = transforms.Compose([vis_processor, ])
return [model, mfr_transform]
Expand Down

0 comments on commit 3a616cf

Please sign in to comment.