Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix llama_v2_7b_16h for torch.jit.trace #2121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions torchbenchmark/util/framework/huggingface/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ def __init__(self, name, test, device, batch_size=None, extra_args=[]):
if class_models[name][2] == "ReformerConfig()" and not config.num_buckets:
# silence "config.num_buckets is not set. Setting config.num_buckets to 128"
config.num_buckets = 128
if name in {"llama_v2_7b_16h", "llama_v2_7b", "llama_v2_13b", "llama_v2_70b"}:
# Workaround for the following error:
# Attention using SDPA can not be traced with torch.jit.trace when no attention_mask is provided.
# To solve this issue, please either load your model with the argument attn_implementation="eager" or
# pass an attention_mask input when tracing the model.
config._attn_implementation = "eager"
class_ctor = getattr(transformers, class_models[name][3])
kwargs = {}
hugging_face_models_requiring_trust_remote_code = ["hf_Falcon_7b", "hf_MPT_7b_instruct", "phi_1_5", "hf_Yi"]
Expand Down