Spaces:
Sleeping
Sleeping
embeddings test Instructor-XL
Browse files- Code.txt +0 -0
- __pycache__/util.cpython-310.pyc +0 -0
- util.py +3 -1
Code.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
__pycache__/util.cpython-310.pyc
CHANGED
Binary files a/__pycache__/util.cpython-310.pyc and b/__pycache__/util.cpython-310.pyc differ
|
|
util.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
|
4 |
from langchain_community.vectorstores import Chroma
|
5 |
# from langchain.llms.huggingface_pipeline import HuggingFacePipeline
|
6 |
# from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, BitsAndBytesConfig
|
@@ -21,7 +22,8 @@ genai.configure(api_key = os.environ['GOOGLE_API_KEY'])
|
|
21 |
|
22 |
|
23 |
model_kwargs = {'device': 'cpu'}
|
24 |
-
embeddings = HuggingFaceEmbeddings(model_kwargs=model_kwargs)
|
|
|
25 |
|
26 |
# tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
27 |
# model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map='auto', quantization_config = quantization_config)
|
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
4 |
+
from sentence_transformers import SentenceTransformer
|
5 |
from langchain_community.vectorstores import Chroma
|
6 |
# from langchain.llms.huggingface_pipeline import HuggingFacePipeline
|
7 |
# from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, BitsAndBytesConfig
|
|
|
22 |
|
23 |
|
24 |
model_kwargs = {'device': 'cpu'}
|
25 |
+
embeddings = HuggingFaceEmbeddings(model_name="hkunlp/instructor-xl",model_kwargs=model_kwargs, )
|
26 |
+
# embeddings = SentenceTransformer(model_name_or_path="All-MiniLM-L6-v2")
|
27 |
|
28 |
# tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
29 |
# model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map='auto', quantization_config = quantization_config)
|