Skip to content

Commit

Permalink
Ensure that self.model_card_data.model_id is set
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaarsen committed Jun 4, 2024
1 parent 0f84a7b commit 0dbd349
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sentence_transformers/SentenceTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,11 +1095,12 @@ def _create_model_card(
# we don't generate a new model card, but reuse the old one instead.
if self._model_card_text and self.model_card_data.trainer is None:
model_card = self._model_card_text
# If the original model card was saved without a model_id, we replace the model_id with the new model_id
model_card = model_card.replace(
'model = SentenceTransformer("sentence_transformers_model_id"',
f'model = SentenceTransformer("{self.model_card_data.model_id}"',
)
if self.model_card_data.model_id:
# If the original model card was saved without a model_id, we replace the model_id with the new model_id
model_card = model_card.replace(
'model = SentenceTransformer("sentence_transformers_model_id"',
f'model = SentenceTransformer("{self.model_card_data.model_id}"',
)
else:
try:
model_card = generate_model_card(self)
Expand Down

0 comments on commit 0dbd349

Please sign in to comment.