-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image_caption_mapper等类似算子使用前怎么处理自己的数据格式 #600
Comments
嗨 @Crazy-JY ,感谢你对Data-Juicer的关注与使用! 简单说需要将数据集中的单条样本组织为这里的格式。 对于你的情况的话,如果你仅需要使用image_caption_mapper对已有的几张图片进行处理,那除了几张图片外,你还需要一个数据集文件,以jsonl格式为例,你可能需要为这几张图片创建一个 {
"text": "<__dj__image>",
"images": ["/path/to/img1"]
} 由于初始图片没有对应的caption,因此text字段处仅有一个image的特殊token作为占位符,表示这个样本中包含一张图片;images字段中则把该样本对应的图片路径放到列表里即可。 这个数据集可简单由这段代码片段生成: import os
import jsonlines
from data_juicer.utils.mm_utils import SpecialTokens
image_dir = 'data' # 放置图片的目录路径
dataset_file = 'dataset.jsonl' # 数据集路径
with jsonlines.open(dataset_file, 'w') as writer:
for fn in os.listdir(image_dir):
writer.write({
'text': SpecialTokens.image, # 仅放置特殊token
'images': [os.path.join(image_dir, fn)], # 将图片路径放入列表
}) 生成好的dataset.jsonl文件可以填入data-juicer配置文件中的dataset_path,然后使用你需要的算子开始处理。 你可以自己尝试一下,如还有其他问题可随时交流~ |
非常感谢!我试一下 |
您好!非常感谢解决了数据格式的问题,但我在使用本地的InternVL2_5-2B 并运行image-caption-mapper算子时出现了新的问题。大致是说没有指明text或text_target,运行信息与报错内容如下: 2025-02-28 08:38:07 | INFO | data_juicer.core.executor:52 - Using cache compression method: [None] |
这里附上我的输入数据内容 这里附上上述问题出现时的配置文件内容
|
另外我保持输入不变时,经常出现如下情况。 没有报错和告警,但在 Error/Warning details can be found in the log file [/data-juicer/outputs/demo-process/log/export_demo-processed.jsonl_time_20250228093051.txt] and its related log files. |
后续没有输出是因为复用了第一次处理失败时的cache,在测试时可以在配置文件中设置 |
好的,了解了,非常感谢~ |
Before Asking 在提问之前
I have read the README carefully. 我已经仔细阅读了 README 上的操作指引。
I have pulled the latest code of main branch to run again and the problem still existed. 我已经拉取了主分支上最新的代码,重新运行之后,问题仍不能解决。
Search before asking 先搜索,再提问
Question
我手上只有几张图片,我该怎么把他们处理成合法的输入格式呢,还是直接在process.yaml中把dataset_path写成包含图片的文件夹路径 或者单张图片路径也可以呢。我看到了fmt_conversion/multimodal/ 中dj数据格式的介绍,但还是不太清楚该如何组织这些输入图片
Additional 额外信息
No response
The text was updated successfully, but these errors were encountered: