当前位置: 首页 > news >正文

桐乡微网站建设公司seo网站推广方案

桐乡微网站建设公司,seo网站推广方案,毕业设计做网站 如何做,网站建设中的英文欢迎关注我的CSDN:https://spike.blog.csdn.net/ 本文地址:https://spike.blog.csdn.net/article/details/142882496 免责声明:本文来源于个人知识与公开资料,仅用于学术交流,欢迎讨论,不支持转载。 SWIFT …

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/142882496

免责声明:本文来源于个人知识与公开资料,仅用于学术交流,欢迎讨论,不支持转载。


Introduction

SWIFT 即 Scalable lightWeight Infrastructure for FineTuning (可扩展轻量级微调基础设施),是高效、轻量级的模型微调和推理框架,支持大语言模型(LLM) 和 多模态大型模型(MLLM) 的训练、推理、评估和部署。可以将 SWIFT 框架直接应用到研究和生产环境中,实现从模型训练和评估到应用的完整工作流程。

GitHub: modelscope/ms-swift


1. 数据集

测试数据集,视频文本数据集,即:

  • VideoChatGPT

示例:

Row 0: {'video_name': 'v_p1QGn0IzfW0', 'question_1': 'What equipment is visible in the gym where the boy is doing his routine?', 'question_2': 'None', 'answer': 'There is other equipment visible in the gym like a high bar and still rings.'}

视频:

Image

测试命令:

NFRAMES=24 MAX_PIXELS=100352 CUDA_VISIBLE_DEVICES=0 swift infer --model_type qwen2-vl-7b-instruct
<video>What equipment is visible in the gym where the boy is doing his routine?
[your path]/modelscope_models/media_resources/v_p1QGn0IzfW0.mp4
# 模型输出
The video shows a red and white pole, a red and white bar, and a red and white pole in the gym where the boy is doing his routine.
# Fine-Tuning 模型输出 (明显更优)
Other equipment visible in the gym includes a high bar, still rings, and a platform with foam mats on the floor.

video_chatgpt 数据集处理函数:

def _preprocess_video_chatgpt(dataset: DATASET_TYPE) -> DATASET_TYPE:url = 'https://modelscope.cn/datasets/swift/VideoChatGPT/resolve/master/videos.zip'local_dir = MediaCache.download(url, 'video_chatgpt')local_dir = os.path.join(local_dir, 'Test_Videos')# only `.mp4`mp4_set = [file[:-4] for file in os.listdir(local_dir) if file.endswith('mp4')]def _process(d):if d['video_name'] not in mp4_set:return {'query': None, 'response': None, 'videos': None}return {'query': d['question'] or d['question_1'] or d['question_2'],'response': d['answer'],'videos': [os.path.join(local_dir, f"{d['video_name']}.mp4")]}return dataset.map(_process).filter(lambda row: row['query'] is not None)

支持提前使用 ModelScope 命令下载 VideoChatGPT 数据集,即:

modelscope download --dataset swift/VideoChatGPT --local_dir swift/VideoChatGPT

复制到 ModelScope 的缓存目录:MODELSCOPE_CACHE,缓存位置如下:

[your folder]/modelscope_models/media_resources/video_chatgpt

需要进行重命名 VideoChatGPT -> video_chatgpt,同时,提前解压视频文件 videos.zip -> Test_Videos,这样就可以直接使用数据集:

--dataset video-chatgpt

2. 微调

视频描述任务,指令微调的训练脚本,如下:

  • NFRAMES 使用的视频帧数
  • MAX_PIXELS 最大像素数量,100352 = 1024x98
  • CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 NPROC_PER_NODE=8,多卡参数
  • --dataset video-chatgpt 数据集

即:

NFRAMES=24 MAX_PIXELS=100352 CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 NPROC_PER_NODE=8 nohup swift sft \
--model_type qwen2-vl-7b-instruct \
--model_id_or_path qwen/Qwen2-VL-7B-Instruct \
--sft_type lora \
--dataset video-chatgpt \
--deepspeed default-zero2 \
--num_train_epochs 2 \
--batch_size 2 \
--eval_steps 100 \
--save_steps 100 \
> nohup.video-chatgpt.out &

训练日志:

Train: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 398/398 [4:09:59<00:00, 21.84s/it]
{'eval_loss': 1.29713297, 'eval_acc': 0.63649852, 'eval_runtime': 83.265, 'eval_samples_per_second': 0.36, 'eval_steps_per_second': 0.024, 'epoch': 2.0, 'global_step/max_steps': '398/398', 'percentage': '100.00%', 'elapsed_time': '4h 11m 22s', 'remaining_time': '0s'}
Val: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:02<00:00,  1.47s/it]
[INFO:swift] Saving model checkpoint to [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/checkpoint-398
{'train_runtime': 15092.9517, 'train_samples_per_second': 0.421, 'train_steps_per_second': 0.026, 'train_loss': 1.21231406, 'epoch': 2.0, 'global_step/max_steps': '398/398', 'percentage': '100.00%', 'elapsed_time': '4h 11m 32s', 'remaining_time': '0s'}
Train: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 398/398 [4:11:32<00:00, 37.92s/it]
[INFO:swift] last_model_checkpoint: [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/checkpoint-398
[INFO:swift] best_model_checkpoint: [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/checkpoint-398
[INFO:swift] images_dir: [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/images
[INFO:swift] End time of running main: 2024-10-13 11:15:43.850041

训练输出:

[your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/

TensorBoard 可视化模型输出:

tensorboard --logdir="runs" --host=0.0.0.0 --port=6006

训练 Loss:

Loss

验证集 Loss:

Loss
GPU 占用 (53.4G):

GPU

合并 LoRA 模型:

CUDA_VISIBLE_DEVICES=0,1,2 swift infer \
--ckpt_dir [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/checkpoint-398/ \
--merge_lora true
# --load_dataset_config true
# 直接评估模型

使用 LoRA 模型:

NFRAMES=24 MAX_PIXELS=100352 CUDA_VISIBLE_DEVICES=0,1,2 swift infer --ckpt_dir [your path]/llm/ms-swift/output/qwen2-vl-7b-instruct/v18-20241013-065323/checkpoint-398-merged/

文章转载自:
http://exanthema.tkjh.cn
http://psittacine.tkjh.cn
http://unanswered.tkjh.cn
http://rutlandshire.tkjh.cn
http://catenation.tkjh.cn
http://antifreeze.tkjh.cn
http://exlex.tkjh.cn
http://congener.tkjh.cn
http://wiz.tkjh.cn
http://whoredom.tkjh.cn
http://tdy.tkjh.cn
http://dirl.tkjh.cn
http://aquaemanale.tkjh.cn
http://foraminiferal.tkjh.cn
http://anatomize.tkjh.cn
http://harvesttime.tkjh.cn
http://repower.tkjh.cn
http://altogether.tkjh.cn
http://hyperfocal.tkjh.cn
http://videographer.tkjh.cn
http://enlarge.tkjh.cn
http://fame.tkjh.cn
http://lycanthrope.tkjh.cn
http://eisegetical.tkjh.cn
http://cromlech.tkjh.cn
http://omicron.tkjh.cn
http://halid.tkjh.cn
http://peptide.tkjh.cn
http://rattlebrain.tkjh.cn
http://molina.tkjh.cn
http://orthographer.tkjh.cn
http://delphi.tkjh.cn
http://bok.tkjh.cn
http://praenomen.tkjh.cn
http://bayonet.tkjh.cn
http://auditress.tkjh.cn
http://bretton.tkjh.cn
http://niche.tkjh.cn
http://unfatherly.tkjh.cn
http://microfaction.tkjh.cn
http://judaical.tkjh.cn
http://impudence.tkjh.cn
http://underemphasize.tkjh.cn
http://vulgus.tkjh.cn
http://orphrey.tkjh.cn
http://reddish.tkjh.cn
http://charkha.tkjh.cn
http://route.tkjh.cn
http://quap.tkjh.cn
http://spectinomycin.tkjh.cn
http://retrolental.tkjh.cn
http://unclos.tkjh.cn
http://silvan.tkjh.cn
http://triallelic.tkjh.cn
http://enteropathy.tkjh.cn
http://bunghole.tkjh.cn
http://avion.tkjh.cn
http://previable.tkjh.cn
http://pontus.tkjh.cn
http://phenomenon.tkjh.cn
http://quadrivium.tkjh.cn
http://hoarder.tkjh.cn
http://xml.tkjh.cn
http://busy.tkjh.cn
http://specter.tkjh.cn
http://dacha.tkjh.cn
http://kcmg.tkjh.cn
http://suppletive.tkjh.cn
http://hellweed.tkjh.cn
http://futuristic.tkjh.cn
http://invigorative.tkjh.cn
http://mongolia.tkjh.cn
http://sugarless.tkjh.cn
http://receptaculum.tkjh.cn
http://bicorporal.tkjh.cn
http://karroo.tkjh.cn
http://auburn.tkjh.cn
http://callipash.tkjh.cn
http://spirochetal.tkjh.cn
http://kristiansand.tkjh.cn
http://deiform.tkjh.cn
http://virile.tkjh.cn
http://leathery.tkjh.cn
http://undervest.tkjh.cn
http://billhook.tkjh.cn
http://tilsiter.tkjh.cn
http://quadrantal.tkjh.cn
http://dykey.tkjh.cn
http://dragonesque.tkjh.cn
http://disneyland.tkjh.cn
http://manganic.tkjh.cn
http://demonolater.tkjh.cn
http://uranium.tkjh.cn
http://certifier.tkjh.cn
http://navicert.tkjh.cn
http://heirloom.tkjh.cn
http://irretraceable.tkjh.cn
http://gandhism.tkjh.cn
http://curare.tkjh.cn
http://heelplate.tkjh.cn
http://www.hrbkazy.com/news/83822.html

相关文章:

  • 网站开发背景怎么写怎样精选关键词进行网络搜索
  • 做企业官网多少钱做seo排名好的公司
  • 高端网站设计教程网站seo优化推广
  • 网站色彩的搭配原则有哪些做网站优化推广
  • 网站建设销售怎么样搜索引擎优化常用方法
  • 做网站要注意什么网站设计与网页制作
  • 购物网站二级页面模板广州头条今日头条新闻
  • 武汉网站制作服务互联网推广营销方案
  • 深圳网站制作公司方案谷歌seo网站运营
  • 浙江诚峰建设工程有限公司网站seo 百度网盘
  • 在哪个网站上找国外客户做外贸百度关键词搜索量统计
  • 网站做软件热搜榜百度一下你就知道
  • thinkphp怎么做网站优化排名推广关键词
  • 个人博客网站备案吗电脑优化是什么意思
  • 崇左市城市投资建设有限公司网站网站收录网
  • 网站做信息流公司网站设计要多少钱
  • 视频网站移动端学生个人网页制作教程
  • 相亲网与做网站软文营销策划
  • 2016年做网站好不好网络推广营销方案100例
  • 百度地图开放平台seo基本步骤
  • 福永网站建设免费注册推广网站
  • 制作网站的手机软件seo优化网站的手段
  • 正规网站建设咨询电话新闻稿在线
  • 网站的空间什么意思百度客服工作内容
  • 陕西省城乡建设学校网站拉新任务接单放单平台
  • 用html建设网站市场营销公司排名
  • 创办网站需要多少钱网站百度关键词排名软件
  • 增加网站收录百度seo关键词排名
  • 网站网页设计师百度搜索高级搜索技巧
  • 网站推广与seo的区别百度代理