Skip to content

fix: 修改modal_infer.exe 为单独打包 + CI support #12

Merged
grider-transwithai merged 25 commits intoTransWithAI:mainfrom
Randomless:feature-modal
Jan 15, 2026
Merged

fix: 修改modal_infer.exe 为单独打包 + CI support #12
grider-transwithai merged 25 commits intoTransWithAI:mainfrom
Randomless:feature-modal

Conversation

@Randomless
Copy link
Copy Markdown
Contributor

@Randomless Randomless commented Jan 13, 2026

背景

  • 关联 运行错误,提示如下,什么问题 #11:反馈 v1.6 exe 仅输出 runtime hook 后退出,疑似打包/依赖冲突。
  • 本 PR 需要把 project.spec改回v1.4/v1.5版本,保持 infer.exe 打包逻辑不变,先把 Modal CLI 打包流程独立为modal.spec并加 CI 校验,降低依赖冲突风险。
  • modal.exe打包为onefile独立文件。

变更

  • 新增 modal.spec:单文件打包 Modal 客户端,并打包 environment-cuda128.yml
  • 新增 environment-modal.yml:本地运行 Modal CLI 的轻量环境。
  • build_windows.py
    • infer 打包成功后自动构建 modal.spec进行打包;
    • 若当前环境缺少 modal/questionary,先自动安装;
    • modal_infer.exe 输出到 dist/faster_whisper_transwithai_chickenrice,并使用独立 build/modal 目录。
  • modal_infer.py
    • 强制 stdout/stderr 为 UTF‑8(修复 CI/Windows 下 argparse --help 的编码崩溃);
    • 远程仓库版本固定为 v1.4(避免远端代码漂移)。
  • CI:build-release-conda.yml 增加 modal_infer.exe --help 校验。

测试

  • CI step(build-release-conda)需要检查两个exe的--help的内容是否正常输出,而不是空白:
    • infer.exe --help
    • modal_infer.exe --help

@Randomless
Copy link
Copy Markdown
Contributor Author

还需要@grider-transwithai 改一下project.spec到老版本

错误的CI结果

Run cd dist\faster_whisper_transwithai_chickenrice
  cd dist\faster_whisper_transwithai_chickenrice
  infer.exe --help
  modal_infer.exe --help
  shell: C:\Windows\system32\cmd.EXE /C CALL {0}
  env:
    PYTHONUNBUFFERED: 1
    INPUT_RUN_POST: true
    CONDA: C:\Users\runneradmin\miniconda3
Runtime hook: Set KMP_DUPLICATE_LIB_OK=TRUE to resolve OpenMP conflicts
Runtime hook: Set TRANSFORMERS_NO_ADVISORY_WARNINGS=1 to suppress advisory warnings
Runtime hook: Configured ONNX Runtime to use 2 threads (half of 4 available CPUs)
usage: modal_infer.exe [-h] [--non-interactive]

feature-modal 运行脚本

options:
  -h, --help         show this help message and exit
  --non-interactive  跳过 questionary,全部通过参数指定(暂未实现)。

正确的CI结果

Run cd dist\faster_whisper_transwithai_chickenrice
Runtime hook: Set KMP_DUPLICATE_LIB_OK=TRUE to resolve OpenMP conflicts
Runtime hook: Set TRANSFORMERS_NO_ADVISORY_WARNINGS=1 to suppress advisory warnings
Runtime hook: Configured ONNX Runtime to use 2 threads (half of 4 available CPUs)
usage: infer.exe [-h] [--model_name_or_path MODEL_NAME_OR_PATH]
                 [--device DEVICE] [--compute_type COMPUTE_TYPE] [--overwrite]
                 [--audio_suffixes AUDIO_SUFFIXES] [--sub_formats SUB_FORMATS]
                 [--output_dir OUTPUT_DIR]
                 [--generation_config GENERATION_CONFIG]
                 [--log_level LOG_LEVEL] [--merge_segments]
                 [--no_merge_segments] [--merge_max_gap_ms MERGE_MAX_GAP_MS]
                 [--merge_max_duration_ms MERGE_MAX_DURATION_MS]
                 [--vad_threshold VAD_THRESHOLD]
                 [--vad_min_speech_duration_ms VAD_MIN_SPEECH_DURATION_MS]
                 [--vad_min_silence_duration_ms VAD_MIN_SILENCE_DURATION_MS]
                 [--vad_speech_pad_ms VAD_SPEECH_PAD_MS] [--console]
                 [--enable_batching] [--batch_size BATCH_SIZE]
                 [--max_batch_size MAX_BATCH_SIZE]
                 ...

Whisper transcription with custom VAD injection

positional arguments:
  base_dirs             Directories or files to process

options:
  -h, --help            show this help message and exit
  --model_name_or_path MODEL_NAME_OR_PATH
                        Path to the Whisper model
  --device DEVICE       Device to run the model on (cpu, cuda, auto)
  --compute_type COMPUTE_TYPE
                        Compute type for the model
  --overwrite           Overwrite existing subtitle files
  --audio_suffixes AUDIO_SUFFIXES
                        Comma-separated list of audio file extensions to
                        process
  --sub_formats SUB_FORMATS
                        Comma-separated list of subtitle formats (lrc, srt,
                        vtt, txt)
  --output_dir OUTPUT_DIR
                        Output directory for subtitle files
  --generation_config GENERATION_CONFIG
                        Path to generation config file
  --log_level LOG_LEVEL
                        Logging level
  --merge_segments      Enable segment merge post-processing (override config
                        file)
  --no_merge_segments   Disable segment merge post-processing (override config
                        file)
  --merge_max_gap_ms MERGE_MAX_GAP_MS
                        Max allowed gap (ms) between segments for merging
                        (override config file)
  --merge_max_duration_ms MERGE_MAX_DURATION_MS
                        Max duration (ms) of a merged segment (override config
                        file)
  --vad_threshold VAD_THRESHOLD
                        Override VAD threshold
  --vad_min_speech_duration_ms VAD_MIN_SPEECH_DURATION_MS
                        Override minimum speech duration in ms
  --vad_min_silence_duration_ms VAD_MIN_SILENCE_DURATION_MS
                        Override minimum silence duration in ms
  --vad_speech_pad_ms VAD_SPEECH_PAD_MS
                        Override speech padding in ms
  --console             Launch interactive Python console for debugging
  --enable_batching     Enable batched inference for faster processing
                        (requires more VRAM)
  --batch_size BATCH_SIZE
                        Batch size for batched inference (auto-detect if not
                        specified)
  --max_batch_size MAX_BATCH_SIZE
                        Maximum batch size to try when auto-detecting
                        (default: 8)
usage: modal_infer.exe [-h] [--non-interactive]

feature-modal 运行脚本

options:
  -h, --help         show this help message and exit
  --non-interactive  跳过 questionary,全部通过参数指定(暂未实现)。

@grider-transwithai
Copy link
Copy Markdown
Member

能不能从v1.6 rebase出来

grider-transwithai and others added 22 commits January 14, 2026 09:43
PyInstaller 6.17.0 has a KeyError: 'depends' regression in some conda
environments. Pin to 6.16.0 until the issue is resolved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add modal_infer.py for cloud-based GPU inference using Modal platform:
- Interactive CLI for GPU selection and configuration
- Support for multiple GPU types (T4, A10G, A100, H100, etc.)
- Automatic model download and caching on Modal Volume
- Batch processing support for accelerated transcription
- Micromamba-based image with conda environment from environment-cuda128.yml

Add environment-modal.yml for lightweight local client setup:
- Minimal dependencies (modal, questionary)
- Python 3.10 environment for running modal_infer.py locally

Update 使用说明.txt with Modal usage instructions:
- Environment setup guide
- Modal account registration and token configuration
- HuggingFace token setup for model downloads
- Step-by-step usage instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix file upload path to use session directory consistently
- Simplify volume path structure (remove APP_ROOT_REL layer)
- Remove run mode selection, default to one-time execution
- Add detailed logging for build, execution and download stages
- Fix download conflict by adding --force flag
- Reorder GPU choices (T4/L4 first for cost efficiency)
- Update volume name to Faster_Whisper

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- 文件夹模式下改为逐个上传和处理音频文件,容器复用
- 使用 min_containers=1 保持容器预热
- 排除 mp4 格式,发现时提示用户使用 ffmpeg 转换
- 文件夹模式下结果直接保存到源文件夹,不再创建 _out 子目录
- 单个文件处理失败时继续处理其他文件

注意:仅通过语法检查,未经手动测试验证

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 上传时将文件名中的空格替换为下划线
- 在 UploadManifest 中记录原始文件名
- 下载字幕后恢复原始文件名(带空格)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 上传时将文件名改为 todo + 扩展名,避免全角字符问题
- 下载后恢复原始文件名

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 上传后调用 volume.commit() 强制同步
- 远程执行前等待文件出现(最多 30 秒)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 远程函数直接返回文件内容(base64 编码)
- 本地直接写入文件,使用原始文件名
- 移除 modal volume get 下载逻辑
- 删除不再使用的 RemoteResult 类

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Randomless
Copy link
Copy Markdown
Contributor Author

试着从main rebase了一下 ,看起来没问题

@grider-transwithai
Copy link
Copy Markdown
Member

更改里面还是有着一段

      # PyInstaller 6.17.0 has a conda hook regression (KeyError: 'depends') in some conda environments
      - pyinstaller==6.16.0

这个在v1.6里面revert回了

      - pyinstaller>=6.0.0

你看看把这个更改去掉?

@Randomless
Copy link
Copy Markdown
Contributor Author

已修改

@grider-transwithai
Copy link
Copy Markdown
Member

REPO_REF = "v1.4" 这个指向v1.4是必须的吗,可以不依赖特定tag吗,除了这个之外没什么其他问题了

- 删除 REPO_REF = "v1.4" 常量
- 克隆时不再指定 --branch,使用默认分支
- 更新时 reset 到 origin/main 而非固定 tag

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@grider-transwithai grider-transwithai merged commit fe92b7c into TransWithAI:main Jan 15, 2026
13 checks passed
@Randomless
Copy link
Copy Markdown
Contributor Author

不是必须的 改成指向main了

@Randomless Randomless deleted the feature-modal branch January 16, 2026 13:28
@Randomless Randomless restored the feature-modal branch January 16, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants