Update README.md
Browse files
README.md
CHANGED
|
@@ -25,15 +25,18 @@ How to use
|
|
| 25 |
|
| 26 |
Download data
|
| 27 |
Load to use with LangChain
|
|
|
|
|
|
|
| 28 |
pip install -qqq langchain sentence_transformers faiss-cpu huggingface_hub
|
| 29 |
import os
|
| 30 |
from langchain.embeddings import HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings
|
| 31 |
|
| 32 |
from langchain.vectorstores.faiss import FAISS
|
| 33 |
from huggingface_hub import snapshot_download
|
|
|
|
| 34 |
|
| 35 |
# download the vectorstore for the book you want
|
| 36 |
-
|
| 37 |
cache_dir="cfa_level_1_cache"
|
| 38 |
vectorstore = snapshot_download(repo_id="nickmuchi/CFA_Level_1_Text_Embeddings",
|
| 39 |
repo_type="dataset",
|
|
@@ -41,7 +44,7 @@ vectorstore = snapshot_download(repo_id="nickmuchi/CFA_Level_1_Text_Embeddings",
|
|
| 41 |
allow_patterns=f"books/{book}/*", # to download only the one book
|
| 42 |
cache_dir=cache_dir,
|
| 43 |
)
|
| 44 |
-
|
| 45 |
# get path to the `vectorstore` folder that you just downloaded
|
| 46 |
# we'll look inside the `cache_dir` for the folder we want
|
| 47 |
target_dir = f"cfa/cfa_level_1"
|
|
|
|
| 25 |
|
| 26 |
Download data
|
| 27 |
Load to use with LangChain
|
| 28 |
+
|
| 29 |
+
'''
|
| 30 |
pip install -qqq langchain sentence_transformers faiss-cpu huggingface_hub
|
| 31 |
import os
|
| 32 |
from langchain.embeddings import HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings
|
| 33 |
|
| 34 |
from langchain.vectorstores.faiss import FAISS
|
| 35 |
from huggingface_hub import snapshot_download
|
| 36 |
+
'''
|
| 37 |
|
| 38 |
# download the vectorstore for the book you want
|
| 39 |
+
'''
|
| 40 |
cache_dir="cfa_level_1_cache"
|
| 41 |
vectorstore = snapshot_download(repo_id="nickmuchi/CFA_Level_1_Text_Embeddings",
|
| 42 |
repo_type="dataset",
|
|
|
|
| 44 |
allow_patterns=f"books/{book}/*", # to download only the one book
|
| 45 |
cache_dir=cache_dir,
|
| 46 |
)
|
| 47 |
+
'''
|
| 48 |
# get path to the `vectorstore` folder that you just downloaded
|
| 49 |
# we'll look inside the `cache_dir` for the folder we want
|
| 50 |
target_dir = f"cfa/cfa_level_1"
|