Skip to content

Adding the Streamlit demo app code for the RAG model#7455

Closed
yjernite wants to merge 2 commits intohuggingface:masterfrom
yjernite:add_rag_demo_app
Closed

Adding the Streamlit demo app code for the RAG model#7455
yjernite wants to merge 2 commits intohuggingface:masterfrom
yjernite:add_rag_demo_app

Conversation

@yjernite
Copy link
Copy Markdown
Member

Adding RAG demo code

This PR shares the code for the RAG demo running here for future reference. The code is added in examples/rag

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2020

Codecov Report

Merging #7455 into master will increase coverage by 2.31%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7455      +/-   ##
==========================================
+ Coverage   76.60%   78.91%   +2.31%     
==========================================
  Files         181      181              
  Lines       35865    35865              
==========================================
+ Hits        27473    28302     +829     
+ Misses       8392     7563     -829     
Impacted Files Coverage Δ
src/transformers/modeling_tf_longformer.py 17.46% <0.00%> (-81.13%) ⬇️
src/transformers/modeling_longformer.py 18.69% <0.00%> (-55.46%) ⬇️
src/transformers/configuration_longformer.py 81.81% <0.00%> (-18.19%) ⬇️
src/transformers/modeling_roberta.py 81.51% <0.00%> (-15.11%) ⬇️
src/transformers/modeling_mobilebert.py 79.31% <0.00%> (-10.12%) ⬇️
src/transformers/generation_tf_utils.py 86.21% <0.00%> (-0.51%) ⬇️
src/transformers/tokenization_utils_base.py 93.91% <0.00%> (+0.27%) ⬆️
src/transformers/modeling_bart.py 94.61% <0.00%> (+0.50%) ⬆️
src/transformers/activations.py 83.33% <0.00%> (+4.16%) ⬆️
src/transformers/modeling_marian.py 90.00% <0.00%> (+30.00%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e9a1fb...291cea0. Read the comment docs.

Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for adding it! Do you think you could add a mention of it in the RAG readme, to explain how to run the app and what it does?


# Full screen question and answers
st.markdown("--- ")
left_a, right_a = st.columns(2)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current version of streamlit uses beta_columns instead of columns. I think this may be from the horiz-layout branch of streamlit, so it would be nice to indicate somewhere if that is the case or change to beta_columns.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was merged from that branch with the beta_ prefix in this PR

right_a.markdown(answer_md)

# Split into left and right
left_c, right_c = st.columns(2)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, current version of streamlit uses st.beta_columns()

# Split into left and right
left_c, right_c = st.columns(2)

col_a, col_b, col_c, col_d = st.columns(4)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, current version of streamlit uses st.beta_columns()

)

# token-level plot
plot_container = col_d.container()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the columns, the current function for the container is beta_container().

@LittlePea13
Copy link
Copy Markdown

Thank you for the demo! I added some comments with an issue I faced when running it regarding Streamlit.

@github-actions
Copy link
Copy Markdown
Contributor

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot closed this Apr 25, 2021
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.91%. Comparing base (9e9a1fb) to head (291cea0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7455      +/-   ##
==========================================
+ Coverage   76.60%   78.91%   +2.31%     
==========================================
  Files         181      181              
  Lines       35865    35865              
==========================================
+ Hits        27473    28302     +829     
+ Misses       8392     7563     -829     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants