mirror of
https://github.com/opendatalab/MinerU.git
synced 2026-09-24 23:10:23 +08:00
Merge pull request #3995 from myhloli/dev
fix: enhance http-client backend parameters in vlm_analyze.py for improved configuration options
This commit is contained in:
@@ -46,8 +46,11 @@ class ModelSingleton:
|
||||
batch_size = kwargs.get("batch_size", 0) # for transformers backend only
|
||||
max_concurrency = kwargs.get("max_concurrency", 100) # for http-client backend only
|
||||
http_timeout = kwargs.get("http_timeout", 600) # for http-client backend only
|
||||
server_headers = kwargs.get("server_headers", None) # for http-client backend only
|
||||
max_retries = kwargs.get("max_retries", 3) # for http-client backend only
|
||||
retry_backoff_factor = kwargs.get("retry_backoff_factor", 0.5) # for http-client backend only
|
||||
# 从kwargs中移除这些参数,避免传递给不相关的初始化函数
|
||||
for param in ["batch_size", "max_concurrency", "http_timeout"]:
|
||||
for param in ["batch_size", "max_concurrency", "http_timeout", "server_headers", "max_retries", "retry_backoff_factor"]:
|
||||
if param in kwargs:
|
||||
del kwargs[param]
|
||||
if backend not in ["http-client"] and not model_path:
|
||||
@@ -175,6 +178,9 @@ class ModelSingleton:
|
||||
batch_size=batch_size,
|
||||
max_concurrency=max_concurrency,
|
||||
http_timeout=http_timeout,
|
||||
server_headers=server_headers,
|
||||
max_retries=max_retries,
|
||||
retry_backoff_factor=retry_backoff_factor,
|
||||
)
|
||||
elapsed = round(time.time() - start_time, 2)
|
||||
logger.info(f"get {backend} predictor cost: {elapsed}s")
|
||||
|
||||
Reference in New Issue
Block a user