准备模型权重与训练数据
获取模型权重与代码
本文档以Qwen系列模型为例介绍训练过程,表1 支持的大语言模型列表和权重获取地址中介绍了Qwen系列模型的权重获取地址。
|
训练模型 |
训练场景 |
训练框架 |
开源权重文件获取地址 |
|---|---|---|---|
|
Qwen3-8B |
SFT |
VeOmni |
|
|
Qwen3-30B-A3B |
SFT |
VeOmni |
|
|
Qwen3-32B |
SFT |
VeOmni |
|
|
Qwen3-VL-8B |
SFT |
VeOmni |
访问权重文件下载网站Huggingface时,需要配置代理,请在互联网查询解决方案。
下载好的模型权重文件,请上传至OBS桶中。基于OBS规划,OBS桶中文件存放目录示例如下:
obs://veomni/veomni-a2/Qwen3-8B obs://veomni/veomni-a2/Qwen3-32B obs://veomni/veomni-a2/Qwen3-30B-A3B obs://veomni/veomni-a2/Qwen3-VL-8B
获取训练数据
以Qwen3系列模型为例,不同类型模型使用不同数据集。
可以使用如下数据集。为避免容器内可能长时间下载数据集或处理数据集,在训练前请根据参考指导自行完成数据集下载、数据集处理等步骤。然后将处理完成的数据集或自行替换的其他数据集上传到OBS中。
- LLM模型(Qwen3-8B,Qwen3-32B,Qwen3-30B-A3B)
以tulu-3-sft-mixture为例
获取数据集
https://huggingface.co/datasets/allenai/tulu-3-sft-mixture
执行如下脚本处理数据集,获得 tulu-first2000.parquet 文件
import pyarrow.parquet as pq input_path = "tulu-3-sft-mixture/data/train-00000-of-00006.parquet" output_path = "tulu-first2000.parquet" # Read parquet file and extract the first 2000 rows table = pq.read_table(input_path) table_first_2000 = table.slice(0, 2000) pq.write_table(table_first_2000, output_path)
之后将处理好的数据集放入OBS桶内相应的位置。
- VL模型(Qwen3-VL-8B)
以 sharegpt4v_instruct_gpt4-vision_cap100k 为例
下载 COCO2017 数据集,并下载数据标注 JSON 文件 sharegpt4v_instruct_gpt4-vision_cap100k.json
https://images.cocodataset.org/zips/train2017.zip
https://huggingface.co/datasets/Lin-Chen/ShareGPT4V
执行如下脚本处理数据集,获得 sharegpt4v_instruct_gpt4-vision_cap100k_coco.json 文件
import json # 读取原始数据 with open('sharegpt4v_instruct_gpt4-vision_cap100k.json', 'r', encoding='utf-8') as f: data = json.load(f) filtered_data = [] for item in data: image_path = item.get('image', '') if image_path.startswith('coco'): new_item = item.copy() # 在 image 值前插入 /home/ma-user/modelarts/user-job-dir/veomni-vl/input/,这里与 COCO2017 数据集存放路径保持一致 # new_image_path = "/home/ma-user/modelarts/user-job-dir/veomni-vl/input/" + image_path new_image_path = "/home/ma-user/modelarts/user-job-dir/veomni-vl/input/" + image_path new_item.pop('image') new_item['images'] = [new_image_path] filtered_data.append(new_item) # 保存过滤后的数据 output_file = 'sharegpt4v_instruct_gpt4-vision_cap100k_coco.json' with open(output_file, 'w', encoding='utf-8') as f: json.dump(filtered_data, f, ensure_ascii=False, indent=4) print(f"已成功处理 {len(filtered_data)} 条数据,保存至:{output_file}")处理好的数据集格式如下
[ { "id": "xxx", "conversations": [ { "from": "human", "value": "xxx" }, { "from": "gpt", "value": "xxx" } ], "images": [ "/home/ma-user/modelarts/user-job-dir/veomni-vl/input/coco/train2017/xxx.jpg" ] }, ... ]之后将处理好的数据集放入OBS桶内相应的位置。