Populates the `model_card` with library name and optional tags.
(model_card: ModelCard, tags: str | list[str] | None = None)
| 186 | |
| 187 | |
| 188 | def populate_model_card(model_card: ModelCard, tags: str | list[str] | None = None) -> ModelCard: |
| 189 | """Populates the `model_card` with library name and optional tags.""" |
| 190 | if model_card.data.library_name is None: |
| 191 | model_card.data.library_name = "diffusers" |
| 192 | |
| 193 | if tags is not None: |
| 194 | if isinstance(tags, str): |
| 195 | tags = [tags] |
| 196 | if model_card.data.tags is None: |
| 197 | model_card.data.tags = [] |
| 198 | for tag in tags: |
| 199 | model_card.data.tags.append(tag) |
| 200 | |
| 201 | return model_card |
| 202 | |
| 203 | |
| 204 | def extract_commit_hash(resolved_file: str | None, commit_hash: str | None = None): |
no outgoing calls
searching dependent graphs…