-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve output of the tutorials #1675
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…n tTutorial11 (both)
docs/_src/tutorials/tutorials/1.md
Outdated
|
||
# from pprint import pprint | ||
|
||
# pprint(prediction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we also wanted to show the actual output here (at least the first answer in the json and then ...
) 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! I put it in the .py script but somehow forgot to put it here 🤦
print_answers(prediction, details="minimal") | ||
|
||
# Or directly print the object | ||
from pprint import pprint | ||
pprint(prediction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the console output, the minimal printout is followed immediately by the full printout. I think it would be good if we added headings like
Minimal Output
============
and
Full Output
========
So that new users aren't overwhelmed by how much is being printed out
# Answer(answer='Joffrey', type='extractive', score=0.6753827035427094, }), | ||
# Answer(answer='Robb', type='extractive', score=0.6665983200073242, }) | ||
# ], | ||
# 'documents': [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe its worth explaining exactly which documents these are. I assume they are the ones returned by the Retriever. But I assume also multiple answers could come from the one document, meaning that some of these candidate documents might not contain an answer.
@@ -64,7 +64,7 @@ | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More general point about Tutorial 3. This is essentially the same as Tutorial 1 except that we're using a different document store. Do we want to make the same printing changes to this tutorial too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! 👍
print(f"\n * Generating questions for document {idx}: {document.content[:50]}...") | ||
result = question_generation_pipeline.run(documents=[document]) | ||
|
||
print("Generated questions:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like these titles but the printout seems a bit dense. Could you add a line break before "Generated questions"?
@@ -46,8 +52,14 @@ | |||
# RetrieverQuestionGenerationPipeline | |||
retriever = ElasticsearchRetriever(document_store=document_store) | |||
rqg_pipeline = RetrieverQuestionGenerationPipeline(retriever, question_generator) | |||
|
|||
print(f"\n * Generating questions for documents matching the query 'Arya Stark'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also create titles for each pipeline we are using and print them to the console so that the outputs don't get confused so easily e.g.
QuestionGenerationPipeline
=====================
Also just want to ask whether you evaluated the necessity of these steps that were suggested in the original issue?
|
Fixes #1595