Hey all!
I really wanted to try out one of Falcon models with question answering task so I followed this tutorial in the docs: Question answering (huggingface.co) since on the top of it it says it’s applicable with Falcon models.
So I reused the code and switch distilbert model to falcon-7b and my code fails this error message:
TypeError: forward() got an unexpected keyword argument 'token_type_ids'
My code looks like this:
from transformers import AutoModelForQuestionAnswering
model_name = "tiiuae/falcon-7b"
model = AutoModelForQuestionAnswering.from_pretrained(
pretrained_model_name_or_path=model_name,
cache_dir="/mnt/tmp",
trust_remote_code=True
)
from transformers import AutoTokenizer, PretrainedConfig
tokenizer = AutoTokenizer.from_pretrained(
pretrained_model_name_or_path=model_name,
cache_dir="/mnt/tmp",
trust_remote_code=True,
return_tensors="pt",
)
from transformers import pipeline
question_answerer = pipeline(
"question-answering",
model=model,
tokenizer=tokenizer
)
question_answerer(question=question, context=context)
Code fails on the very last step when I try to run inferencing on the pipeline. Any ideas?