Adrian Cowham commited on
Commit
1e894a3
·
1 Parent(s): 1361b3e

changed embeddign model

Browse files
Files changed (1) hide show
  1. src/core/embedding.py +9 -6
src/core/embedding.py CHANGED
@@ -48,15 +48,18 @@ class FolderIndex:
48
 
49
 
50
  def embed_files(files: List[File]) -> FolderIndex:
51
- model_name = "adriancowham/letstalk-embed-gte-small"
52
  model_kwargs = {'device': 'cpu'}
53
  encode_kwargs = {'normalize_embeddings': True} # set True to compute cosine similarity
54
  print("Loading model...")
55
- model_norm = HuggingFaceEmbeddings(
56
- model_name=model_name,
57
- model_kwargs=model_kwargs,
58
- encode_kwargs=encode_kwargs
59
- )
 
 
 
60
  print("Model loaded.")
61
  embeddings = model_norm
62
  return FolderIndex.from_files(
 
48
 
49
 
50
  def embed_files(files: List[File]) -> FolderIndex:
51
+ model_name = "adriancowham/letstalk-mythomax-embed-gte-small"
52
  model_kwargs = {'device': 'cpu'}
53
  encode_kwargs = {'normalize_embeddings': True} # set True to compute cosine similarity
54
  print("Loading model...")
55
+ try:
56
+ model_norm = HuggingFaceEmbeddings(
57
+ model_name=model_name,
58
+ model_kwargs=model_kwargs,
59
+ encode_kwargs=encode_kwargs,
60
+ )
61
+ except Exception as exception:
62
+ print(f"Model not found. Loading fake model...{exception}")
63
  print("Model loaded.")
64
  embeddings = model_norm
65
  return FolderIndex.from_files(