Views
No views yet
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
curl -LsSf https://astral.sh/uv/install.sh | sh
# 安装环境
uv syncsource .venv/bin/activate
# 修改 infer_common.py 文件开头的配置
python infer_common.py
# 使用 原生uv方式运行
uv run infer_common.py1CONFIG = {
2 # ========== 数据源配置 ==========
3 # 数据源类型: 'webdataset' 或 'local_folder'
4 'data_source_type': 'local_folder',
5
6 # WebDataset配置(当data_source_type='webdataset'时使用)
7 # 支持本地路径或HTTP URL
8 # 本地路径示例: '/mnt/data/wrs/biomedica_filtered/Illustrative_Diagrams/commercial'
9 # HTTP URL示例: 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/'
10 # 'webdataset_source': 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/',
11
12 # 本地文件夹配置(当data_source_type='local_folder'时使用)
13 # 示例: '/mnt/data/wrs/images_folder'
14 'local_folder_source': '/mnt/data/wrs/watermark/bing_meshword_医学插图数据_illustration',
15 # 支持的图片格式
16 'image_extensions': ['.jpg', '.jpeg', '.png', '.bmp', '.webp'],
17
18 # ========== 分类任务配置 ==========
19 # 使用预定义任务: 'illustration' 或 'watermark'
20 'task_type': 'illustration',
21
22 # 或者自定义任务(会覆盖task_type)
23 'custom_task': None, # 示例见下方
24 # 'custom_task': {
25 # 'prompt': '<image>\nYour custom prompt here',
26 # 'positive_class': 'class_a',
27 # 'negative_class': 'class_b',
28 # 'description': 'Custom task description',
29 # },
30
31 # ========== 输出配置 ==========
32 'output_dir': '/mnt/data/wrs/watermark/results/bing_meshword_医学插图数据_illustration_watermark',
33
34 # 是否保持原始文件夹结构(仅对local_folder数据源有效)
35 # True: 在输出目录中保持原始相对路径结构(如 class/subdir1/subdir2/image.jpg)
36 # False: 所有文件扁平化到输出目录(如 class/image.jpg),重名文件会自动添加路径前缀
37 'preserve_folder_structure': True,
38
39 # ========== 模型配置 ==========
40 # 模型id,使用hf缓存中的模型,自动下载
41 'model_path': 'Qwen/Qwen3-VL-8B-Instruct',
42 # 本地模型路径
43 # 'model_path': './Qwen3-VL-8B-Instruct',
44 # 'checkpoint_path': None, # 微调checkpoint路径,None则使用基础模型,水印分类使用基础模型
45 'checkpoint_path': 'output/v4-20251111-211623/checkpoint-2800', # 插图分类使用微调模型
46 'batch_size': 256,
47
48 # ========== 日志和checkpoint配置 ==========
49 'log_dir': None, # 默认为 {output_dir}/log
50 'checkpoint_file': None, # 默认为 {log_dir}/checkpoint.jsonl
51}1CONFIG = {
2 # ========== 数据源配置 ==========
3 # 数据源类型: 'webdataset' 或 'local_folder'
4 'data_source_type': 'local_folder',
5
6 # WebDataset配置(当data_source_type='webdataset'时使用)
7 # 支持本地路径或HTTP URL
8 # 本地路径示例: '/mnt/data/wrs/biomedica_filtered/Illustrative_Diagrams/commercial'
9 # HTTP URL示例: 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/'
10 # 'webdataset_source': 'http://172.28.114.209:8000/Illustrative_Diagrams/commercial/',
11
12 # 本地文件夹配置(当data_source_type='local_folder'时使用)
13 # 示例: '/mnt/data/wrs/images_folder'
14 'local_folder_source': '/mnt/data/wrs/watermark/bing_meshword_医学插图数据_illustration',
15 # 支持的图片格式
16 'image_extensions': ['.jpg', '.jpeg', '.png', '.bmp', '.webp'],
17
18 # ========== 分类任务配置 ==========
19 # 使用预定义任务: 'illustration' 或 'watermark'
20 'task_type': 'watermark',
21
22 # 或者自定义任务(会覆盖task_type)
23 'custom_task': None, # 示例见下方
24 # 'custom_task': {
25 # 'prompt': '<image>\nYour custom prompt here',
26 # 'positive_class': 'class_a',
27 # 'negative_class': 'class_b',
28 # 'description': 'Custom task description',
29 # },
30
31 # ========== 输出配置 ==========
32 'output_dir': '/mnt/data/wrs/watermark/results/bing_meshword_医学插图数据_illustration_watermark',
33
34 # 是否保持原始文件夹结构(仅对local_folder数据源有效)
35 # True: 在输出目录中保持原始相对路径结构(如 class/subdir1/subdir2/image.jpg)
36 # False: 所有文件扁平化到输出目录(如 class/image.jpg),重名文件会自动添加路径前缀
37 'preserve_folder_structure': False,
38
39 # ========== 模型配置 ==========
40 # 模型id,使用hf缓存中的模型,自动下载
41 'model_path': 'Qwen/Qwen3-VL-8B-Instruct',
42 # 本地模型路径
43 # 'model_path': './Qwen3-VL-8B-Instruct',
44 'checkpoint_path': None, # 微调checkpoint路径,None则使用基础模型,水印分类使用基础模型
45 # 'checkpoint_path': 'output/v4-20251111-211623/checkpoint-2800', # 插图分类使用微调模型
46 'batch_size': 256,
47
48 # ========== 日志和checkpoint配置 ==========
49 'log_dir': None, # 默认为 {output_dir}/log
50 'checkpoint_file': None, # 默认为 {log_dir}/checkpoint.jsonl
51}