marker
marker copied to clipboard
marker_server should support --use_llm and related arguments
It would be great if marker_server could support --use_llm --llm_service and other arguments.
Has this been added yet? or is there any workaround to get the llm feature to run with marker_server as of now?
You might be able to monkey patch it until the change lands in master:
#!/usr/bin/env python3
"""
Patched marker_server with --use_llm support
Run this instead of marker_server to get LLM support
"""
import sys
import click
# Monkey patch before importing marker modules
def patch_config_parser():
"""Patch ConfigParser to add use_llm option"""
from marker.config import parser
original_common_options = parser.ConfigParser.common_options
@staticmethod
def patched_common_options(fn):
# Apply original options
fn = original_common_options(fn)
# Add use_llm option
fn = click.option(
"--use_llm",
is_flag=True,
default=False,
help="Use LLM to improve marker quality. Requires LLM backend configuration."
)(fn)
fn = click.option(
"--redo_inline_math",
is_flag=True,
default=False,
help="Use LLM to redo inline math (requires --use_llm)."
)(fn)
fn = click.option(
"--force_ocr",
is_flag=True,
default=False,
help="Force OCR on all pages."
)(fn)
return fn
parser.ConfigParser.common_options = patched_common_options
# Apply the patch
patch_config_parser()
# Now import and run the server with patched config
from marker.scripts.server import server_cli
if __name__ == "__main__":
# Add use_llm to the CLI arguments if needed
# This allows the server_cli to accept the new options
server_cli()
replaced content of marker_server.py with your code but
didn't work for me still
Usage: marker_server.py [OPTIONS] Try 'marker_server.py --help' for help.
Error: No such option: --use_llm