feat: 新增命令行打标与本地/API Caption 工作流#44
Open
niangao2331 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本 PR 为 issue #40 增加首期命令行打标能力和接口文档,覆盖本地 TAG、本地自然语言 Caption、OpenAI-compatible API Caption 三种路径。
已实现内容
.txt写入、冲突策略、固定添加/移除标签和去重。local:使用现有 WD/CL ONNX 标签器,输出 Danbooru 风格 TAG。caption:使用本地 BLIP-compatible Hugging Face 模型,输出自然语言 NL。api:调用 OpenAI-compatible/chat/completions视觉接口,输出自然语言 NL。scripts/cli/tagger.ps1、scripts/cli/tagger.sh。/interrogate请求字段兼容,并将后台执行迁移到共享 service。--use-cn-mirror、--hf-endpoint、USE_CN_MIRROR=1、HF_ENDPOINT。docs/tagger-cli-api.md。使用方式
本地 TAG 打标
递归处理子目录:
使用国内镜像下载缺失模型:
本地自然语言 Caption
指定设备:
API 自然语言 Caption
包装脚本
.\scripts\cli\tagger.ps1 local --path .\inputbash scripts/cli/tagger.sh local --path ./input本地模型放置约定
程序会先检查用户或整合包内置模型,没有再下载。
查找顺序:
MIKAZUKI_TAGGER_DIRtaggers/<model-key>/models/taggers/<model-key>/huggingface/taggers/<model-key>/WD 示例:
CL 示例:
文档
新增文档:
docs/tagger-cli-api.md,包含三种 CLI 模式、OpenAI-compatible 请求/响应格式、输出和冲突策略、本地模型放置方式、国内镜像与 HF 下载配置、预留程序接口说明。测试
已通过:
目标测试:9 条通过。
也手动验证了:
.txt。备注
全量
python -m unittest discover tests仍有既有失败,集中在 Anima backend pin/submodule 和 train-log auto-open,和本 PR 的 tagger 改动无关。