0.1.0
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$InputPath,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$OutputDir,
|
||||
[string[]]$ExtraArgs
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# 预设路径
|
||||
$repoRoot = Split-Path $PSScriptRoot -Parent
|
||||
$modelRoot = Join-Path $PSScriptRoot "models\\MinerU2.5-2509-1.2B"
|
||||
$configPath = Join-Path $PSScriptRoot "mineru.json"
|
||||
|
||||
# 优先使用带 ROCm 的 3.12 环境,回退到本地 .venv
|
||||
$pythonBins = @(
|
||||
"F:\\rocm\\.venv-rocm312\\Scripts\\python.exe",
|
||||
(Join-Path $PSScriptRoot ".venv\\Scripts\\python.exe")
|
||||
)
|
||||
$pythonBin = $pythonBins | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if (-not $pythonBin) {
|
||||
throw "未找到可用的 Python,可在 F:\\rocm\\.venv-rocm312 或 services\\mineru\\.venv 创建后再试。"
|
||||
}
|
||||
|
||||
# 环境变量:默认使用本地模型配置
|
||||
$env:MINERU_TOOLS_CONFIG_JSON = $configPath
|
||||
$env:MINERU_MODEL_SOURCE = "local"
|
||||
$env:PYTHONPATH = Join-Path $PSScriptRoot "src"
|
||||
|
||||
# 确保输出目录存在
|
||||
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
|
||||
|
||||
# 构造命令
|
||||
$argsList = @(
|
||||
"-m", "mineru.cli.client",
|
||||
"-p", $InputPath,
|
||||
"-o", $OutputDir,
|
||||
"-b", "vlm-transformers",
|
||||
"--model-path", $modelRoot
|
||||
)
|
||||
if ($ExtraArgs) {
|
||||
$argsList += $ExtraArgs
|
||||
}
|
||||
|
||||
Write-Host ">>> 使用 VLM 解析: $InputPath -> $OutputDir"
|
||||
Write-Host ">>> Python: $pythonBin"
|
||||
Write-Host ">>> 模型: $modelRoot"
|
||||
Write-Host ">>> 额外参数: $ExtraArgs"
|
||||
|
||||
& $pythonBin @argsList
|
||||
Reference in New Issue
Block a user