Spaces:
Runtime error

BFManza commited on
Commit
43efaa1
·
1 Parent(s): 28f2cc4

add logs to review

Browse files
Files changed (1) hide show
  1. utilities/step1.py +3 -1
utilities/step1.py CHANGED
@@ -10,15 +10,17 @@ directory = "./documents"
10
  # Load the documents from the directory using LangChain
11
  loader = DirectoryLoader(directory, glob="*.txt", loader_cls=TextLoader)
12
  documents = loader.load()
 
13
 
14
  # Split the text data into chunks for faster processing
15
  splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
16
  texts = splitter.split_documents(documents)
17
-
18
  # Create a Hugging Face Embeddings object with the desired model name and device
19
  model_name = "sentence-transformers/all-MiniLM-L6-v2"
20
  device = "cpu"
21
  embeddings = HuggingFaceEmbeddings(model_name, model_kwargs={"device": device})
 
22
 
23
  # Use the FAISS library to index the vectors generated by the Hugging Face model
24
  db = FAISS.from_documents(texts, embeddings)
 
10
  # Load the documents from the directory using LangChain
11
  loader = DirectoryLoader(directory, glob="*.txt", loader_cls=TextLoader)
12
  documents = loader.load()
13
+ print(f'\n ********* 1 \n {documents}')
14
 
15
  # Split the text data into chunks for faster processing
16
  splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
17
  texts = splitter.split_documents(documents)
18
+ print(f'\n ********* 2 \n {texts}')
19
  # Create a Hugging Face Embeddings object with the desired model name and device
20
  model_name = "sentence-transformers/all-MiniLM-L6-v2"
21
  device = "cpu"
22
  embeddings = HuggingFaceEmbeddings(model_name, model_kwargs={"device": device})
23
+ print(f'\n ********* 3 \n {embeddings}')
24
 
25
  # Use the FAISS library to index the vectors generated by the Hugging Face model
26
  db = FAISS.from_documents(texts, embeddings)