我想要用opencompass测评Ziya_llama_13B模型,请教各位大佬,配置文件应该怎么修改? #677
Unanswered
Elsablabla
asked this question in
Q&A
Replies: 1 comment 3 replies
-
models = [dict(
type=HuggingFaceCausalLM,
abbr='Ziya_llama_13B',
path="/workspace/pc/Ziya-LLaMA-13B-v1",
tokenizer_path='/workspace/pc/Ziya-LLaMA-13B-v1',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=1024,
max_seq_len=2048,
batch_size=8,
model_kwargs=dict(device_map='auto'),
generation_kwargs=dict(
repetition_penalty=1.,
do_sample=True,
top_p=0.85,
temperature=1.0,
)
run_cfg=dict(num_gpus=2, num_procs=1),
)] something like this, you can adjust it if encounter any problem. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
调用ziya推理的代码如下:
`from transformers import AutoTokenizer
from transformers import LlamaForCausalLM
import torch
device = torch.device("cuda")
ckpt = '/workspace/pc/Ziya-LLaMA-13B-v1'
query="帮我写一份西安旅游计划"
model = LlamaForCausalLM.from_pretrained(ckpt, torch_dtype=torch.float16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(ckpt, use_fast=False)
inputs = ':' + query.strip() + '\n:'
input_ids = tokenizer(inputs, return_tensors="pt").input_ids.to(device)
generate_ids = model.generate(
input_ids,
max_new_tokens=1024,
do_sample = True,
top_p = 0.85,
temperature = 1.0,
repetition_penalty=1.,
eos_token_id=2,
bos_token_id=1,
pad_token_id=0)
output = tokenizer.batch_decode(generate_ids)[0]
print(output)
`
Beta Was this translation helpful? Give feedback.
All reactions