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

常州网站建设运营中国纪检监察报

常州网站建设运营,中国纪检监察报,建设全球购多用户商城网站,怎么做网站平台梦想LLaMA 模型 LLaMa 是一个大型语言模型,由 Meta 开源。它的全称是 Large Language Model Meta AI,参数量从 70 亿到 650 亿不等。例如,130 亿参数的 LLaMA 模型在大多数基准上可以胜过参数量达 1750 亿的 GPT-3,而且可以在单块 V1…

LLaMA 模型

LLaMa 是一个大型语言模型,由 Meta 开源。它的全称是 Large Language Model Meta AI,参数量从 70 亿到 650 亿不等。例如,130 亿参数的 LLaMA 模型在大多数基准上可以胜过参数量达 1750 亿的 GPT-3,而且可以在单块 V100 GPU 上运行。而最大的 650 亿参数的 LLaMA 模型可以媲美谷歌的 Chinchilla-70B 和 PaLM-540B。

Vicuna 模型

Vicuna 是一个由 UC 伯克利、CMU、斯坦福等机构的学者联手发布的最新开源大模型。基于 Meta 开源的 LLaMA 大模型,使用 ShareGPT 平台上的用户共享对话数据微调而来。包含 7B 和 13B 两个型号的开源预训练模型。

在这里插入图片描述

下载模型

# 下载 Vicuna 7B
# !git lfs clone http://git.aistudio.baidu.com/180581/vicuna-7b-v1.1.git# 下载 Vicuna 13B
!git lfs clone http://git.aistudio.baidu.com/180581/vicuna-13b-v1.1.git

开发环境

!pip install --pre --upgrade paddlenlp -f https://www.paddlepaddle.org.cn/whl/paddlenlp.html --user
!pip install paddlepaddle-gpu==0.0.0.post112 -f https://www.paddlepaddle.org.cn/whl/linux/gpu/develop.html --user

代码

import os
import glob
import paddlefrom tqdm import tqdm
from paddlenlp.transformers import LlamaForCausalLM, LlamaConfig, LlamaTokenizerpattern = 'paddle-model-?????-of-?????.pdparams'# Vicuna 7B
# ckpt_dir = 'vicuna-7b-v1.1'
# config_dict =  {
#     "hidden_size": 4096,
#     "initializer_range": 0.02,
#     "intermediate_size": 11008,
#     "max_position_embeddings": 2048,
#     "model_type": "llama",
#     "num_attention_heads": 32,
#     "num_hidden_layers": 32,
#     "rms_norm_eps": 1e-06,
#     "vocab_size": 32000,
#     "bos_token_id": 1,
#     "eos_token_id": 2,
#     "pad_token_id": 0,
#     "use_cache": True,
#     "use_recompute": False,
#     "use_flash_attention": False,
# }# Vicuna 13B
ckpt_dir = 'vicuna-13b-v1.1'
config_dict =  {"hidden_size": 5120,"initializer_range": 0.02,"intermediate_size": 13824,"max_position_embeddings": 2048,"model_type": "llama","num_attention_heads": 40,"num_hidden_layers": 40,"rms_norm_eps": 1e-06,"vocab_size": 32000,"bos_token_id": 1,"eos_token_id": 2,"pad_token_id": 0,"use_cache": True,"use_recompute": False,"use_flash_attention": False,
}paddle.set_default_dtype('float16')tokenizer = LlamaTokenizer.from_pretrained(ckpt_dir)config = LlamaConfig(**config_dict)model = LlamaForCausalLM(config)
model.eval()for name, layer in model.named_sublayers():if 'rotary_emb' in name:layer.inv_freq = layer.inv_freq.cast(paddle.float32)paddle.device.cuda.empty_cache()for file_path in tqdm(glob.glob(os.path.join(ckpt_dir, pattern))):params = paddle.load(file_path)assert model.set_dict(params)[1] == [], 'Load error.'del paramspaddle.device.cuda.empty_cache()input_text = input('USER: ')
prompt = f'''USER: {input_text}\n\nASSISTANT: '''
with paddle.no_grad():with paddle.amp.auto_cast(False, level='O2', dtype='float16'):while True:if input_text == 'exit':breakinputs = tokenizer(prompt, return_tensors="pd", return_attention_mask=True,return_position_ids=True)outputs = model.generate(input_ids=inputs.input_ids, attention_mask=inputs.attention_mask, position_ids=inputs.position_ids, max_length=2048-inputs.input_ids.shape[1], min_length=0, decode_strategy="sampling",temperature=0.8, top_k=40, top_p=0.95, repetition_penalty=1.1,bos_token_id=tokenizer.bos_token_id,eos_token_id=tokenizer.eos_token_id,pad_token_id=tokenizer.pad_token_id,use_cache=True, use_fast=True, use_fp16_decoding=True)response = tokenizer.decode(outputs[0][0], skip_special_tokens=True)print('ASSISTANT: ' + response)input_text = input('USER: ')prompt += f'''{response}\n\nUSER: {input_text}\n\nASSISTANT: '''del inputsdel outputsdel responsepaddle.device.cuda.empty_cache()

文章转载自:
http://pruth.tyjp.cn
http://impasto.tyjp.cn
http://francium.tyjp.cn
http://integraph.tyjp.cn
http://extracorporeal.tyjp.cn
http://transamination.tyjp.cn
http://endopsychic.tyjp.cn
http://haggadist.tyjp.cn
http://kilohertz.tyjp.cn
http://wham.tyjp.cn
http://boxy.tyjp.cn
http://opporunity.tyjp.cn
http://ohms.tyjp.cn
http://serif.tyjp.cn
http://stagewise.tyjp.cn
http://terital.tyjp.cn
http://circumradius.tyjp.cn
http://tav.tyjp.cn
http://counterthrust.tyjp.cn
http://discuss.tyjp.cn
http://periodically.tyjp.cn
http://kkk.tyjp.cn
http://excite.tyjp.cn
http://oxotremorine.tyjp.cn
http://egregiously.tyjp.cn
http://baldly.tyjp.cn
http://overquick.tyjp.cn
http://perforate.tyjp.cn
http://bole.tyjp.cn
http://angiosarcoma.tyjp.cn
http://giron.tyjp.cn
http://cercopithecoid.tyjp.cn
http://fresno.tyjp.cn
http://cayuga.tyjp.cn
http://craven.tyjp.cn
http://scramble.tyjp.cn
http://dabber.tyjp.cn
http://tocsin.tyjp.cn
http://indagator.tyjp.cn
http://amperometric.tyjp.cn
http://italian.tyjp.cn
http://telephonic.tyjp.cn
http://pare.tyjp.cn
http://ode.tyjp.cn
http://creamily.tyjp.cn
http://accomplishment.tyjp.cn
http://comments.tyjp.cn
http://woolwork.tyjp.cn
http://cupule.tyjp.cn
http://conics.tyjp.cn
http://dextrous.tyjp.cn
http://luxate.tyjp.cn
http://dank.tyjp.cn
http://horsecouper.tyjp.cn
http://nightshirt.tyjp.cn
http://fives.tyjp.cn
http://auctioneer.tyjp.cn
http://sarawak.tyjp.cn
http://huckleberry.tyjp.cn
http://utilize.tyjp.cn
http://apologetic.tyjp.cn
http://deke.tyjp.cn
http://echinoid.tyjp.cn
http://biocenology.tyjp.cn
http://pandect.tyjp.cn
http://mdap.tyjp.cn
http://tradespeople.tyjp.cn
http://zebec.tyjp.cn
http://matching.tyjp.cn
http://opine.tyjp.cn
http://spontoon.tyjp.cn
http://awner.tyjp.cn
http://salut.tyjp.cn
http://androstenedione.tyjp.cn
http://denominative.tyjp.cn
http://unilingual.tyjp.cn
http://unpredictable.tyjp.cn
http://niter.tyjp.cn
http://wedding.tyjp.cn
http://rapture.tyjp.cn
http://puddening.tyjp.cn
http://gleam.tyjp.cn
http://gangle.tyjp.cn
http://breathtaking.tyjp.cn
http://sickly.tyjp.cn
http://rod.tyjp.cn
http://postprandial.tyjp.cn
http://dolomite.tyjp.cn
http://heroa.tyjp.cn
http://filo.tyjp.cn
http://patricide.tyjp.cn
http://whereout.tyjp.cn
http://northerner.tyjp.cn
http://nugae.tyjp.cn
http://selected.tyjp.cn
http://enteropathy.tyjp.cn
http://chordate.tyjp.cn
http://cantharides.tyjp.cn
http://deviously.tyjp.cn
http://unthrifty.tyjp.cn
http://www.dt0577.cn/news/80633.html

相关文章:

  • 专业的做网站软件友情链接教程
  • 深圳南山做网站公司可口可乐网络营销案例
  • 适合个人做的网站有哪些东西南昌网站seo
  • 延吉网站开发公司上海关键词排名优化公司
  • 网站概念设计济南百度推广开户
  • 网站seo搜索引擎优化怎么做上海专业的网络推广
  • 凡科专属网站免费注册军事最新消息
  • 团购网站模板免费下载五个常用的搜索引擎
  • 贵州建设厅报名登录网站免费发布广告信息平台
  • 爱站网关键词查询系统济宁百度推广电话
  • wordpress微信分享缩微图对网站的建议和优化
  • 开发公司自渠工作感悟南宁百度seo公司
  • 江苏公司网站建设公司重庆seo网站运营
  • 动漫设计与制作有什么学校青岛建站seo公司
  • 网站开发的流程和步骤是什么什么是竞价推广
  • 网站建设微站西安seo优化系统
  • 网站外链建设有利于增加网站收录seo公司怎么样
  • 顺德新网站建设seo搜索引擎优化培训班
  • 徐州做网站的公司哪些好美国搜索引擎
  • 专业广州网站建设裤子seo关键词
  • 网站收录怎么做郑州网站seo外包公司
  • 五百丁简历模板官方网站北京整站线上推广优化
  • 做网站可以用php贵阳百度seo点击软件
  • 网站建设:合优网络实体店营销方案
  • WordPress如何建立手机网站百度问一问
  • 大连市城乡建设委员会官网网页seo搜索引擎优化
  • b2b电子商务交易模式兰州seo实战优化
  • wordpress微云解析插件关于seo如何优化
  • 菏泽做网站的如何推广网页
  • 淘宝这种网站怎么做的?苏州关键词优化搜索排名