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

Add "generated_from_trainer" tag to auto-generated model cards #2710

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sentence_transformers/model_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ class SentenceTransformerModelCardData(CardData):
"sentence-transformers",
"sentence-similarity",
"feature-extraction",
"generated_from_trainer",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this one should be part of the SentenceTransformerTrainer rather than default model card (or have a check here so it's only added if it's being used with the trainer

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The model card is only generated if:

  1. the SentenceTransformerTrainer has been initialized with this model, or
  2. the loaded model wasn't a Sentence Transformer model

Otherwise, the original model card gets reused. E.g. if you load and save/upload BAAI/bge-base-en-v1.5 without training then it'll reuse that model card.

So, we would only get generated_with_trainer "wrongly" if someone loads a non-Sentence Transformer model, doesn't train it, and then uploads it. That said, I think this is really easy to fix, so I'll change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved this via 10d70ff

]
)
generate_widget_examples: bool = True
Expand Down
Loading