ADD file via upload
外部数据集:https://github.com/NiuTrans/Classical-Modern/tree/main
git clone https://github.com/NiuTrans/Classical-Modern.git cd Classical-Modern #将data_process.py移动至此 python data_process.py #源数据集太大了,我们随机抽取1000条 python SampleData.py #将SampleData.py移动至此
git clone https://github.com/modelscope/swift cd swift pip install '.[llm]'
使用我们得到的数据集进行训练
CUDA_VISIBLE_DEVICES=0 \ swift sft \ --model_type qwen2-7b-instruct \ --sft_type lora \ --output_dir output \ --dataset /mnt/workspace/sample_train.json \ --num_train_epochs 1 \ --max_length 1024 \ --check_dataset_strategy warning \ --lora_rank 8 \ --lora_alpha 32 \ --lora_dropout_p 0.05 \ --lora_target_modules ALL \ --gradient_checkpointing true \ --batch_size 1 \ --learning_rate 5e-5 \ --gradient_accumulation_steps 16 \ --max_grad_norm 1.0 \ --warmup_ratio 0.03 \ --eval_steps 100 \ --save_steps 100 \ --save_total_limit 2 \ --logging_steps 10
使用单卡进行训练,大概占用18G显存,训练时长1h。
[INFO:swift] last_model_checkpoint: /mnt/workspace/swift/output/qwen2-7b-instruct/v4-20240910-200150/checkpoint-618 [INFO:swift] best_model_checkpoint: /mnt/workspace/swift/output/qwen2-7b-instruct/v4-20240910-200150/checkpoint-600 [INFO:swift] images_dir: /mnt/workspace/swift/output/qwen2-7b-instruct/v4-20240910-200150/images [INFO:swift] End time of running main: 2024-09-10 20:42:01.606055
将现代白话转化为文言文
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
数据处理
外部数据集:https://github.com/NiuTrans/Classical-Modern/tree/main
微调
使用我们得到的数据集进行训练
使用单卡进行训练,大概占用18G显存,训练时长1h。