basaran icon indicating copy to clipboard operation
basaran copied to clipboard

crash when running mosaicml/mpt-7b-* models: KeyError: 'attention_mask'

Open tarasglek opened this issue 1 year ago • 2 comments

from basaran.model import load_model

model = load_model('mosaicml/mpt-7b-storywriter',  trust_remote_code=True, load_in_8bit=True,)

for choice in model("once upon a time"):
    print(choice)
Traceback (most recent call last):
  File "/home/taras/Documents/ctranslate2/basaran/run.py", line 7, in <module>
    for choice in model("once upon a time"):
  File "/home/taras/Documents/ctranslate2/basaran/.venv/lib/python3.9/site-packages/basaran/model.py", line 73, in __call__
    for (
  File "/home/taras/Documents/ctranslate2/basaran/.venv/lib/python3.9/site-packages/basaran/model.py", line 233, in generate
    inputs = self.model.prepare_inputs_for_generation(
  File "/home/taras/.cache/huggingface/modules/transformers_modules/mosaicml/mpt-7b-storywriter/8667424ea9d973d3c01596fcbb86a3a8bc164299/modeling_mpt.py", line 280, in prepare_inputs_for_generation
    attention_mask = kwargs['attention_mask'].bool()
KeyError: 'attention_mask'

tarasglek avatar Jun 12 '23 12:06 tarasglek

Same thing happens with mosaicml/mpt-7b-instruct

tarasglek avatar Jun 12 '23 13:06 tarasglek

It appears that the error originates from the internal code of MPT. We will conduct further testing.

fardeon avatar Jun 13 '23 04:06 fardeon