匿名用户2024年07月31日
23阅读
所属分类ai、llama、Pytorch
开源地址https://modelscope.cn/models/BAAI/Aquila2-34B
授权协议other

作品详情

GithubWeChat

We opensource our Aquila2 series, now including Aquila2, the base language models, namely Aquila2-7B and Aquila2-34B, as well as AquilaChat2, the chat models, namely AquilaChat2-7B and AquilaChat2-34B, as well as the long-text chat models, namely AquilaChat2-7B-16k and AquilaChat2-34B-16k

2023.10.25 ? Aquila2-34B v1.2 is based on the previous Aquila2-34B. The Aquila2-34B has achieved a 6.9% improvement in comprehensive evaluations, with MMLU(+12%), TruthfulQA(+14%), CSL(+11%), TNEWS(+12%), OCNLI(+28%), and BUSTM(+18%).

The additional details of the Aquila model will be presented in the official technical report. Please stay tuned for updates on official channels.

Quick Start Aquila2-34B(Chat model)

1. Inference

from modelscope import AutoModelForCausalLM, AutoTokenizer, snapshot_download
from predict import predict
import torch

# Note: The default behavior now has injection attack prevention off.
device = torch.device("cuda:0")
model_dir = snapshot_download("BAAI/Aquila2-34B")

tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True).eval()

model.to(device)
text = "请给出10个要到北京旅游的理由。"
tokens = tokenizer.encode_plus(text)['input_ids']
tokens = torch.tensor(tokens)[None,].to(device)
stop_tokens = ["###", "[UNK]", "</s>"]
with torch.no_grad():
    out = model.generate(tokens, do_sample=True, max_length=512, eos_token_id=100007, bad_words_ids=[[tokenizer.encode(token)[0] for token in stop_tokens]])[0]
    out = tokenizer.decode(out.cpu().numpy().tolist())
    print(out)

License

Aquila2 series open-source model is licensed under BAAI Aquila Model Licence Agreement

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论