Spaces:
Running
on
Zero
Running
on
Zero
Update main.py
Browse files
main.py
CHANGED
@@ -27,7 +27,7 @@ EXAMPLE_QUERIES = [
|
|
27 |
"What is known about different modes for human-AI teaming?",
|
28 |
]
|
29 |
EMBEDDING_MODEL_NAME = "allenai-specter"
|
30 |
-
LLM_MODEL_NAME = "Qwen/Qwen2-7B-Instruct"
|
31 |
|
32 |
# Load the dataset and convert to pandas
|
33 |
data = pandas.read_parquet("hf://datasets/ccm/publications/data/train-00000-of-00001.parquet")
|
@@ -43,12 +43,12 @@ data.reset_index(inplace=True)
|
|
43 |
model = sentence_transformers.SentenceTransformer(EMBEDDING_MODEL_NAME)
|
44 |
|
45 |
# Create an LLM pipeline that we can send queries to
|
46 |
-
tokenizer = transformers.AutoTokenizer.from_pretrained(LLM_MODEL_NAME)
|
47 |
streamer = transformers.TextIteratorStreamer(
|
48 |
tokenizer, skip_prompt=True, skip_special_tokens=True
|
49 |
)
|
50 |
chatmodel = transformers.AutoModelForCausalLM.from_pretrained(
|
51 |
-
LLM_MODEL_NAME, device_map="auto", torch_dtype="auto"
|
52 |
)
|
53 |
|
54 |
# Create a FAISS index for fast similarity search
|
|
|
27 |
"What is known about different modes for human-AI teaming?",
|
28 |
]
|
29 |
EMBEDDING_MODEL_NAME = "allenai-specter"
|
30 |
+
LLM_MODEL_NAME = "microsoft/Phi-3-small-8k-instruct-onnx-cuda" #"Qwen/Qwen2-7B-Instruct"
|
31 |
|
32 |
# Load the dataset and convert to pandas
|
33 |
data = pandas.read_parquet("hf://datasets/ccm/publications/data/train-00000-of-00001.parquet")
|
|
|
43 |
model = sentence_transformers.SentenceTransformer(EMBEDDING_MODEL_NAME)
|
44 |
|
45 |
# Create an LLM pipeline that we can send queries to
|
46 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(LLM_MODEL_NAME, trust_remote_code=True)
|
47 |
streamer = transformers.TextIteratorStreamer(
|
48 |
tokenizer, skip_prompt=True, skip_special_tokens=True
|
49 |
)
|
50 |
chatmodel = transformers.AutoModelForCausalLM.from_pretrained(
|
51 |
+
LLM_MODEL_NAME, device_map="auto", torch_dtype="auto", trust_remote_code=True
|
52 |
)
|
53 |
|
54 |
# Create a FAISS index for fast similarity search
|