Qwen3-VL-8B 分类使用
环境配置
pip
pip install -r requirements.txt
pip install ./flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp312-cp312-linux_x86_64.whl
# 其他torch版本前往 https://github.com/Dao-AILab/flash-attention/releases 下载
uv
# 安装uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# 安装环境
uv sync
运行
source .venv/bin/activate
# 修改 infer_common.py 文件开头的配置
python infer_common.py
# 使用 原生uv方式运行
uv run infer_common.py
配置
插图检测(微调)
CONFIG = {
# ========== 数据源配置 ==========
# 数据源类型: 'webdataset' 或 'local_folder'
'data_source_type': 'local_folder',
# WebDataset配置(当data_source_type='webdataset'时使用)
# 支持本地路径或HTTP URL
# 本地路径示例: '/mnt/data/wrs/biomedica_filtered/Illustrative_Diagrams/commercial'
# HTTP URL示例: 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/'
# 'webdataset_source': 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/',
# 本地文件夹配置(当data_source_type='local_folder'时使用)
# 示例: '/mnt/data/wrs/images_folder'
'local_folder_source': '/mnt/data/wrs/watermark/bing_meshword_医学插图数据_illustration',
# 支持的图片格式
'image_extensions': ['.jpg', '.jpeg', '.png', '.bmp', '.webp'],
# ========== 分类任务配置 ==========
# 使用预定义任务: 'illustration' 或 'watermark'
'task_type': 'illustration',
# 或者自定义任务(会覆盖task_type)
'custom_task': None, # 示例见下方
# 'custom_task': {
# 'prompt': '<image>\nYour custom prompt here',
# 'positive_class': 'class_a',
# 'negative_class': 'class_b',
# 'description': 'Custom task description',
# },
# ========== 输出配置 ==========
'output_dir': '/mnt/data/wrs/watermark/results/bing_meshword_医学插图数据_illustration_watermark',
# 是否保持原始文件夹结构(仅对local_folder数据源有效)
# True: 在输出目录中保持原始相对路径结构(如 class/subdir1/subdir2/image.jpg)
# False: 所有文件扁平化到输出目录(如 class/image.jpg),重名文件会自动添加路径前缀
'preserve_folder_structure': True,
# ========== 模型配置 ==========
# 模型id,使用hf缓存中的模型,自动下载
'model_path': 'Qwen/Qwen3-VL-8B-Instruct',
# 本地模型路径
# 'model_path': './Qwen3-VL-8B-Instruct',
# 'checkpoint_path': None, # 微调checkpoint路径,None则使用基础模型,水印分类使用基础模型
'checkpoint_path': 'output/v4-20251111-211623/checkpoint-2800', # 插图分类使用微调模型
'batch_size': 256,
# ========== 日志和checkpoint配置 ==========
'log_dir': None, # 默认为 {output_dir}/log
'checkpoint_file': None, # 默认为 {log_dir}/checkpoint.jsonl
}
水印检测(未微调,使用基础模型)
CONFIG = {
# ========== 数据源配置 ==========
# 数据源类型: 'webdataset' 或 'local_folder'
'data_source_type': 'local_folder',
# WebDataset配置(当data_source_type='webdataset'时使用)
# 支持本地路径或HTTP URL
# 本地路径示例: '/mnt/data/wrs/biomedica_filtered/Illustrative_Diagrams/commercial'
# HTTP URL示例: 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/'
# 'webdataset_source': 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/',
# 本地文件夹配置(当data_source_type='local_folder'时使用)
# 示例: '/mnt/data/wrs/images_folder'
'local_folder_source': '/mnt/data/wrs/watermark/bing_meshword_医学插图数据_illustration',
# 支持的图片格式
'image_extensions': ['.jpg', '.jpeg', '.png', '.bmp', '.webp'],
# ========== 分类任务配置 ==========
# 使用预定义任务: 'illustration' 或 'watermark'
'task_type': 'watermark',
# 或者自定义任务(会覆盖task_type)
'custom_task': None, # 示例见下方
# 'custom_task': {
# 'prompt': '<image>\nYour custom prompt here',
# 'positive_class': 'class_a',
# 'negative_class': 'class_b',
# 'description': 'Custom task description',
# },
# ========== 输出配置 ==========
'output_dir': '/mnt/data/wrs/watermark/results/bing_meshword_医学插图数据_illustration_watermark',
# 是否保持原始文件夹结构(仅对local_folder数据源有效)
# True: 在输出目录中保持原始相对路径结构(如 class/subdir1/subdir2/image.jpg)
# False: 所有文件扁平化到输出目录(如 class/image.jpg),重名文件会自动添加路径前缀
'preserve_folder_structure': False,
# ========== 模型配置 ==========
# 模型id,使用hf缓存中的模型,自动下载
'model_path': 'Qwen/Qwen3-VL-8B-Instruct',
# 本地模型路径
# 'model_path': './Qwen3-VL-8B-Instruct',
'checkpoint_path': None, # 微调checkpoint路径,None则使用基础模型,水印分类使用基础模型
# 'checkpoint_path': 'output/v4-20251111-211623/checkpoint-2800', # 插图分类使用微调模型
'batch_size': 256,
# ========== 日志和checkpoint配置 ==========
'log_dir': None, # 默认为 {output_dir}/log
'checkpoint_file': None, # 默认为 {log_dir}/checkpoint.jsonl
}
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Model tree for wangrongsheng/Med-Illustration-CLS
Base model
Qwen/Qwen3-VL-8B-Instruct