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] attention_mask may appear None for newer versions of LLaMA #47

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[fix] attention_mask may appear None for newer versions of LLaMA
  • Loading branch information
xingchensong committed Dec 27, 2023
commit 0e751bb3a6c5860149505e97d8627694958b0ced
2 changes: 2 additions & 0 deletions models/LMClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def __init__(self, args):

self.model_config = args.model
config = AutoConfig.from_pretrained(args.model)
if getattr(config, '_attn_implementation_internal', None) is None:
config._attn_implementation_internal = 'eager'
self.tokenizer = AutoTokenizer.from_pretrained(args.model, use_fast=False,legacy=False)
# self.model = AutoModelForCausalLM.from_pretrained(args.model, config=config, device_map='cpu',torch_dtype=config.torch_dtype)
self.model = AutoModelForCausalLM.from_pretrained(args.model, config=config, device_map='cpu',torch_dtype=torch.float16)
Expand Down