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

How to increase the size of the context? #205

Closed
anirbansaha96 opened this issue Jul 8, 2020 · 4 comments
Closed

How to increase the size of the context? #205

anirbansaha96 opened this issue Jul 8, 2020 · 4 comments
Assignees

Comments

@anirbansaha96
Copy link
Contributor

When I'm printing my output using the print_answers(prediction, details=' minimal'), I'm getting an output where the context is in a way trimmed. For example:

'answer': 'Data Masking',
        'context': "cess based on a user's\n"
                   'identity,role, or execution context).\n'
                   'Dynamic Data Masking (Using Permission & Policy,\n'
                   'limits sensitive data exposure by maskin'}

In the Context Vector, I want to have the full paragraph from which this answer was retrieved as it would help in downstream tasks. What would be the easiest way to achieve this?

@tholor
Copy link
Member

tholor commented Jul 8, 2020

Just increase the argument context_window_sizein the FARMReader :)

context_window_size: int = 150,

@anirbansaha96
Copy link
Contributor Author

To implement this do I need to fork the repo change it in the source code, and then use this repo or is this a parameter we can directly change when we, for example, initialize the reader while working.

@tholor
Copy link
Member

tholor commented Jul 8, 2020

You can pass the argument when you initialize the reader, just like
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2", use_gpu=True, context_window_size=300)

If you are using Haystack via the REST API, you can simply set an environment variable CONTEXT_WINDOW_SIZE or change the value in rest_api/config.py.

@anirbansaha96
Copy link
Contributor Author

Yes, thank you for the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants