Unverified Commit 7505b3ca authored by Fengzhe Zhou's avatar Fengzhe Zhou Committed by GitHub
Browse files

[Feature] Add huggingface apply_chat_template (#1098)

* add TheoremQA with 5-shot

* add huggingface_above_v4_33 classes

* use num_worker partitioner in cli

* update theoremqa

* update TheoremQA

* add TheoremQA

* rename theoremqa -> TheoremQA

* update TheoremQA output path

* rewrite many model configs

* update huggingface

* further update

* refine configs

* update configs

* update configs

* add configs/eval_llama3_instruct.py

* add summarizer multi faceted

* update bbh datasets

* update configs/models/hf_llama/lmdeploy_llama3_8b_instruct.py

* rename class

* update readme

* update hf above v4.33
parent 6c711cb2
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
round=[
dict(role="HUMAN", begin='[INST] ', end=' [/INST]'),
dict(role="BOT", begin=' ', end=' ', generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFaceCausalLM,
type=HuggingFacewithChatTemplate,
abbr='llama-2-70b-chat-hf',
path="meta-llama/Llama-2-70b-chat-hf",
tokenizer_path='meta-llama/Llama-2-70b-chat-hf',
model_kwargs=dict(
device_map='auto'
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
use_fast=False,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
path='meta-llama/Llama-2-70b-chat-hf',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=4, num_procs=1),
end_str='[INST]',
batch_padding=True,
run_cfg=dict(num_gpus=4),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceCausalLM,
type=HuggingFaceBaseModel,
abbr='llama-2-7b-hf',
path="meta-llama/Llama-2-7b-hf",
tokenizer_path='meta-llama/Llama-2-7b-hf',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
path='meta-llama/Llama-2-7b-hf',
max_out_len=1024,
batch_size=8,
model_kwargs=dict(device_map='auto'),
batch_padding=False, # if false, inference with for-loop without batch padding
run_cfg=dict(num_gpus=1, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
round=[
dict(role="HUMAN", begin='[INST] ', end=' [/INST]'),
dict(role="BOT", begin=' ', end=' ', generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFaceCausalLM,
type=HuggingFacewithChatTemplate,
abbr='llama-2-7b-chat-hf',
path="meta-llama/Llama-2-7b-chat-hf",
tokenizer_path='meta-llama/Llama-2-7b-chat-hf',
model_kwargs=dict(
device_map='auto'
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
use_fast=False,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
path='meta-llama/Llama-2-7b-chat-hf',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
end_str='[INST]',
batch_padding=True,
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceCausalLM,
abbr="llama-3-70b-hf",
path="meta-llama/Meta-Llama-3-70B",
model_kwargs=dict(device_map="auto"),
tokenizer_kwargs=dict(
padding_side="left",
truncation_side="left",
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
type=HuggingFaceBaseModel,
abbr='llama-3-70b-hf',
path='meta-llama/Meta-Llama-3-70B',
max_out_len=1024,
batch_size=8,
batch_padding=True,
run_cfg=dict(num_gpus=4, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
round=[
dict(role="HUMAN", begin="<|start_header_id|>user<|end_header_id|>\n\n", end="<|eot_id|>"),
dict(role="BOT", begin="<|start_header_id|>assistant<|end_header_id|>\n\n", end="<|eot_id|>", generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFaceCausalLM,
abbr="llama-3-70b-instruct-hf",
path="meta-llama/Meta-Llama-3-70B-Instruct",
model_kwargs=dict(device_map="auto"),
tokenizer_kwargs=dict(
padding_side="left",
truncation_side="left",
use_fast=False,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
type=HuggingFacewithChatTemplate,
abbr='llama-3-70b-instruct-hf',
path='meta-llama/Meta-Llama-3-70B-Instruct',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=4, num_procs=1),
generation_kwargs={"eos_token_id": [128001, 128009]},
batch_padding=True,
run_cfg=dict(num_gpus=4),
stop_words=['<|end_of_text|>', '<|eot_id|>'],
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceCausalLM,
abbr="llama-3-8b-hf",
path="meta-llama/Meta-Llama-3-8B",
model_kwargs=dict(device_map="auto"),
tokenizer_kwargs=dict(
padding_side="left",
truncation_side="left",
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
type=HuggingFaceBaseModel,
abbr='llama-3-8b-hf',
path='meta-llama/Meta-Llama-3-8B',
max_out_len=1024,
batch_size=8,
batch_padding=True,
run_cfg=dict(num_gpus=1, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
round=[
dict(role="HUMAN", begin="<|start_header_id|>user<|end_header_id|>\n\n", end="<|eot_id|>"),
dict(role="BOT", begin="<|start_header_id|>assistant<|end_header_id|>\n\n", end="<|eot_id|>", generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFaceCausalLM,
abbr="llama-3-8b-instruct-hf",
path="meta-llama/Meta-Llama-3-8B-Instruct",
model_kwargs=dict(device_map="auto"),
tokenizer_kwargs=dict(
padding_side="left",
truncation_side="left",
use_fast=False,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
type=HuggingFacewithChatTemplate,
abbr='llama-3-8b-instruct-hf',
path='meta-llama/Meta-Llama-3-8B-Instruct',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
generation_kwargs={"eos_token_id": [128001, 128009]},
batch_padding=True,
run_cfg=dict(num_gpus=1),
stop_words=['<|end_of_text|>', '<|eot_id|>'],
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
# LLaMA 13B
dict(
type=HuggingFaceCausalLM,
type=HuggingFaceBaseModel,
abbr='llama-13b-hf',
path="huggyllama/llama-13b",
tokenizer_path='huggyllama/llama-13b',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
path='huggyllama/llama-13b',
max_out_len=1024,
batch_size=8,
model_kwargs=dict(device_map='auto'),
batch_padding=False, # if false, inference with for-loop without batch padding
run_cfg=dict(num_gpus=2, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
# LLaMA 30B
dict(
type=HuggingFaceCausalLM,
type=HuggingFaceBaseModel,
abbr='llama-30b-hf',
path="huggyllama/llama-30b",
tokenizer_path='huggyllama/llama-30b',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
path='huggyllama/llama-30b',
max_out_len=1024,
batch_size=8,
model_kwargs=dict(device_map='auto'),
batch_padding=False, # if false, inference with for-loop without batch padding
run_cfg=dict(num_gpus=4, num_procs=1),
run_cfg=dict(num_gpus=2),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
# LLaMA 65B
dict(
type=HuggingFaceCausalLM,
type=HuggingFaceBaseModel,
abbr='llama-65b-hf',
path="huggyllama/llama-65b",
tokenizer_path='huggyllama/llama-65b',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
path='huggyllama/llama-65b',
max_out_len=1024,
batch_size=8,
model_kwargs=dict(device_map='auto'),
batch_padding=False, # if false, inference with for-loop without batch padding
run_cfg=dict(num_gpus=4, num_procs=1),
run_cfg=dict(num_gpus=4),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
# LLaMA 7B
dict(
type=HuggingFaceCausalLM,
type=HuggingFaceBaseModel,
abbr='llama-7b-hf',
path="huggyllama/llama-7b",
tokenizer_path='huggyllama/llama-7b',
tokenizer_kwargs=dict(padding_side='left',
truncation_side='left',
use_fast=False,
),
max_out_len=100,
max_seq_len=2048,
path='huggyllama/llama-7b',
max_out_len=1024,
batch_size=8,
model_kwargs=dict(device_map='auto'),
batch_padding=False, # if false, inference with for-loop without batch padding
run_cfg=dict(num_gpus=1, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import TurboMindModel
_meta_template = dict(
round=[
dict(role="HUMAN", begin='<|begin_of_text|>user<|end_header_id|>\n\n', end='<|eot_id|>'),
dict(role="BOT", begin='<|begin_of_text|>assistant<|end_header_id|>\n\n', end='<|eot_id|>', generate=True),
],
)
models = [
dict(
type=TurboMindModel,
abbr='llama-3-70b-instruct-lmdeploy',
path='meta-llama/Meta-Llama-3-70B-Instruct',
engine_config=dict(session_len=4096, max_batch_size=16, tp=4),
gen_config=dict(top_k=1, temperature=1, top_p=0.9, max_new_tokens=1024, stop_words=[128001, 128009]),
max_out_len=1024,
max_seq_len=4096,
batch_size=16,
concurrency=16,
meta_template=_meta_template,
run_cfg=dict(num_gpus=4),
)
]
from opencompass.models import TurboMindModel
_meta_template = dict(
round=[
dict(role="HUMAN", begin='<|begin_of_text|>user<|end_header_id|>\n\n', end='<|eot_id|>'),
dict(role="BOT", begin='<|begin_of_text|>assistant<|end_header_id|>\n\n', end='<|eot_id|>', generate=True),
],
)
models = [
dict(
type=TurboMindModel,
abbr='llama-3-8b-instruct-lmdeploy',
path='meta-llama/Meta-Llama-3-8B-Instruct',
engine_config=dict(session_len=4096, max_batch_size=16, tp=1),
gen_config=dict(top_k=1, temperature=1, top_p=0.9, max_new_tokens=1024, stop_words=[128001, 128009]),
max_out_len=1024,
max_seq_len=4096,
batch_size=16,
concurrency=16,
meta_template=_meta_template,
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
begin="<s>",
round=[
dict(role="HUMAN", begin='[INST] ', end=' [/INST]'),
dict(role="BOT", begin="", end='</s> ', generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFacewithChatTemplate,
abbr='mistral-7b-instruct-v0.1-hf',
type=HuggingFaceCausalLM,
path='mistralai/Mistral-7B-Instruct-v0.1',
tokenizer_path='mistralai/Mistral-7B-Instruct-v0.1',
model_kwargs=dict(
device_map='auto',
trust_remote_code=True,
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
trust_remote_code=True,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
batch_padding=True,
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
_meta_template = dict(
begin="<s>",
round=[
dict(role="HUMAN", begin='[INST] ', end=' [/INST]'),
dict(role="BOT", begin="", end='</s> ', generate=True),
],
)
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFacewithChatTemplate,
abbr='mistral-7b-instruct-v0.2-hf',
type=HuggingFaceCausalLM,
path='mistralai/Mistral-7B-Instruct-v0.2',
tokenizer_path='mistralai/Mistral-7B-Instruct-v0.2',
model_kwargs=dict(
device_map='auto',
trust_remote_code=True,
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
trust_remote_code=True,
),
meta_template=_meta_template,
max_out_len=100,
max_seq_len=2048,
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
batch_padding=True,
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceBaseModel,
abbr='mistral-7b-v0.1-hf',
type=HuggingFaceCausalLM,
path='mistralai/Mistral-7B-v0.1',
tokenizer_path='mistralai/Mistral-7B-v0.1',
model_kwargs=dict(
device_map='auto',
trust_remote_code=True,
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
trust_remote_code=True,
),
max_out_len=100,
max_seq_len=2048,
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFaceCausalLM
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceBaseModel,
abbr='mistral-7b-v0.2-hf',
type=HuggingFaceCausalLM,
path='alpindale/Mistral-7B-v0.2-hf',
model_kwargs=dict(
device_map='auto',
trust_remote_code=True,
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
trust_remote_code=True,
),
max_out_len=100,
max_seq_len=2048,
path='mistral-community/Mistral-7B-v0.2',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=1, num_procs=1),
run_cfg=dict(num_gpus=1),
)
]
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFacewithChatTemplate,
abbr='mixtral-8x22b-instruct-v0.1-hf',
path='mistralai/Mixtral-8x22B-Instruct-v0.1',
max_out_len=1024,
batch_size=4,
run_cfg=dict(num_gpus=8),
)
]
from opencompass.models import HuggingFaceBaseModel
models = [
dict(
type=HuggingFaceBaseModel,
abbr='mixtral-8x22b-v0.1-hf',
path='mistralai/Mixtral-8x22B-v0.1',
max_out_len=1024,
batch_size=4,
run_cfg=dict(num_gpus=8),
)
]
from opencompass.models import HuggingFacewithChatTemplate
models = [
dict(
type=HuggingFacewithChatTemplate,
abbr='mixtral-8x7b-instruct-v0.1-hf',
path='mistralai/Mixtral-8x7B-Instruct-v0.1',
max_out_len=1024,
batch_size=8,
run_cfg=dict(num_gpus=4),
)
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment