Spaces:
Build error
Build error
Download captum/concept/_utils/common.py from markytools/strexp: direct link, hf CLI and curl.
- Browser
- Download file 726 Bytes
-
https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/concept/_utils/common.py
- Command line
-
hf download hf://spaces/markytools/strexp/captum/concept/_utils/common.py
-
curl -L -o common.py https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/concept/_utils/common.py
726 Bytes
| #!/usr/bin/env python3 | |
| from typing import List | |
| from captum.concept._core.concept import Concept | |
| def concepts_to_str(concepts: List[Concept]) -> str: | |
| r""" | |
| Returns a string of hyphen("-") concatenated concept names. | |
| Example output: "striped-random_0-random_1" | |
| Args: | |
| concepts (list[Concept]): a List of concept names to be | |
| concatenated and used as a concepts key. These concept | |
| names are respective to the Concept objects used for | |
| the classifier train. | |
| Returns: | |
| names_str (str): A string of hyphen("-") concatenated | |
| concept names. Ex.: "striped-random_0-random_1" | |
| """ | |
| return "-".join([str(c.id) for c in concepts]) | |