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

佛山网站设计哪里好wordpress更新配置

佛山网站设计哪里好,wordpress更新配置,小公司做网站的实力,小程序 wordpress除非你一直生活在岩石下#xff0c;否则你一定听说过像 Auto-GPT 和 MetaGPT 这样的项目。 这些是社区为使 GPT-4 完全自治而做出的尝试。在其最原始的形式中#xff0c;代理基本上是文本到任务。你输入一个任务描述#xff0c;比如“给我做一个贪吃蛇游戏”#xff0c;并使…除非你一直生活在岩石下否则你一定听说过像 Auto-GPT 和 MetaGPT 这样的项目。 这些是社区为使 GPT-4 完全自治而做出的尝试。在其最原始的形式中代理基本上是文本到任务。你输入一个任务描述比如“给我做一个贪吃蛇游戏”并使用LLM作为它的大脑和一些围绕它构建的工具你就得到了自己的贪吃蛇游戏 看连我也做了一个 你可以做得比这更大但在做大之前让我们从小而简单的开始创建一个可以做一些数学运算的代理为此我们从 Gorilla 中汲取灵感这是一个与大量 API 连接的LLM。 首先我们选择LLM并创建一个数据集。 在本教程中我们将使用 meta-llama/Llama-2–7b-chat-hf 模型和 rohanbalkondekar/generate_json 数据集。代码可以从这里访问。 是的有一种更好的数学方法例如通过使用 py-expression-eval 使用 JavaScript 的 eval 函数来进行数学表达式但我将使用这种类似于 API 调用中的有效负载的格式尽管如此它只是简单的 add( a,b) 函数或在本例中为 add(8945, 1352)  { function_name: add, parameter_1: 8945, parameter_2: 1352 }微调就像对现有项目进行更改而不是从头开始开发所有内容。 这就是为什么我们使用 Llama-2-7b-chat 模型而不仅仅是预先训练的模型 Llama-2–7b这会让我们的事情变得更容易。 如果我们使用 Llama-2-chat我们必须使用以下提示格式 s[INST] SYS {{ system_prompt }} /SYS{{ user_message }} [/INST]你还可以使用较小的模型例如 microsoft/phi-1.5来执行简单任务或者像我一样 GPU 不足。 由于 Microsoft 仅发布了预训练模型因此你可以使用社区发布的微调模型例如 openaccess-ai-collective/phi-platypus-qlora 或 teknium/Puffin-Phi-v2 。 对于 teknium/Puffin-Phi-v2提示模板为 USER: prompt ASSISTANT:现在我们遇到了一个问题有如此多的模型如 llama、phi、mistral、falcon 等你不能只将模型名称更改为 model_path microsoft/phi-1.5 并期望一切正常。 如果有一个工具可以做到这一点是不是很棒这就是 axolotl  ###Installationgit clone https://github.com/OpenAccess-AI-Collective/axolotl cd axolotlpip3 install packaging pip3 install -e .[flash-attn,deepspeed] pip3 install -U githttps://github.com/huggingface/peft.git有时安装axolotl可能会很棘手。确保 CUDA 11.7Python 3.9Pytorch 2.0PyTorch 版本与 Cuda 版本匹配创建新的虚拟环境或docker 这里我们使用以下数据集rohanbalkondekar/maths_function_calls 下载或创建名为“maths_function_calls.jsonl”的文件然后复制并粘贴上述链接中的内容。 然后从示例文件夹中复制现有模型的 .yml 文件并根据需要更改参数。 或者创建一个全新的 .yml 文件例如 phi-finetune.yml其配置如下 base_model: teknium/Puffin-Phi-v2 base_model_config: teknium/Puffin-Phi-v2 model_type: AutoModelForCausalLM tokenizer_type: AutoTokenizer is_llama_derived_model: false trust_remote_code: trueload_in_8bit: false load_in_4bit: true strict: falsedatasets:- path: maths_function_calls.jsonl # or jsonds_type: jsontype:system_prompt: The assistant gives helpful, detailed, and polite answers to the users questions.\nno_input_format: |-USER: {instruction}|endoftext|ASSISTANT:format: |-USER: {instruction}{input}|endoftext|ASSISTANT:dataset_prepared_path: last_run_prepared val_set_size: 0.05 output_dir: ./phi-finetunedsequence_len: 1024 sample_packing: false # not CURRENTLY compatible with LoRAs pad_to_sequence_len:adapter: qlora lora_model_dir: lora_r: 64 lora_alpha: 32 lora_dropout: 0.05 lora_target_linear: true lora_fan_in_fan_out:wandb_project: wandb_entity: wandb_watch: wandb_run_id: wandb_log_model:gradient_accumulation_steps: 1 micro_batch_size: 1 num_epochs: 50 optimizer: adamw_torch adam_beta2: 0.95 adam_epsilon: 0.00001 max_grad_norm: 1.0 lr_scheduler: cosine learning_rate: 0.000003train_on_inputs: false group_by_length: true bf16: true fp16: false tf32: truegradient_checkpointing: early_stopping_patience: resume_from_checkpoint: local_rank: logging_steps: 1 xformers_attention: flash_attention:warmup_steps: 100 eval_steps: 0.05 save_steps: debug: deepspeed: weight_decay: 0.1 fsdp: fsdp_config: resize_token_embeddings_to_32x: true special_tokens:bos_token: |endoftext|eos_token: |endoftext|unk_token: |endoftext|pad_token: |endoftext|使用以下命令开始微调 accelerate launch -m axolotl.cli.train phi-finetune.yml你将开始收到这样的日志这意味着微调正在进行中。 {loss: 0.0029, learning_rate: 1.7445271850805345e-07, epoch: 20.44} 85%|███████████████████████████████████████████████████████████▌ | 1942/2280 [06:1301:14, 4.51it/s]attention_mask is not supported during training. Using it might lead to unexpected results.微调完成后会得到一个新目录 phi-finetuned。现在使用以下命令开始推断微调模型。 accelerate launch -m axolotl.cli.inference phi-ft.yml --lora_model_dir./phi-finetuned现在按照自定义提示模板如果输入 The assistant gives helpful, detailed, and polite answers to the users questions. USER: Reply with json for the following question: I want to do a total of 8945 and 1352 |endoftext| ASSISTANT: Here is your generated JSON:你应该收到以下输出 The assistant gives helpful, detailed, and polite answers to the users questions. USER: Reply with json for the following question: I want to do a total of 8945 and 1352|endoftext|ASSISTANT: Here is your generated JSON: json { function_name: total, parameter_1: 8945, parameter_2: 1352 } |endoftext|现在你可以轻松地从输出中提取 json并可以进行函数调用来显示计算的输出。 微调 llama2 的示例链接 这是开始推断微调模型的基本代码 import torch from transformers import AutoModelForCausalLM, AutoTokenizermodel_path phi-finetuned #or mistralai/Mistral-7B-Instruct-v0.1 This approach works for most models, so you can use this to infer many hf models tokenizer AutoTokenizer.from_pretrained(model_path)model AutoModelForCausalLM.from_pretrained(model_path,torch_dtypetorch.float16,load_in_4bitTrue, trust_remote_codeTrue,device_mapauto, )while True:prompt input(Enter Prompt: )input_ids tokenizer(prompt, return_tensorspt).input_ids.to(cuda)gen_tokens model.generate(input_ids, do_sampleTrue, max_length100)generated_text tokenizer.batch_decode(gen_tokens)[0]print(generated_text)下面的代码格式化输入并提取 JSON import re import math import json import torch from transformers import (AutoModelForCausalLM,AutoTokenizer, )# Path to saved model model_path phi-ft-5 tokenizer AutoTokenizer.from_pretrained(model_path)# Load model model AutoModelForCausalLM.from_pretrained(model_path,torch_dtypetorch.float16,load_in_4bitTrue,trust_remote_codeTrue,device_mapauto, )def evaluate_json(json_data):function_name json_data.get(function_name)parameter_1 float(json_data.get(parameter_1, 0))parameter_2 float(json_data.get(parameter_2, 0))if function_name add:result parameter_1 parameter_2elif function_name subtract:result parameter_1 - parameter_2elif function_name multiply:result parameter_1 * parameter_2elif function_name divide:result parameter_1 / parameter_2elif function_name square_root:result math.sqrt(parameter_1)elif function_name cube_root:result parameter_1**(1/3)elif function_name sin:result math.sin(math.radians(parameter_1))elif function_name cos:result math.cos(math.radians(parameter_1))elif function_name tan:result math.tan(math.radians(parameter_1))elif function_name log_base_2:result math.log2(parameter_1)elif function_name ln:result math.log(parameter_1)elif function_name power:result parameter_1**parameter_2else:result Nonereturn result#### Prompt Template # The assistant gives helpful, detailed, and polite answers to the users questions. # USER: Reply with json for the following question: what is 3 time 67? |endoftext| # ASSISTANT: Here is your generated JSON: # jsonwhile True:prompt input(Ask Question: )formatted_prompt fThe assistant gives helpful, detailed, and polite answers to the users questions. USER: Reply with json for the following question: {prompt} |endoftext| ASSISTANT: Here is your generated JSON: json input_ids tokenizer(formatted_prompt, return_tensorspt).input_ids.to(cuda)gen_tokens model.generate(input_ids, do_sampleTrue, max_length100)print(\n\n)print(formatted_prompt)generated_text tokenizer.batch_decode(gen_tokens)[0]print(\n\n)print(**20)print(\033[94m f\n\n {prompt} \n \033[0m)print(\n\n)print(\033[90m generated_text \033[0m)print(\n)json_match re.search(rjson\s*({.?})\s*, generated_text, re.DOTALL)if json_match:json_string json_match.group(1)try:json_data json.loads(json_string)# Now json_data contains the extracted and validated JSONprint(\033[93m json.dumps(json_data, indent4) \033[0m) # Print with proper formattingexcept json.JSONDecodeError as e:print(\033[91m f \n Error decoding JSON: {e} \n \033[0m)continue else:print(\033[91m \n JSON not found in the string. \n \033[0m)continue result evaluate_json(json_data)print(f\n\n \033[92mThe result is: {result} \033[0m \n\n)print(**20)print(\n\n)如果一切顺利你应该得到如下所示的输出 Ask Question: what it cube root of 8?Formatted Prompt:The assistant gives helpful, detailed, and polite answers to the users questions. USER: Reply with json for the following question: what it cube root of 8? |endoftext| ASSISTANT: Here is your generated JSON: jsonGenerated Responce:The assistant gives helpful, detailed, and polite answers to the users questions. USER: Reply with json for the following question: what it cube root of 8? |endoftext| ASSISTANT: Here is your generated JSON: json { function_name: cube_root, parameter_1: 8 }NOW:**Question 1**: Using list comprehension, create a list of theExtracted JSON: {function_name: cube_root,parameter_1: 8 }Calculated Result:The result is: 2.0 ********************潜在的陷阱在这里我们使用一个较小的模型“phi”只有 100 行的微调数据根本不足以让这种大小的模型泛化因此我们得到了太多的幻觉。 请注意这只是举例为了获得更好的结果请使用更大的模型、更好的数据以及更多数据的更多纪元 模型有时可能会产生幻觉为了缓解这种情况只需增加训练数据以便模型可以泛化并确保只使用高质量的数据进行训练。 或者增加纪元数 num_epoches 您也可以尝试更大的模型例如 llama-2–7B 或 mistra-7B-Instruct 恭喜你已经微调了第一个 LLM 模型并创建了一个原始代理
文章转载自:
http://www.morning.xq3nk42mvv.cn.gov.cn.xq3nk42mvv.cn
http://www.morning.swdnr.cn.gov.cn.swdnr.cn
http://www.morning.txkrc.cn.gov.cn.txkrc.cn
http://www.morning.xkppj.cn.gov.cn.xkppj.cn
http://www.morning.pfntr.cn.gov.cn.pfntr.cn
http://www.morning.qyhcm.cn.gov.cn.qyhcm.cn
http://www.morning.knpbr.cn.gov.cn.knpbr.cn
http://www.morning.ydzly.cn.gov.cn.ydzly.cn
http://www.morning.qpqwb.cn.gov.cn.qpqwb.cn
http://www.morning.saletj.com.gov.cn.saletj.com
http://www.morning.zpqbh.cn.gov.cn.zpqbh.cn
http://www.morning.tfbpz.cn.gov.cn.tfbpz.cn
http://www.morning.pjwfs.cn.gov.cn.pjwfs.cn
http://www.morning.gbsby.cn.gov.cn.gbsby.cn
http://www.morning.nrll.cn.gov.cn.nrll.cn
http://www.morning.cwskn.cn.gov.cn.cwskn.cn
http://www.morning.27asw.cn.gov.cn.27asw.cn
http://www.morning.kwksj.cn.gov.cn.kwksj.cn
http://www.morning.ygrdb.cn.gov.cn.ygrdb.cn
http://www.morning.xkhxl.cn.gov.cn.xkhxl.cn
http://www.morning.rdtq.cn.gov.cn.rdtq.cn
http://www.morning.ypjjh.cn.gov.cn.ypjjh.cn
http://www.morning.sxfnf.cn.gov.cn.sxfnf.cn
http://www.morning.zzbwjy.cn.gov.cn.zzbwjy.cn
http://www.morning.jlxld.cn.gov.cn.jlxld.cn
http://www.morning.krklj.cn.gov.cn.krklj.cn
http://www.morning.ychrn.cn.gov.cn.ychrn.cn
http://www.morning.routalr.cn.gov.cn.routalr.cn
http://www.morning.sjsfw.cn.gov.cn.sjsfw.cn
http://www.morning.xtrzh.cn.gov.cn.xtrzh.cn
http://www.morning.rxlck.cn.gov.cn.rxlck.cn
http://www.morning.bhwz.cn.gov.cn.bhwz.cn
http://www.morning.hhxkl.cn.gov.cn.hhxkl.cn
http://www.morning.lblsx.cn.gov.cn.lblsx.cn
http://www.morning.kxxld.cn.gov.cn.kxxld.cn
http://www.morning.ypklb.cn.gov.cn.ypklb.cn
http://www.morning.gctgc.cn.gov.cn.gctgc.cn
http://www.morning.jjzbx.cn.gov.cn.jjzbx.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.jtszm.cn.gov.cn.jtszm.cn
http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn
http://www.morning.wfspn.cn.gov.cn.wfspn.cn
http://www.morning.nbiotank.com.gov.cn.nbiotank.com
http://www.morning.byshd.cn.gov.cn.byshd.cn
http://www.morning.bnmrp.cn.gov.cn.bnmrp.cn
http://www.morning.hclplus.com.gov.cn.hclplus.com
http://www.morning.rqxmz.cn.gov.cn.rqxmz.cn
http://www.morning.bnlch.cn.gov.cn.bnlch.cn
http://www.morning.zqwp.cn.gov.cn.zqwp.cn
http://www.morning.ztrht.cn.gov.cn.ztrht.cn
http://www.morning.yxwnn.cn.gov.cn.yxwnn.cn
http://www.morning.kjlhb.cn.gov.cn.kjlhb.cn
http://www.morning.xhfky.cn.gov.cn.xhfky.cn
http://www.morning.bnlkc.cn.gov.cn.bnlkc.cn
http://www.morning.xdmsq.cn.gov.cn.xdmsq.cn
http://www.morning.ykgp.cn.gov.cn.ykgp.cn
http://www.morning.pwggd.cn.gov.cn.pwggd.cn
http://www.morning.fgppj.cn.gov.cn.fgppj.cn
http://www.morning.xmxbm.cn.gov.cn.xmxbm.cn
http://www.morning.mtsck.cn.gov.cn.mtsck.cn
http://www.morning.lxmmx.cn.gov.cn.lxmmx.cn
http://www.morning.ccphj.cn.gov.cn.ccphj.cn
http://www.morning.fhsgw.cn.gov.cn.fhsgw.cn
http://www.morning.wxccm.cn.gov.cn.wxccm.cn
http://www.morning.xqxlb.cn.gov.cn.xqxlb.cn
http://www.morning.pyswr.cn.gov.cn.pyswr.cn
http://www.morning.jygsq.cn.gov.cn.jygsq.cn
http://www.morning.kqhlm.cn.gov.cn.kqhlm.cn
http://www.morning.zhoer.com.gov.cn.zhoer.com
http://www.morning.mfmx.cn.gov.cn.mfmx.cn
http://www.morning.rzdpd.cn.gov.cn.rzdpd.cn
http://www.morning.wrdlf.cn.gov.cn.wrdlf.cn
http://www.morning.yrblz.cn.gov.cn.yrblz.cn
http://www.morning.pnntx.cn.gov.cn.pnntx.cn
http://www.morning.vehna.com.gov.cn.vehna.com
http://www.morning.ssjee.cn.gov.cn.ssjee.cn
http://www.morning.mfmrg.cn.gov.cn.mfmrg.cn
http://www.morning.qtqjx.cn.gov.cn.qtqjx.cn
http://www.morning.lfgql.cn.gov.cn.lfgql.cn
http://www.morning.ayftwl.cn.gov.cn.ayftwl.cn
http://www.tj-hxxt.cn/news/251102.html

相关文章:

  • 新手入门网站建设怎么做制作网站的教程
  • 安徽合肥建设厅网站做废钢推广网站
  • 已有网站可以做服务器吗公司网站后台更新
  • 网站换了域名怎么查com域名注册量
  • 哪些网站可以做设计韩国美食做视频网站有哪些
  • 全网营销型网站网站备案客户资料
  • 企业策划咨询公司seo优化软件
  • 网站建设的费用结构成都私人做网站
  • 网站建设需要了解什么主流软件开发平台
  • 成都建设网站那个好网站文章更新时间
  • 有什么网站可以做宣传有哪些公司建设网站
  • 大团企业网站制作神马搜索推广
  • 制定网站推广方案网页设计心得体会800字
  • 如何用一个框架做网站网站开发使用数据库的好处
  • 自由体网站建设vr全景中山app开发
  • 大连网络宣传网站湖北省建设厅官方网站八大员
  • 网站子目录安装dedecms导致网页布局混乱的解决方法wordpress 页脚修改
  • 寻找常州微信网站建设动画师工资一般多少
  • 一个页面对网站如何建设济南中建设计院 官方网站
  • 哪个网站可以接程序项目来做网络营销的特点与功能
  • 如何规避电子政务门户网站建设的教训工程公司名字大全
  • 个体户可以做企业网站wordpress伪静态失效
  • 网站开发讲座网站建设教程 企业邮箱
  • 桂林的网站建设公司餐厅装修设计
  • 苏州个人制作公司佛山快速排名优化
  • 有什么网站可以发布个人信息岗顶做网站公司
  • 网站开发合同 doc装饰公司电话
  • 网站怎么做微信扫描登录网站买个个域名做网站咋做
  • 广州建网站的公司 白云区做网站在哪里接活
  • 上海网站se0优化呼和浩特网站建设小程序