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

主机屋免费网站空间网站建设安全标准

主机屋免费网站空间,网站建设安全标准,新营销平台电商网站,长沙响应式网站建设【 书生浦语大模型实战营】作业#xff08;六#xff09;#xff1a;Lagent AgentLego 智能体应用搭建 #x1f389;AI学习星球推荐#xff1a; GoAI的学习社区 知识星球是一个致力于提供《机器学习 | 深度学习 | CV | NLP | 大模型 | 多模态 | AIGC 》各个最新AI方…【 书生·浦语大模型实战营】作业六Lagent AgentLego 智能体应用搭建 AI学习星球推荐 GoAI的学习社区 知识星球是一个致力于提供《机器学习 | 深度学习 | CV | NLP | 大模型 | 多模态 | AIGC 》各个最新AI方向综述、论文等成体系的学习资料配有全面而有深度的专栏内容包括不限于 前沿论文解读、资料共享、行业最新动态以、实践教程、求职相关简历撰写技巧、面经资料与心得多方面综合学习平台强烈推荐AI小白及AI爱好者学习性价比非常高加入星球➡️点击链接 【 书生·浦语大模型实战营】作业六Lagent AgentLego 智能体应用搭建 本篇笔记内容主要为 【书生·浦语大模型实战营】作业六Lagent AgentLego 智能体应用搭建智能体的作业 主要对智能体应用理论部分及具体搭建流程详细介绍并分别进行实战应用及可视化展示欢迎大家交流学习 本次学习资料 1.【视频】Lagent AgentLego 智能体应用搭建 2.【文档】https://github.com/InternLM/Tutorial/blob/camp2/agent/lagent.md#1-lagent-web-demo 3.【作业】https://github.com/InternLM/Tutorial 本次作业内容 完成 Lagent Web Demo 使用并在作业中上传截图。 完成 AgentLego 直接使用部分并在作业中上传截图。 1.1 Lagent轻量级智能体框架 安装环境 # 新建环境 mkdir -p /root/agent studio-conda -t agent -o pytorch-2.1.2#下载github有关仓库 cd /root/agent git clone https://gitee.com/internlm/agentlego.git git clone https://gitee.com/internlm/lagent.git git clone -b camp2 https://gitee.com/internlm/Tutorial.git# 激活环境并安装对应工具包 conda activate agent cd lagent git checkout 581d9fb pip install -e . cd .. cd agentlego git checkout 7769e0d pip install -e . cd .. pip install lmdeploy0.3.01.2 Lagent轻量级智能体框架 Lagent Web Demo conda activate agent lmdeploy serve api_server /root/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-7b \--server-name 127.0.0.1 \--model-name internlm2-chat-7b \--cache-max-entry-count 0.12.启动并使用 Lagent Web Demo 新建的 terminal 中执行下述命令启动 Lagent Web Demo conda activate agent cd /root/agent/lagent/examples streamlit run internlm2_agent_web_demo.py --server.address 127.0.0.1 --server.port 7860在等待 LMDeploy 的 api_server 与 Lagent Web Demo 完全启动后在本地进行端口映射将 LMDeploy api_server 的23333端口以及 Lagent Web Demo 的7860端口映射到本地。执行 ssh -CNg -L 7860:127.0.0.1:7860 -L 23333:127.0.0.1:23333 rootssh.intern-ai.org.cn -p 你的 ssh 41562效果 1.3 用 Lagent 自定义工具 使用 Lagent 自定义工具主要分为以下几步 继承 BaseAction 类 实现简单工具的 run 方法或者实现工具包内每个子工具的功能 简单工具的 run 方法可选被 tool_api 装饰工具包内每个子工具的功能都需要被 tool_api 装饰 目标实现一个调用和风天气 API 的工具以完成实时天气查询的功能 重启服务 conda activate agent lmdeploy serve api_server /root/share/new_models/Shanghai_AI_Laboratory/internlm2-chat-7b \--server-name 127.0.0.1 \--model-name internlm2-chat-7b \--cache-max-entry-count 0.1 export WEATHER_API_KEY获取的API KEY conda activate agent cd /root/agent/Tutorial/agent streamlit run internlm2_weather_web_demo.py --server.address 127.0.0.1 --server.port 7860#本地进行端口映射 ssh -CNg -L 7860:127.0.0.1:7860 -L 23333:127.0.0.1:23333 rootssh.intern-ai.org.cn -p 41562 效果 2.1 AgentLego组装智能体“乐高” 直接使用 AgentLego cd /root/agent wget http://download.openmmlab.com/agentlego/road.jpg conda activate agent pip install openmim0.3.9 mim install mmdet3.3.0python /root/agent/direct_use.py 推理前 Inference truck (345, 428, 528, 599), score 83 car (771, 510, 837, 565), score 81 car (604, 518, 677, 569), score 75 person (866, 503, 905, 595), score 74 person (287, 513, 320, 596), score 74 person (964, 501, 999, 604), score 72 person (1009, 503, 1047, 602), score 69 person (259, 510, 279, 575), score 65 car (1074, 524, 1275, 691), score 64 person (993, 508, 1016, 597), score 62 truck (689, 483, 764, 561), score 62 bicycle (873, 551, 903, 602), score 60 person (680, 523, 699, 567), score 55 bicycle (968, 551, 996, 609), score 53 bus (826, 482, 930, 560), score 52 bicycle (1011, 551, 1043, 617), score 51 推理后 2.2 智能体工具使用 使用 AgentLego WebUI 在本地的浏览器页面中打开http://localhost:7860以使用 AgentLego WebUI。 效果 2.3 自定义工具 基于 AgentLego 构建自己的自定义工具文档教程自定义工具主要分为以下几步 继承 BaseTool 类 修改 default_desc 属性工具功能描述 如有需要重载 setup 方法重型模块延迟加载 重载 apply 方法工具功能实现 通过touch /root/agent/agentlego/agentlego/tools/magicmaker_image_generation.py大小写敏感的方法新建工具文件。该文件的内容如下 import json import requestsimport numpy as npfrom agentlego.types import Annotated, ImageIO, Info from agentlego.utils import require from .base import BaseToolclass MagicMakerImageGeneration(BaseTool):default_desc (This tool can call the api of magicmaker to generate an image according to the given keywords.)styles_option [dongman, # 动漫guofeng, # 国风xieshi, # 写实youhua, # 油画manghe, # 盲盒]aspect_ratio_options [16:9, 4:3, 3:2, 1:1,2:3, 3:4, 9:16]require(opencv-python)def __init__(self,styleguofeng,aspect_ratio4:3):super().__init__()if style in self.styles_option:self.style styleelse:raise ValueError(fThe style must be one of {self.styles_option})if aspect_ratio in self.aspect_ratio_options:self.aspect_ratio aspect_ratioelse:raise ValueError(fThe aspect ratio must be one of {aspect_ratio})def apply(self,keywords: Annotated[str,Info(A series of Chinese keywords separated by comma.)]) - ImageIO:import cv2response requests.post(urlhttps://magicmaker.openxlab.org.cn/gw/edit-anything/api/v1/bff/sd/generate,datajson.dumps({official: True,prompt: keywords,style: self.style,poseT: False,aspectRatio: self.aspect_ratio}),headers{content-type: application/json})image_url response.json()[data][imgUrl]image_response requests.get(image_url)image cv2.cvtColor(cv2.imdecode(np.frombuffer(image_response.content, np.uint8), cv2.IMREAD_COLOR),cv2.COLOR_BGR2RGB)return ImageIO(image)注册新工具在重复2.2步骤即可运行结果。
http://www.zqtcl.cn/news/428622/

相关文章:

  • 阿里云多网站建设wordpress 统计分析
  • 长沙网站定制公司科技特长生
  • 查公司的口碑和评价的网站中学生怎么做网站
  • 做网站买空间多少钱深圳seo优化公司
  • 中国建设银行北京市互联网网站wordpress商城购物表单
  • 万网网站备案管理查询工程建设项目的网站
  • 网站建设国内外研究现状模板ppt设计大赛
  • 专业网站优化方案网站设计过程怎么写
  • 福州定制网站建设网站ip过万
  • wordpress网站评论插件厦门软件网站建设
  • 网站黄金比例wordpress转typecho
  • 重庆有哪些网络公司百度系优化
  • 无锡网站制作方案企业三合一建站公司怎么找
  • 钉钉crm客户管理系统免费seo网站推荐一下软件
  • wordpress公司网站模版怎么显示wordpress里元素的源代码
  • 泉州网站制作运营商专业wordpress评论软件
  • 网站开发是什么意思啊有没有帮人做简历的网站
  • 企业网站模板包含什么维度 网站建设
  • 个人备案做运营网站宁波建网站模板
  • 做网站需要懂什么软件合肥网站制作套餐
  • 中国建设银行官方网站纪念钞预约网上买手表哪个网站可以买到正品
  • 哪个网站做兼职可以赚钱浙江嘉兴最新事件
  • 苍南网站建设深圳百度关键字优化
  • 网站建设流程及规范是做网站设计好还是杂志美编好
  • 网站模板 登陆南昌做网站开发的公司有哪些
  • 移动网站建设是什么商丘哪里教做网站的
  • 网站建设排名的公司江东seo做关键词优化
  • 学习网站开发培训网站内链是什么
  • 中文 域名的网站用wordpress做的网站有哪些
  • 网站建设中需要注意的问题唐山自助建站模板