Skip to content

Commit

Permalink
Merge pull request #495 from VikParuchuri/hotfix-2
Browse files Browse the repository at this point in the history
Fix issues with newer converter class call
  • Loading branch information
VikParuchuri authored Jan 20, 2025
2 parents a123541 + 698ab5a commit 98dee1b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from marker.scripts.convert import convert_cli

if __name__ == "__main__":
main()
convert_cli()
4 changes: 3 additions & 1 deletion marker/scripts/convert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from marker.converters.pdf import PdfConverter

os.environ["GRPC_VERBOSITY"] = "ERROR"
os.environ["GLOG_minloglevel"] = "2"
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" # Transformers uses .isin for a simple op, which is not supported on MPS
Expand Down Expand Up @@ -44,7 +46,7 @@ def process_single_pdf(args):
if cli_options.get('skip_existing') and output_exists(out_folder, base_name):
return

converter_cls = config_parser.get_converter_cls()
converter_cls = PdfConverter

try:
converter = converter_cls(
Expand Down
4 changes: 3 additions & 1 deletion marker/scripts/convert_single.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from marker.converters.pdf import PdfConverter

os.environ["GRPC_VERBOSITY"] = "ERROR"
os.environ["GLOG_minloglevel"] = "2"
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" # Transformers uses .isin for a simple op, which is not supported on MPS
Expand All @@ -24,7 +26,7 @@ def convert_single_cli(fpath: str, **kwargs):
start = time.time()
config_parser = ConfigParser(kwargs)

converter_cls = config_parser.get_converter_cls()
converter_cls = PdfConverter
converter = converter_cls(
config=config_parser.generate_config_dict(),
artifact_dict=models,
Expand Down
3 changes: 2 additions & 1 deletion marker/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ async def _convert_pdf(params: CommonParams):
config_parser = ConfigParser(options)
config_dict = config_parser.generate_config_dict()
config_dict["pdftext_workers"] = 1
converter = PdfConverter(
converter_cls = PdfConverter
converter = converter_cls(
config=config_dict,
artifact_dict=app_data["models"],
processor_list=config_parser.get_processors(),
Expand Down
3 changes: 2 additions & 1 deletion marker/scripts/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def load_models():
def convert_pdf(fname: str, config_parser: ConfigParser) -> (str, Dict[str, Any], dict):
config_dict = config_parser.generate_config_dict()
config_dict["pdftext_workers"] = 1
converter = PdfConverter(
converter_cls = PdfConverter
converter = converter_cls(
config=config_dict,
artifact_dict=model_dict,
processor_list=config_parser.get_processors(),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "marker-pdf"
version = "1.2.6"
version = "1.2.7"
description = "Convert PDF to markdown with high speed and accuracy."
authors = ["Vik Paruchuri <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 98dee1b

Please sign in to comment.