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

住房和城乡建设部的网站网站空间一般多大

住房和城乡建设部的网站,网站空间一般多大,本站3天更换一次域名yw,百度推广的效果之前将ChatGLM6B模型下载到本地运行起来了#xff1a;ChatGLM3-6B上手体验#xff1b;如果想要用在项目中#xff0c;那么可以使用API调用的方式进行操作#xff0c;尤其当你的项目还是不同语言的异构的场景下#xff0c;其他服务需要调用的时候就可以直接通过请求服务来获…之前将ChatGLM6B模型下载到本地运行起来了ChatGLM3-6B上手体验如果想要用在项目中那么可以使用API调用的方式进行操作尤其当你的项目还是不同语言的异构的场景下其他服务需要调用的时候就可以直接通过请求服务来获取了。 1.运行API模式 ChatGLM3-6B的官方代码里有运行API的bat文件可以直接点击运行即可如果在Linux系统或者通过docker部署的方式运行可以运行openai_api_demo目录下的 openai_api.py文件。 模型默认运行在8000端口 2.接口介绍 接口url :http://127.0.0.1:8000/v1/chat/completions 请求参数 functions: functions, # 函数定义model: model, # 模型名称messages: messages, # 会话历史stream: use_stream, # 是否流式响应max_tokens: 100, # 最多生成字数temperature: 0.8, # 温度top_p: 0.8, # 采样概率请求的方式有流式和非流式请求对应请求参数中stream的True和False请求方式的处理可以参照官方给出的方法 import requests import jsonbase_url http://127.0.0.1:8000def create_chat_completion(model, messages, functions, use_streamFalse):data {functions: functions, # 函数定义model: model, # 模型名称messages: messages, # 会话历史stream: use_stream, # 是否流式响应max_tokens: 100, # 最多生成字数temperature: 0.8, # 温度top_p: 0.8, # 采样概率}response requests.post(f{base_url}/v1/chat/completions, jsondata, streamuse_stream)if response.status_code 200:if use_stream:# 处理流式响应for line in response.iter_lines():if line:decoded_line line.decode(utf-8)[6:]try:response_json json.loads(decoded_line)content response_json.get(choices, [{}])[0].get(delta, {}).get(content, )print(content)except:print(Special Token:, decoded_line)else:# 处理非流式响应decoded_line response.json()content decoded_line.get(choices, [{}])[0].get(message, ).get(content, )print(content)else:print(Error:, response.status_code)return None3.不同的调用方式 ChatGLM3支持工具调用api接口也支持了这一特性 简单对话 def simple_chat(use_streamTrue):functions Nonechat_messages [{role: system,content: You are ChatGLM3, a large language model trained by Zhipu.AI. Follow the users instructions carefully. Respond using markdown.,},{role: user,content: 你好给我讲一个故事大概100字}]create_chat_completion(chatglm3-6b, messageschat_messages, functionsfunctions, use_streamuse_stream) 工具调用 def function_chat(use_streamTrue):functions [{name: get_current_weather,description: Get the current weather in a given location.,parameters: {type: object,properties: {location: {type: string,description: The city and state, e.g. Beijing,},unit: {type: string, enum: [celsius, fahrenheit]},},required: [location],},}]chat_messages [{role: user,content: 波士顿天气如何,},{role: assistant,content: get_current_weather\n python\ntool_call(locationBeijing, unitcelsius)\n,function_call: {name: get_current_weather,arguments: {location: Beijing, unit: celsius},},},{role: function,name: get_current_weather,content: {temperature: 12, unit: celsius, description: Sunny},},# ... 接下来这段是 assistant 的回复和用户的回复。# {# role: assistant,# content: 根据最新的天气预报目前北京的天气情况是晴朗的温度为12摄氏度。,# },# {# role: user,# content: 谢谢,# }]create_chat_completion(chatglm3-6b, messageschat_messages, functionsfunctions, use_streamuse_stream) 命令行调用测试 def chatincmd(use_streamTrue):while True:functions Nonecontent input(Question:)chat_messages [{role: user,content: content}]create_chat_completion(chatglm3-6b, messageschat_messages, functionsfunctions, use_streamuse_stream)
http://www.pierceye.com/news/468288/

相关文章:

  • 手机网站开发下载app开发长沙
  • 重庆南川网站制作价格西宁网站建设优化
  • 电子商务网站建设与管理试卷6平面设计接单兼职
  • 建设手机网站大概要多少钱云南建投二公司官网
  • 公司如何建设网站首页网页设计与网站开发试题答案
  • 中企动力合作网站网站app下载平台怎么做
  • 网站开发专业成功人士重庆邮电大学官网网站
  • 官方网站后台图片下载怎么做网站开发与支付宝端口连接
  • 浏览器怎么打开网站服务器下载在线音乐网站开发摘要
  • 建网站拿到广告吉林整站优化
  • 怎么建站网站清远佛冈住房和城乡建设局网站
  • 领导高度重视门户网站建设广州引流推广公司
  • 公司网站建设吧个好wordpress增加搜索
  • 温州网站推广排名哪家购物网站建设好
  • 宿迁做网站公司哪家好中国建设监理协会化工监理协会网站
  • 网站建设广州天河常州企业自助建站系统
  • 厦门网站建设u贷款在线申请
  • 做肮脏交义的网站南宁住房和城乡建设局网站
  • 办网站需要什么my23777免费域名查询
  • 销售网站开发步骤网站域名到期了怎么办
  • 怎么做注册账号的网站网页打不开视频播放不了是什么问题
  • 江阴市住房和城乡建设局网站免费网页游戏poki
  • 个人网站设计网站建设的基本特点
  • 泉州专业做网站网站被k 原因
  • 18款禁用网站app直播建设部资质网站
  • 免费完整版的网站模板商丘行业网站建设开发公司
  • 网站与微网站区别推广通
  • 京东网站建设的意义wordpress美图
  • 佛山市外贸网站建设公司营销型网站建设 兼职
  • 四川省城乡与建设厅网站中国十大it培训机构排名