Skip to content

Commit

Permalink
update abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed Nov 4, 2023
1 parent f5445b2 commit 4eb4806
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/infinity_emb/infinity_emb/transformer/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class BaseTransformer(ABC): # Inherit from ABC(Abstract base class)
@abstractmethod # Decorator to define an abstract method
def encode_pre(self, sentences: List[str]) -> INPUT_FEATURE:
pass
"""takes care of the tokenization and feature preparation"""

@abstractmethod
def encode_core(self, features: INPUT_FEATURE) -> OUT_FEATURES:
pass
"""runs plain inference, on cpu/gpu"""

@abstractmethod
def encode_post(self, embedding: OUT_FEATURES) -> NpEmbeddingType:
pass
"""runs post encoding such as normlization"""

@abstractmethod
def tokenize_lengths(self, sentences: List[str]) -> List[int]:
pass
"""gets the lengths of each sentences according to tokenize/len etc."""

0 comments on commit 4eb4806

Please sign in to comment.