Skip to content

Embedding Ontology

Bases: Ontology

Source code in autodistill/core/embedding_ontology.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@dataclass
class EmbeddingOntology(Ontology):
    embeddingMap: Dict[str, np.ndarray]

    def __init__(self, embeddingMap, cluster=1):
        self.embeddingMap = embeddingMap

    @classmethod
    def process(self, model: EmbeddingModel):
        pass

    def prompts(self) -> List[np.ndarray]:
        return [prompt for prompt, _ in self.embeddingMap]

    def classes(self) -> List[str]:
        return [cls for _, cls in self.embeddingMap]