Skip to content

Commit

Permalink
Avoid 2 consecutive empty lines in model card
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaarsen committed Nov 26, 2024
1 parent a669699 commit e693795
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sentence_transformers/model_card_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ You can finetune this model on your own dataset.
{% for dataset in dataset_list %}{% if dataset_list | length > 3 %}<details><summary>{{ dataset['name'] or 'Unnamed Dataset' }}</summary>
{% endif %}
#### {{ dataset['name'] or 'Unnamed Dataset' }}

{% if dataset['name'] %}* Dataset: {% if 'id' in dataset %}[{{ dataset['name'] }}](https://huggingface.co/datasets/{{ dataset['id'] }}){% else %}{{ dataset['name'] }}{% endif %}
{% if dataset['name'] %}
* Dataset: {% if 'id' in dataset %}[{{ dataset['name'] }}](https://huggingface.co/datasets/{{ dataset['id'] }}){% else %}{{ dataset['name'] }}{% endif %}
{%- if 'revision' in dataset and 'id' in dataset %} at [{{ dataset['revision'][:7] }}](https://huggingface.co/datasets/{{ dataset['id'] }}/tree/{{ dataset['revision'] }}){% endif %}{% endif %}
{% if dataset['size'] %}* Size: {{ "{:,}".format(dataset['size']) }} {{ dataset_type }} samples
{% endif %}* Columns: {% if dataset['columns'] | length == 1 %}{{ dataset['columns'][0] }}{% elif dataset['columns'] | length == 2 %}{{ dataset['columns'][0] }} and {{ dataset['columns'][1] }}{% else %}{{ dataset['columns'][:-1] | join(', ') }}, and {{ dataset['columns'][-1] }}{% endif %}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_model_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ def test_model_card_base(

for substring in expected_substrings:
assert substring in model_card

# We don't want to have two consecutive empty lines anywhere
assert "\n\n\n" not in model_card

0 comments on commit e693795

Please sign in to comment.