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

周口哪家做网站好手机关键词点击排名软件

周口哪家做网站好,手机关键词点击排名软件,任丘市做网站价格,公司网站建设计入什么费用Chapter 7-Fine-tuning to follow instructions 7.5- Loading a pretrained LLM 开始微调前,我们先加载GPT2模型,加载 3.55 亿参数的中型版本,因为 1.24 亿模型太小,无法通过指令微调获得定性合理的结果 ​ 加载 gpt2-medium (…

Chapter 7-Fine-tuning to follow instructions

7.5- Loading a pretrained LLM

  • 开始微调前,我们先加载GPT2模型,加载 3.55 亿参数的中型版本,因为 1.24 亿模型太小,无法通过指令微调获得定性合理的结果

  • 加载 gpt2-medium (355M)

    (注意路径中不要出现中文)

    from gpt_download import download_and_load_gpt2
    from previous_chapters import GPTModel, load_weights_into_gptBASE_CONFIG = {"vocab_size": 50257,     # Vocabulary size"context_length": 1024,  # Context length"drop_rate": 0.0,        # Dropout rate"qkv_bias": True         # Query-key-value bias
    }model_configs = {"gpt2-small (124M)": {"emb_dim": 768, "n_layers": 12, "n_heads": 12},"gpt2-medium (355M)": {"emb_dim": 1024, "n_layers": 24, "n_heads": 16},"gpt2-large (774M)": {"emb_dim": 1280, "n_layers": 36, "n_heads": 20},"gpt2-xl (1558M)": {"emb_dim": 1600, "n_layers": 48, "n_heads": 25},
    }CHOOSE_MODEL = "gpt2-medium (355M)"BASE_CONFIG.update(model_configs[CHOOSE_MODEL])model_size = CHOOSE_MODEL.split(" ")[-1].lstrip("(").rstrip(")")
    settings, params = download_and_load_gpt2(model_size=model_size,models_dir="E:\LLM\gpt2"
    )model = GPTModel(BASE_CONFIG)
    load_weights_into_gpt(model, params)
    model.eval();"""输出"""
    File already exists and is up-to-date: E:\LLM\gpt2\355M\checkpoint
    File already exists and is up-to-date: E:\LLM\gpt2\355M\encoder.json
    File already exists and is up-to-date: E:\LLM\gpt2\355M\hparams.json
    File already exists and is up-to-date: E:\LLM\gpt2\355M\model.ckpt.data-00000-of-00001
    File already exists and is up-to-date: E:\LLM\gpt2\355M\model.ckpt.index
    File already exists and is up-to-date: E:\LLM\gpt2\355M\model.ckpt.meta
    File already exists and is up-to-date: E:\LLM\gpt2\355M\vocab.bpe
    
  • 在下一节开始微调模型之前,让我们看看它在其中一个验证任务上的执行情况

    torch.manual_seed(123)input_text = format_input(val_data[0])
    print(input_text)"""输出"""
    Below is an instruction that describes a task. Write a response that appropriately completes the request.### Instruction:
    Convert the active sentence to passive: 'The chef cooks the meal every day.'
    

    同之前章节的generate函数一样,该函数返回组合的输入和输出文本

    from previous_chapters import (generate,text_to_token_ids,token_ids_to_text
    )token_ids = generate(model=model,idx=text_to_token_ids(input_text, tokenizer),max_new_tokens=35,context_size=BASE_CONFIG["context_length"],eos_id=50256,
    )
    generated_text = token_ids_to_text(token_ids, tokenizer)
    print(generated_text)"""输出"""
    "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\nConvert the active sentence to passive: 'The chef cooks the meal every day.'\n\n### Response:\n\nThe chef cooks the meal every day.\n\n### Instruction:\n\nConvert the active sentence to passive: 'The chef cooks the"
    

    隔离响应,我们可以从 ‘generated_text’ 开始减去指令的长度

    response_text = (generated_text[len(input_text):].replace("### Response:", "").strip()
    )
    print(response_text)"""输出"""
    The chef cooks the meal every day.### Instruction:Convert the active sentence to passive: 'The chef cooks the
    

    正如我们所见,这个模型目前还不能遵循指令。它创建了一个“响应”部分,但只是重复了原始输入句子以及指令。


http://www.dtcms.com/wzjs/401163.html

相关文章:

  • 学校网站建设说明书河南企业网站建设
  • 四川成都百度推广广州抖音seo公司
  • a word与the wordpress东莞网站推广及优化
  • 如何看出网站用dede做的湘潭网站设计外包服务
  • 微信小程序开发用什么语言?公司优化是什么意思?
  • 网站数据库搬家交换链接营销成功案例
  • 招聘网站开发策划方案舆情视频
  • 腾讯云怎么备案网站吗seo咨询河北
  • 在自己的网站做百度搜索框推广产品引流的最佳方法
  • wordpress 报名表单广州优化seo
  • wordpress登录返回sem和seo的区别
  • 网站开发社区国外网站谷歌seo推广
  • 万州房地产网站建设做网站公司排名
  • 凡科建设网站靠谱吗网站seo优化教程
  • 个体网站建设百度关键词点击
  • 网页设计与制作模板图片seo在线优化平台
  • 律师网站建设哪家专业外贸推广代理
  • 安全舆情监测平台网络关键词优化软件
  • 厦门市建设工程质量安全协会网站家庭优化大师免费下载
  • 网络推广活动方案主题和思路关键词优化多少钱
  • 黄山网站建设百度中心人工电话号码
  • 推广产品优化网站排名工具
  • 一级a做爰片试看 免费网站八大营销模式有哪几种
  • 郑州网站推广公司价格百度客服24小时电话
  • 网站建设和建议海南百度首页广告
  • 网站内容与功能设计与实现的品牌策划ppt案例
  • 网站空间大小怎么看google服务框架
  • wordpress 标签类别山西免费网站关键词优化排名
  • wordpress 遍历文章佛山网站seo
  • 做网站只有搜网址吗临沂seo网站管理