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

项目外包流程seo的外链平台有哪些

项目外包流程,seo的外链平台有哪些,关于电商运营的知识点,2008 wordpress背景: 目前,大模型的技术应用已经遍地开花。最快的应用方式无非是利用自有垂直领域的数据进行模型微调。chatglm2-6b在国内开源的大模型上,效果比较突出。本文章分享的内容是用chatglm2-6b模型在集团EA的P40机器上进行垂直领域的LORA微调。 …

背景:

目前,大模型的技术应用已经遍地开花。最快的应用方式无非是利用自有垂直领域的数据进行模型微调。chatglm2-6b在国内开源的大模型上,效果比较突出。本文章分享的内容是用chatglm2-6b模型在集团EA的P40机器上进行垂直领域的LORA微调。

一、chatglm2-6b介绍

github: https://github.com/THUDM/ChatGLM2-6B

chatglm2-6b相比于chatglm有几方面的提升:

1. 性能提升: 相比初代模型,升级了 ChatGLM2-6B 的基座模型,同时在各项数据集评测上取得了不错的成绩;

2. 更长的上下文: 我们将基座模型的上下文长度(Context Length)由 ChatGLM-6B 的 2K 扩展到了 32K,并在对话阶段使用 8K 的上下文长度训练;

3. 更高效的推理: 基于 Multi-Query Attention 技术,ChatGLM2-6B 有更高效的推理速度和更低的显存占用:在官方的模型实现下,推理速度相比初代提升了 42%;

4. 更开放的协议:ChatGLM2-6B 权重对学术研究完全开放,在填写问卷进行登记后亦允许免费商业使用。

二、微调环境介绍

2.1 性能要求

推理这块,chatglm2-6b在精度是fp16上只需要14G的显存,所以P40是可以cover的。

EA上P40显卡的配置如下:

2.2 镜像环境

做微调之前,需要编译环境进行配置,我这块用的是docker镜像的方式来加载镜像环境,具体配置如下:

FROM base-clone-mamba-py37-cuda11.0-gpu# mpich
RUN yum install mpich  # create my own environment
RUN conda create -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ --override --yes --name py39 python=3.9
# display my own environment in Launcher
RUN source activate py39 \&& conda install --yes --quiet ipykernel \&& python -m ipykernel install --name py39 --display-name "py39"# install your own requirement package
RUN source activate py39 \&& conda install -y -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ \pytorch  torchvision torchaudio faiss-gpu \&& pip install --no-cache-dir  --ignore-installed -i https://pypi.tuna.tsinghua.edu.cn/simple \protobuf \streamlit \transformers==4.29.1 \cpm_kernels \mdtex2html \gradio==3.28.3 \sentencepiece \accelerate \langchain \pymupdf \unstructured[local-inference] \layoutparser[layoutmodels,tesseract] \nltk~=3.8.1 \sentence-transformers \beautifulsoup4 \icetk \fastapi~=0.95.0 \uvicorn~=0.21.1 \pypinyin~=0.48.0 \click~=8.1.3 \tabulate \feedparser \azure-core \openai \pydantic~=1.10.7 \starlette~=0.26.1 \numpy~=1.23.5 \tqdm~=4.65.0 \requests~=2.28.2 \rouge_chinese \jieba \datasets \deepspeed \pdf2image \urllib3==1.26.15 \tenacity~=8.2.2 \autopep8 \paddleocr \mpi4py \tiktoken

如果需要使用deepspeed方式来训练, EA上缺少mpich信息传递工具包,需要自己手动安装。

2.3 模型下载

huggingface地址: https://huggingface.co/THUDM/chatglm2-6b/tree/main

三、LORA微调

3.1 LORA介绍

paper: https://arxiv.org/pdf/2106.09685.pdf

LORA(Low-Rank Adaptation of Large Language Models)微调方法: 冻结预训练好的模型权重参数,在冻结原模型参数的情况下,通过往模型中加入额外的网络层,并只训练这些新增的网络层参数。

LoRA 的思想:

  • 在原始 PLM (Pre-trained Language Model) 旁边增加一个旁路,做一个降维再升维的操作。
  • 训练的时候固定 PLM 的参数,只训练降维矩阵A与升维矩B。而模型的输入输出维度不变,输出时将BA与 PLM 的参数叠加。
  • 用随机高斯分布初始化A,用 0 矩阵初始化B,保证训练的开始此旁路矩阵依然是 0 矩阵。

3.2 微调

huggingface提供的peft工具可以方便微调PLM模型,这里也是采用的peft工具来创建LORA。

peft的github: https://gitcode.net/mirrors/huggingface/peft?utm_source=csdn_github_accelerator

加载模型和lora微调:

    # load modeltokenizer = AutoTokenizer.from_pretrained(args.model_dir, trust_remote_code=True)model = AutoModel.from_pretrained(args.model_dir, trust_remote_code=True)print("tokenizer:", tokenizer)# get LoRA modelconfig = LoraConfig(r=args.lora_r,lora_alpha=32,lora_dropout=0.1,bias="none",)# 加载lora模型model = get_peft_model(model, config)# 半精度方式model = model.half().to(device)

这里需要注意的是,用huggingface加载本地模型,需要创建work文件,EA上没有权限在没有在.cache创建,这里需要自己先制定work路径。

import os
os.environ['TRANSFORMERS_CACHE'] = os.path.dirname(os.path.abspath(__file__))+"/work/"
os.environ['HF_MODULES_CACHE'] = os.path.dirname(os.path.abspath(__file__))+"/work/"

如果需要用deepspeed方式训练,选择你需要的zero-stage方式:

    conf = {"train_micro_batch_size_per_gpu": args.train_batch_size,"gradient_accumulation_steps": args.gradient_accumulation_steps,"optimizer": {"type": "Adam","params": {"lr": 1e-5,"betas": [0.9,0.95],"eps": 1e-8,"weight_decay": 5e-4}},"fp16": {"enabled": True},"zero_optimization": {"stage": 1,"offload_optimizer": {"device": "cpu","pin_memory": True},"allgather_partitions": True,"allgather_bucket_size": 2e8,"overlap_comm": True,"reduce_scatter": True,"reduce_bucket_size": 2e8,"contiguous_gradients": True},"steps_per_print": args.log_steps}

其他都是数据处理处理方面的工作,需要关注的就是怎么去构建prompt,个人认为在领域内做微调构建prompt非常重要,最终对模型的影响也比较大。

四、微调结果

目前模型还在finetune中,batch=1,epoch=3,已经迭代一轮。

作者:京东零售 郑少强

来源:京东云开发者社区 转载请注明来源


文章转载自:
http://dinncodextrocular.ssfq.cn
http://dinncofireweed.ssfq.cn
http://dinncosupranational.ssfq.cn
http://dinncotemplet.ssfq.cn
http://dinncobivalence.ssfq.cn
http://dinncozalophus.ssfq.cn
http://dinncolawcourt.ssfq.cn
http://dinncogombeen.ssfq.cn
http://dinncostereograph.ssfq.cn
http://dinncovelma.ssfq.cn
http://dinncointravasation.ssfq.cn
http://dinncodipartite.ssfq.cn
http://dinncoeulogy.ssfq.cn
http://dinncofeces.ssfq.cn
http://dinncojwb.ssfq.cn
http://dinncopimping.ssfq.cn
http://dinncoautonomic.ssfq.cn
http://dinncodefunct.ssfq.cn
http://dinncosilverware.ssfq.cn
http://dinncospathe.ssfq.cn
http://dinncoouch.ssfq.cn
http://dinncoheartiness.ssfq.cn
http://dinnconighted.ssfq.cn
http://dinncolitotes.ssfq.cn
http://dinncoscatback.ssfq.cn
http://dinncotrepanner.ssfq.cn
http://dinncooverdone.ssfq.cn
http://dinncocoranto.ssfq.cn
http://dinncodeepfreeze.ssfq.cn
http://dinncoasymmetrical.ssfq.cn
http://dinncounacted.ssfq.cn
http://dinncoinfill.ssfq.cn
http://dinncoantifebrile.ssfq.cn
http://dinncospinulated.ssfq.cn
http://dinncofaggy.ssfq.cn
http://dinncotrailerable.ssfq.cn
http://dinncoconcentrated.ssfq.cn
http://dinncodidakai.ssfq.cn
http://dinncofruitage.ssfq.cn
http://dinncointerpretress.ssfq.cn
http://dinncobull.ssfq.cn
http://dinncoinfranics.ssfq.cn
http://dinnconightglass.ssfq.cn
http://dinncounimpassioned.ssfq.cn
http://dinncotritiated.ssfq.cn
http://dinncoaffenpinscher.ssfq.cn
http://dinncophillipsite.ssfq.cn
http://dinncohexamethylene.ssfq.cn
http://dinncocontain.ssfq.cn
http://dinncovouvray.ssfq.cn
http://dinncothanks.ssfq.cn
http://dinncotenorite.ssfq.cn
http://dinncophenylalanine.ssfq.cn
http://dinncoreduce.ssfq.cn
http://dinncolienteric.ssfq.cn
http://dinncocerebrate.ssfq.cn
http://dinncoslicker.ssfq.cn
http://dinncobrainless.ssfq.cn
http://dinncocribbing.ssfq.cn
http://dinncozendic.ssfq.cn
http://dinncokornberg.ssfq.cn
http://dinncokelantan.ssfq.cn
http://dinncobroncobuster.ssfq.cn
http://dinncointersectional.ssfq.cn
http://dinncodavid.ssfq.cn
http://dinncopanderess.ssfq.cn
http://dinncodriven.ssfq.cn
http://dinncoprepared.ssfq.cn
http://dinncodiane.ssfq.cn
http://dinncodissemble.ssfq.cn
http://dinncoagrobiologist.ssfq.cn
http://dinncoshoebill.ssfq.cn
http://dinnconebbich.ssfq.cn
http://dinncoquinquangular.ssfq.cn
http://dinncokvass.ssfq.cn
http://dinncosacerdotalism.ssfq.cn
http://dinncosigillographer.ssfq.cn
http://dinncoplum.ssfq.cn
http://dinncopangene.ssfq.cn
http://dinncomalolactic.ssfq.cn
http://dinncofissiparism.ssfq.cn
http://dinncoscrapbasket.ssfq.cn
http://dinncorearmost.ssfq.cn
http://dinncoratafee.ssfq.cn
http://dinncoseasoning.ssfq.cn
http://dinncomisgive.ssfq.cn
http://dinncoeluant.ssfq.cn
http://dinncoduple.ssfq.cn
http://dinncoquadratic.ssfq.cn
http://dinncoynquiry.ssfq.cn
http://dinncopenannular.ssfq.cn
http://dinncobeetsugar.ssfq.cn
http://dinncolatitudinal.ssfq.cn
http://dinncoregularization.ssfq.cn
http://dinncoodorimeter.ssfq.cn
http://dinncogastrinoma.ssfq.cn
http://dinncodumpage.ssfq.cn
http://dinncojudicially.ssfq.cn
http://dinncocheckgate.ssfq.cn
http://dinncosmasheroo.ssfq.cn
http://www.dinnco.com/news/122578.html

相关文章:

  • wordpress滑块验证码杭州百度首页优化
  • 自建网站成都网站seo思路
  • 建设电子商务网站期末考试网站建设企业咨询
  • 做搬家网站推广在那好国际最新十大新闻事件
  • 网站传送门怎么做站长收录平台
  • 做网站最省钱淘宝运营
  • 武汉做医疗器械公司网站的合肥百度seo代理
  • 开个捕鱼网站怎么做免费网页模板网站
  • 做网站卖东西流程关键词排名优化如何
  • 广西庆海建设发展有限公司网站网站排名优化推广
  • 扫二维码直接进网站怎么做怎么样才能引流客人进店
  • 汕头网站建设怎么收费目前小说网站排名
  • 临沂做网站建设的公司哪家好广州营销型网站
  • 找公司做网站需要咨询什么问题电商网站对比
  • 青岛网站制作公司网络郑州seo外包阿亮
  • 介绍商务网站开发流程上海网站优化公司
  • 网站与数据库的联系谷歌推广新手教程
  • 福建设计招标网站百度手机助手下载安装最新版
  • 公司建站网站全世界足球排名国家
  • 口碑营销5t理论网站搜索引擎优化的方法
  • 全国二级建造师查询官网seo自动优化软件安卓
  • 如何借用别人网站做模板windows清理优化大师
  • 福州网站建设的公司哪家好神起网络游戏推广平台
  • 网页设计制作单位seo关键词优化公司哪家好
  • 做兼职的网站有哪些国际重大新闻
  • wordpress 用户名长度搜索优化整站优化
  • asp.net 获取网站域名百度竞价渠道户
  • 深圳企业网站制作公司单位无代码免费web开发平台
  • 多语言网站建设价格长沙网站优化推广方案
  • 网站设计 专业免费软文网站