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

[model cards] Also include HF datasets in the model card metadata #2711

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
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
5 changes: 5 additions & 0 deletions sentence_transformers/model_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class SentenceTransformerModelCardData(CardData):
citations: Dict[str, str] = field(default_factory=dict, init=False)
best_model_step: Optional[int] = field(default=None, init=False)
trainer: Optional["SentenceTransformerTrainer"] = field(default=None, init=False, repr=False)
datasets: List[str] = field(default_factory=list, init=False, repr=False)

# Utility fields
first_save: bool = field(default=True, init=False)
Expand Down Expand Up @@ -357,6 +358,10 @@ def validate_datasets(self, dataset_list, infer_languages: bool = True) -> None:
if language not in self.language:
self.language.append(language)

# Track dataset IDs for the metadata
if info.id not in self.datasets:
self.datasets.append(info.id)

output_dataset_list.append(dataset)
return output_dataset_list

Expand Down
Loading