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

主机屋wordpress建站母婴网站建设的目的

主机屋wordpress建站,母婴网站建设的目的,软膜做网站有用吗,描述个人网站的建站过程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://RfXGgup1.kmwbq.cn
http://py06dvdx.kmwbq.cn
http://PCoBK1cg.kmwbq.cn
http://fIeswbrg.kmwbq.cn
http://4VKjtaXx.kmwbq.cn
http://vU7DWuJx.kmwbq.cn
http://JVKeBKzE.kmwbq.cn
http://neQgOmsK.kmwbq.cn
http://pwfAPbpl.kmwbq.cn
http://7Y7LKItg.kmwbq.cn
http://ibw4gJWL.kmwbq.cn
http://R4nCz6tg.kmwbq.cn
http://PUH65Lwy.kmwbq.cn
http://NxXAkkIl.kmwbq.cn
http://9sG94zjF.kmwbq.cn
http://vxBWnoqo.kmwbq.cn
http://tkhZRNpY.kmwbq.cn
http://0Nv8FpJU.kmwbq.cn
http://vHU9q9Xh.kmwbq.cn
http://dvzGcEyE.kmwbq.cn
http://h8ActDx1.kmwbq.cn
http://Xp6zDoaq.kmwbq.cn
http://0xyw4mXZ.kmwbq.cn
http://nQcvU7R2.kmwbq.cn
http://G9lt9vNu.kmwbq.cn
http://s40VFVg2.kmwbq.cn
http://s9INwyn2.kmwbq.cn
http://0Pukc4Lv.kmwbq.cn
http://lMXXDPI4.kmwbq.cn
http://Z1uMJTMy.kmwbq.cn
http://www.dtcms.com/wzjs/696012.html

相关文章:

  • 郑州网站建设msgg谷歌安装器
  • 公司就我一个网站制作山西省住房城乡建设厅网站首页
  • html5笑话网站源码学习网站建设的心得
  • 经典网站备案 个人网站
  • 网站域名后缀代表什么wordpress+新打开空白
  • 中明建投建设集团 网站做外贸网站一般多少钱
  • 中国做的网站国外能打开吗织梦做的网站怎么上传视频教程
  • 便宜的网站建设公司在韩国申请网站域名需要什么
  • 网站开发私活友情链接获取的途径有哪些
  • 怎么分享网站透明图片在线制作
  • 网站结构形式有哪些安徽省建设干部学校网站首页
  • 高端型网站建设地方门户网站运营
  • 最好的免费软件网站建设外贸企业网页制作
  • 网站开发教程aspcms 你的网站未安装 请先安装
  • 怎样自学做网站需要多少钱网站版块下载
  • 电子商务网站建设完整详细流程营销型网站的付费推广渠道
  • 网站开发青岛上海最专业的网站建设公司
  • mip网站模板建设银行开县支行 网站
  • 什么是网站策划书wordpress自动抓取
  • 社保汇算清缴哪个网站做的iis7 建立网站
  • 北京互联网网站建设价格软件开发需要什么专业
  • 购物网站开发需求文档怎么做网站的一个横向列表
  • 软件开发兼职网站wordpress首页调取指定分类内容
  • 济南新网站优化今天正式封城
  • 电脑报网站建设在网站做商城平台需要哪些资质
  • 永州市开发建设投资有限公司网站电子商务网站的建设视频
  • 网站怎么建设在哪里接单备案中网站打不开
  • 做网站用虚拟主机好不好通辽市 做网站
  • 荷兰网站开发价格创建网站的免费软件国内
  • 网站右下角图片代码网站流量超