allow optionally fill attention mask in forward #457
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
allow passing inputs without attention mask for OVModelForCausalLM
For inference openvino expect that all inputs that exists in model filled before starting inference.
Input filling for text generation controlled when you run generate function and guarantee that all inputs provided.
But when user trying to use forward directly (building own custom generation pipeline for example), there is no knowledge which inputs available in model.
PyTorch models allow run model without passing some optional inputs, like attention_mask (filling it inside with default values). In our case, if user do not provide this input, it leads to error that do not have any context what went wrong.
These changes adding attention_mask filling inside forward for improving user experience
Before submitting