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

Example keys with dashes are inaccessible #20

Closed
stephenbach opened this issue May 23, 2021 · 3 comments
Closed

Example keys with dashes are inaccessible #20

stephenbach opened this issue May 23, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@stephenbach
Copy link
Member

Seems to be a quirk of the way we're using Jinja. See, e.g., TREC. A template like

{{text}}

Is this asking about a description, an entity, an abbreviation, a person, a quantity, or a location?
|||
{{ ["Description", "Entity", "Abbreviation", "Person", "Quantity", "Location"] [label-coarse] }}

doesn't render correctly because label-coarse is parsed as label. See, e.g., https://stackoverflow.com/questions/28652373/jinja2-in-variable-bug

Can probably just fix by replacing dashes with underscores in keys of the example dictionary when rendering. Might be good to change the displayed information in the sidebar on the fly to match.

@Urmish
Copy link
Contributor

Urmish commented May 23, 2021

I tried pushing a fix to this, but got the following error -
remote: Permission to bigscience-workshop/promptsource.git denied to Urmish

The fix I did was simple. When the template is being saved, I replace all "-" with "_".

image

Worked locally for me, I was able to render the output on the side bar

If we want to save as is and do it just before its applied and rendered in the side bar, we can do the replace call before st.write -
image

@stephenbach
Copy link
Member Author

Thanks for your help with this! I think we might want a different approach, because (at least for me?) this creates a valid Jinja template, but it doesn't actually render the template correctly because there's still a key of "label-coarse" in the dictionary coming from the dataset library. (It renders part of the template, but it doesn't show the answer to the question.) So instead of modifying the templates, I think we need to modify the examples.

@Urmish
Copy link
Contributor

Urmish commented May 23, 2021

Ah! Yes, see if this works?
#21

Changes both examples and template. I can see the render happening without the label error and the label being displayed.

@VictorSanh VictorSanh added the bug Something isn't working label May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@stephenbach @Urmish @VictorSanh and others