chore: Add support for GPU, MPS, and CPU

This commit is contained in:
unclecode
2024-05-17 21:56:13 +08:00
parent 0a902f562f
commit b6319c6f6e
5 changed files with 20 additions and 8 deletions

View File

@@ -178,11 +178,15 @@ class CosineStrategy(ExtractionStrategy):
self.buffer_embeddings = np.array([])
if self.verbose:
print(f"[LOG] Loading Extraction Model {model_name}")
if model_name == "bert-base-uncased":
self.tokenizer, self.model = load_bert_base_uncased()
elif model_name == "BAAI/bge-small-en-v1.5":
self.tokenizer, self.model = load_bge_small_en_v1_5()
self.nlp, self.device = load_text_multilabel_classifier()
if self.verbose: