ilsa15 ZunairaHawwar commited on
Commit
f26f21c
·
verified ·
1 Parent(s): db9df7d

Update app.py (#5)

Browse files

- Update app.py (c36c211dd1a549bffa8b9e50c265c4b9480f61ff)


Co-authored-by: Zunaira Hawwar <ZunairaHawwar@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -671,11 +671,12 @@ GROQ_MODEL = "llama3-8b-8192"
671
  # Initialize Groq client
672
  groq_client = Groq(api_key=GROQ_API_KEY)
673
 
674
- # Initialize embedding function for ChromaDB
675
- embedding_function = SentenceTransformerEmbeddingFunction(
676
- model_name="all-MiniLM-L6-v2",
677
- device="cpu"
678
- )
 
679
 
680
  # Initialize ChromaDB Persistent Client
681
  chroma_client = chromadb.PersistentClient(path="./chroma_db", settings=Settings(anonymized_telemetry=False))
 
671
  # Initialize Groq client
672
  groq_client = Groq(api_key=GROQ_API_KEY)
673
 
674
+ # Explicitly load SentenceTransformer model first to avoid meta tensor bug
675
+ embedding_model = SentenceTransformer("all-MiniLM-L6-v2")
676
+
677
+ # Pass this model into Chroma's embedding function
678
+ embedding_function = SentenceTransformerEmbeddingFunction(embedding_model=embedding_model)
679
+
680
 
681
  # Initialize ChromaDB Persistent Client
682
  chroma_client = chromadb.PersistentClient(path="./chroma_db", settings=Settings(anonymized_telemetry=False))